Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Snitz Forums 2000 MOD-Group
 MOD Add-On Forum (W/Code)
 Topic/Reply CheckSum
 New Topic  Reply to Topic
 Printer Friendly
Next Page
Author Previous Topic Topic Next Topic
Page: of 2

Carefree
Advanced Member

Philippines
4207 Posts

Posted - 01 September 2013 :  00:54:10  Show Profile  Reply with Quote
I wrote this in response to a problem with double posting, thanks to a suggestion by PierreTopping. Basically, this mod adds a checksum value to topics and replies. When a post is made, it compares the checksum values of previous posts by the same member within the last 10 days. If it finds a match, the post is not made. Get your copy at SnitzBitz.

Note: The original CRC calculation was created by someone else, but the claimed "copyright" allows incorporation for free into existing code; provided the code is not listed on a website.

Edited by - Carefree on 01 September 2013 00:55:05

HuwR
Forum Admin

United Kingdom
20584 Posts

Posted - 02 September 2013 :  05:12:28  Show Profile  Visit HuwR's Homepage  Reply with Quote
quote:
Note: The original CRC calculation was created by someone else, but the claimed "copyright" allows incorporation for free into existing code; provided the code is not listed on a website.


Could you not have just used the forums SHA256 function to do this ?

MVC .net dev/test site | MVC .net running on Raspberry Pi
Go to Top of Page

Carefree
Advanced Member

Philippines
4207 Posts

Posted - 02 September 2013 :  07:19:15  Show Profile  Reply with Quote
Sure, but we'd end up with another long encrypted text area field. This field is only 255 characters and will probably never exceed 15.
Go to Top of Page

HuwR
Forum Admin

United Kingdom
20584 Posts

Posted - 02 September 2013 :  07:43:14  Show Profile  Visit HuwR's Homepage  Reply with Quote
A sha256 is 256 bits long -- as its name indicates.

If you are using an hexadecimal representation, each digit codes for 4 bits ; so you need 64 digits to represent 256 bits -- so, you need a varchar(64), or a char(64), as the length is always the same, not varying at all.

MVC .net dev/test site | MVC .net running on Raspberry Pi
Go to Top of Page

Carefree
Advanced Member

Philippines
4207 Posts

Posted - 02 September 2013 :  09:26:45  Show Profile  Reply with Quote
The longest checksum I've been able to create was 10 characters; even with a post of over 15000 characters. Switching it to sha256 would eliminate any potential copyright issue, so should probably do so if it will be incorporated into base code in the future.
Go to Top of Page

HuwR
Forum Admin

United Kingdom
20584 Posts

Posted - 02 September 2013 :  09:50:46  Show Profile  Visit HuwR's Homepage  Reply with Quote
as long as the CRC code copyright allows us to use it, it shouldn't be a problem, just wondered why you didn't use the sha256 function that was all, but definitely better to store 10 rather than 64 chars, possibly worth changing the dbs script to create a smaller field though if you don't think it will need 255.

MVC .net dev/test site | MVC .net running on Raspberry Pi
Go to Top of Page

ruirib
Snitz Forums Admin

Portugal
26364 Posts

Posted - 03 September 2013 :  05:13:05  Show Profile  Send ruirib a Yahoo! Message  Reply with Quote
Another suggestion, Carefree, if you don't mind.

In both SELECT statements for retrieving topics and replies to test, you are using SELECT *, but then you only use the T_CHKSUM and the R_CHKSUM fields. SELECT * is an horrible statement, performance wise, so I would just use the specific fields in those two statements.


Snitz 3.4 Readme | Like the support? Support Snitz too
Go to Top of Page

Carefree
Advanced Member

Philippines
4207 Posts

Posted - 03 September 2013 :  07:55:39  Show Profile  Reply with Quote
No problem. Easy to change. Done and updated.

Edited by - Carefree on 03 September 2013 08:19:07
Go to Top of Page

Webbo
Average Member

United Kingdom
982 Posts

Posted - 03 September 2013 :  16:43:35  Show Profile  Visit Webbo's Homepage  Reply with Quote
Is there any chance you can post the changes above to this thread for those that have already implemented it ?

Go to Top of Page

Carefree
Advanced Member

Philippines
4207 Posts

Posted - 03 September 2013 :  20:45:47  Show Profile  Reply with Quote
Sure. Implementing the change to the field size, though, would require you to rerun a dbs file.


"post_info.asp"


Look for the following line (appx 825):

strSql = "SELECT * FROM " & strTablePrefix & "TOPICS WHERE (T_AUTHOR="&MemberID&" AND T_DATE>='" & strDate10 & "' AND T_CHKSUM>'') ORDER BY T_DATE DESC"

Change it to say:

strSql = "SELECT T_CHKSUM FROM " & strTablePrefix & "TOPICS WHERE (T_AUTHOR="&MemberID&" AND T_DATE>='" & strDate10 & "' AND T_CHKSUM>'') ORDER BY T_DATE DESC"

Look for the following line (appx 1076):

		strSql = "SELECT * FROM " & strTablePrefix & "REPLY WHERE (R_AUTHOR="&MemberID&" AND R_DATE>='" & strDate10 & "' AND R_CHKSUM>'' AND TOPIC_ID=" & Topic_ID & ") ORDER BY R_DATE DESC"

Change it to say:

		strSql = "SELECT R_CHKSUM FROM " & strTablePrefix & "REPLY WHERE (R_AUTHOR="&MemberID&" AND R_DATE>='" & strDate10 & "' AND R_CHKSUM>'' AND TOPIC_ID=" & Topic_ID & ") ORDER BY R_DATE DESC"


"dbs_chksum_fieldsize.asp"


ChkSum v3.4.07 Field Size Change

[ALTER]
TOPICS
ALTER#T_CHKSUM#VARCHAR(16)#NULL#
[END]

[ALTER]
REPLY
ALTER#R_CHKSUM#VARCHAR(16)#NULL#
[END]

Edited by - Carefree on 03 September 2013 20:46:38
Go to Top of Page

Webbo
Average Member

United Kingdom
982 Posts

Posted - 04 September 2013 :  02:35:52  Show Profile  Visit Webbo's Homepage  Reply with Quote
The dbs file returns errors with a MySql database Carefree....

quote:

Adding Column T_CHKSUM...
ALTER TABLE FORUM_TOPICS ALTER COLUMN T_CHKSUM varchar(16) NULL
ALTER TABLE FORUM_TOPICS ALTER COLUMN T_CHKSUM varchar(16) NULL
-2147217900 | [MySQL][ODBC 5.1 Driver][mysqld-5.1.56-community]You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'varchar(16) NULL' at line 1

--------------------------------------------------------------------------------

Adding Column R_CHKSUM...
ALTER TABLE FORUM_REPLY ALTER COLUMN R_CHKSUM varchar(16) NULL
ALTER TABLE FORUM_REPLY ALTER COLUMN R_CHKSUM varchar(16) NULL
-2147217900 | [MySQL][ODBC 5.1 Driver][mysqld-5.1.56-community]You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'varchar(16) NULL' at line 1
Go to Top of Page

Carefree
Advanced Member

Philippines
4207 Posts

Posted - 04 September 2013 :  03:02:42  Show Profile  Reply with Quote
Should probably use mySql's "modify" command. Try this for MySQL:


ChkSum v3.4.07 Field Size Change

[ALTER]
TOPICS
MODIFY#T_CHKSUM#VARCHAR(16)#NULL#
[END]

[ALTER]
REPLY
MODIFY#R_CHKSUM#VARCHAR(16)#NULL#
[END]


Go to Top of Page

Webbo
Average Member

United Kingdom
982 Posts

Posted - 04 September 2013 :  13:18:31  Show Profile  Visit Webbo's Homepage  Reply with Quote
That created a table doesn't exist error, however the following worked

[ALTER]
MODIFY#TOPICS_T_CHKSUM#VARCHAR(16)#NULL#
[END]

[ALTER]
MODIFY#REPLY_R_CHKSUM#VARCHAR(16)#NULL#
[END]
Go to Top of Page

HuwR
Forum Admin

United Kingdom
20584 Posts

Posted - 04 September 2013 :  15:53:47  Show Profile  Visit HuwR's Homepage  Reply with Quote
check what you have against the code carefree posted, they are nothing like each other, you seem to have the TABLE (TOPICS) line missing and have the tablename added to the column line

MVC .net dev/test site | MVC .net running on Raspberry Pi
Go to Top of Page

Webbo
Average Member

United Kingdom
982 Posts

Posted - 04 September 2013 :  16:11:04  Show Profile  Visit Webbo's Homepage  Reply with Quote
Carefree's code returned the following:


Dropping Column...
ALTER TABLE FORUM_TOPICST_CHKSUM
ALTER TABLE FORUM_TOPICST_CHKSUM
-2147217865 | [MySQL][ODBC 5.1 Driver][mysqld-5.1.56-community]Table 'maggot_info.forum_topicst_chksum' doesn't exist

--------------------------------------------------------------------------------

Dropping Column...
ALTER TABLE FORUM_REPLYR_CHKSUM
ALTER TABLE FORUM_REPLYR_CHKSUM
-2147217865 | [MySQL][ODBC 5.1 Driver][mysqld-5.1.56-community]Table 'maggot_info.forum_replyr_chksum' doesn't exist

--------------------------------------------------------------------------------



My version did ..... er, nothing
Go to Top of Page

Webbo
Average Member

United Kingdom
982 Posts

Posted - 04 September 2013 :  16:18:15  Show Profile  Visit Webbo's Homepage  Reply with Quote
(For information)
As well as the Android O/S the duplicate posts issue is also being caused when people use Google Chrome as their browser

I've managed to recreate the issue with Google Chrome - after posting and then being returned back to the thread if you click the 'Click to go back...' arrow (<-) GC trys to resend the post

if you do the same in Internet Explorer it displays post_info.asp thanking you for your contribution



Trying the above out on a php forum GChrome doesn't retain the form field information


It appears that because Snitz uses the post_info.asp as an intermediary page it is that page that browsers are returning to when the 'back' button is clicked and the main browsers show the after post message, whereas Google Chrome attempts to reprocess the form information

Edited by - Webbo on 04 September 2013 16:51:31
Go to Top of Page
Page: of 2 Previous Topic Topic Next Topic  
Next Page
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.18 seconds. Powered By: Snitz Forums 2000 Version 3.4.07