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

 All Forums
 Help Groups for Snitz Forums 2000 Users
 Help: General / Classic ASP versions(v3.4.XX)
 Bug on inc_func_count.asp file
 New Topic  Topic Locked
 Printer Friendly
Next Page
Author Previous Topic Topic Next Topic
Page: of 2

davide.lorenzi
Starting Member

12 Posts

Posted - 18 April 2007 :  04:44:25  Show Profile  Visit davide.lorenzi's Homepage
I'm referring to functions doUCount() and doULastPost().
I checked these functions because I discovered that my forum never updated the topic count for a certain user.
Debugging the function I see the VarType(sUser) is equal to 5 so the function makes an update on the DB using the "strSql" variable already called on a previous function because it cannot find a good condition!

The original code from version 3.4.06:


quote:

sub doUCount(sUser)
if VarType(sUser) = 8 then 'Update using member username
'## Forum_SQL - Update Total Post for user
strSql = "UPDATE " & strMemberTablePrefix & "MEMBERS "
strSql = strSql & " SET M_POSTS = M_POSTS + 1 "
strSql = strSql & " WHERE " & strDBNTSQLName & " = '" & ChkString(sUser, "SQLString") & "'"

elseif VarType(sUser) = 2 or VarType(sUser) = 3 then 'Update count using member id
'## Forum_SQL - Update Total Post for user
strSql = "UPDATE " & strMemberTablePrefix & "MEMBERS "
strSql = strSql & " SET M_POSTS = M_POSTS + 1 "
strSql = strSql & " WHERE MEMBER_ID = " & sUser

end if
my_Conn.Execute (strSql),,adCmdText + adExecuteNoRecords
end sub

sub doULastPost(sUser)
if VarType(sUser) = 8 then 'Update using member user name
'## Forum_SQL - Updates the M_LASTPOSTDATE in the FORUM_MEMBERS table
strSql = "UPDATE " & strMemberTablePrefix & "MEMBERS "
strSql = strSql & " SET M_LASTPOSTDATE = '" & DateToStr(strForumTimeAdjust) & "' "
strSql = strSql & " WHERE " & strDBNTSQLName & " = '" & ChkString(sUser, "SQLString") & "'"

elseif VarType(sUser) = 2 or VarType(sUser) = 3 then 'Update using member id
'## Forum_SQL - Updates the M_LASTPOSTDATE in the FORUM_MEMBERS table
strSql = "UPDATE " & strMemberTablePrefix & "MEMBERS "
strSql = strSql & " SET M_LASTPOSTDATE = '" & DateToStr(strForumTimeAdjust) & "' "
strSql = strSql & " WHERE MEMBER_ID = " & sUser

end if
my_Conn.Execute (strSql),,adCmdText + adExecuteNoRecords
end sub


The modified code should contain an "else" without "elseif" or the call Execute should be moved into the two conditional statements:

quote:

sub doUCount(sUser)
if VarType(sUser) = 8 then 'Update using member username
'## Forum_SQL - Update Total Post for user
strSql = "UPDATE " & strMemberTablePrefix & "MEMBERS "
strSql = strSql & " SET M_POSTS = M_POSTS + 1 "
strSql = strSql & " WHERE " & strDBNTSQLName & " = '" & ChkString(sUser, "SQLString") & "'"

else 'Update count using member id
'## Forum_SQL - Update Total Post for user
strSql = "UPDATE " & strMemberTablePrefix & "MEMBERS "
strSql = strSql & " SET M_POSTS = M_POSTS + 1 "
strSql = strSql & " WHERE MEMBER_ID = " & sUser

end if
my_Conn.Execute (strSql),,adCmdText + adExecuteNoRecords
end sub


or (I've added the VarType()=5)

quote:
sub doUCount(sUser)
if VarType(sUser) = 8 then 'Update using member username
'## Forum_SQL - Update Total Post for user
strSql = "UPDATE " & strMemberTablePrefix & "MEMBERS "
strSql = strSql & " SET M_POSTS = M_POSTS + 1 "
strSql = strSql & " WHERE " & strDBNTSQLName & " = '" & ChkString(sUser, "SQLString") & "'"
my_Conn.Execute (strSql),,adCmdText + adExecuteNoRecords

elseif VarType(sUser) = 2 or VarType(sUser) = 3 or VarType(sUser) = 5 then 'Update count using member id
'## Forum_SQL - Update Total Post for user
strSql = "UPDATE " & strMemberTablePrefix & "MEMBERS "
strSql = strSql & " SET M_POSTS = M_POSTS + 1 "
strSql = strSql & " WHERE MEMBER_ID = " & sUser
my_Conn.Execute (strSql),,adCmdText + adExecuteNoRecords

end if
end sub

Shaggy
Support Moderator

Ireland
6780 Posts

Posted - 18 April 2007 :  04:53:44  Show Profile
How is a decimal number getting passed to those functions? The only way this can have happened is due to changes you've made elsewhere in your code - The only things that are ever be passed to that function in a clean install are a username (string) or a member ID (whole number).


Search is your friend
“I was having a mildly paranoid day, mostly due to the
fact that the mad priest lady from over the river had
taken to nailing weasels to my front door again.”
Go to Top of Page

davide.lorenzi
Starting Member

12 Posts

Posted - 18 April 2007 :  06:37:37  Show Profile  Visit davide.lorenzi's Homepage
Yes, I agree with you but I've made no changes.
Only the DB has been maintained from version 3.4.04.

The id is a simple Integer/Long, no decimal but the VarType is 5 :-(
Have you tried to debug those functions?
Go to Top of Page

Shaggy
Support Moderator

Ireland
6780 Posts

Posted - 18 April 2007 :  06:44:26  Show Profile
Strangeness indeed ... Is this happening consistently for all members?

You did run setup.asp on database after upgrading to the latest version, right? What database type and version are you using?


Search is your friend
“I was having a mildly paranoid day, mostly due to the
fact that the mad priest lady from over the river had
taken to nailing weasels to my front door again.”

Edited by - Shaggy on 18 April 2007 06:44:55
Go to Top of Page

pdrg
Support Moderator

United Kingdom
2897 Posts

Posted - 18 April 2007 :  06:54:29  Show Profile  Send pdrg a Yahoo! Message
Could be a nasty caused by the variant datatype (which everything inherently is in VBScript) - it's weak typing, and as all integers are faked anyway, maybe it's a legacy of that.

Would a well-placed cint() bring it back into line - it would fail for the text datatype, so the error could be captured on the following line.

Just a thought
Go to Top of Page

davide.lorenzi
Starting Member

12 Posts

Posted - 18 April 2007 :  07:44:50  Show Profile  Visit davide.lorenzi's Homepage
quote:
You did run setup.asp on database after upgrading to the latest version, right? What database type and version are you using?


Sorry, I didn't run the setup, maybe this is the problem but I cannot run the setup because I added many mods...

quote:
Would a well-placed cint() bring it back into line - it would fail for the text datatype, so the error could be captured on the following line.


Yes, IMO the Cint or better CLng will do the trick ;-)

quote:
Strangeness indeed ... Is this happening consistently for all members?


Yes, this happens with all members

quote:
What database type and version are you using?


I'm using MySql, I've aligned my 3.4.04 version to the latest one by comparing/aligning every file by hands.

In each case IMO the actual implementation of functions doUCount() and doULastPost() is dangerous ;-)
Go to Top of Page

davide.lorenzi
Starting Member

12 Posts

Posted - 18 April 2007 :  07:58:00  Show Profile  Visit davide.lorenzi's Homepage
Just tried to run the setup.asp in a local DB but the problem persists

"Setup has finished without errors..."
Go to Top of Page

Shaggy
Support Moderator

Ireland
6780 Posts

Posted - 18 April 2007 :  08:01:48  Show Profile
quote:
Originally posted by davide.lorenzi
Sorry, I didn't run the setup, maybe this is the problem but I cannot run the setup because I added many mods...
Sounds like that could be your problem, so; you need to run the v3.4.06 setup.asp. It won't effect any of the tables or fields added by your mods, only those that relate to the base install of Snitz.


Search is your friend
“I was having a mildly paranoid day, mostly due to the
fact that the mad priest lady from over the river had
taken to nailing weasels to my front door again.”
Go to Top of Page

davide.lorenzi
Starting Member

12 Posts

Posted - 18 April 2007 :  08:03:46  Show Profile  Visit davide.lorenzi's Homepage
Good! I'll execute the setup.asp immediately in my online DB but the problem persists ;-)
I'll use the modified version of the inc_func_count.asp.

Thank you for your advice!
Go to Top of Page

Hermes
Junior Member

Croatia
113 Posts

Posted - 18 April 2007 :  08:16:31  Show Profile

Which MySql do you using?

Check Topic: "Exception occurred" error when updating counts

in Myasql Databese forum problem.


ASP Snitz Forum Upute za instalaciju
http://www.kairos.com.hr http://www.hermetizam.com Forum

not so newbie any more :)
Go to Top of Page

davide.lorenzi
Starting Member

12 Posts

Posted - 18 April 2007 :  08:31:54  Show Profile  Visit davide.lorenzi's Homepage
My hosting provider uses the latest MySql version, this should be version 5.0 I think, at home I'm using version 4.0.
The problem persists in each version.
Thanks!
Go to Top of Page

ruirib
Snitz Forums Admin

Portugal
26364 Posts

Posted - 18 April 2007 :  08:36:41  Show Profile  Send ruirib a Yahoo! Message
Does your user have a single quote or double quotes in his username?


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

davide.lorenzi
Starting Member

12 Posts

Posted - 18 April 2007 :  08:42:17  Show Profile  Visit davide.lorenzi's Homepage
No, the problem occurs for every user
Go to Top of Page

ruirib
Snitz Forums Admin

Portugal
26364 Posts

Posted - 18 April 2007 :  08:46:57  Show Profile  Send ruirib a Yahoo! Message
Are each of the forums configured to increase post count?


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

davide.lorenzi
Starting Member

12 Posts

Posted - 18 April 2007 :  08:49:46  Show Profile  Visit davide.lorenzi's Homepage
Yes ;-)
Go to Top of Page

ruirib
Snitz Forums Admin

Portugal
26364 Posts

Posted - 18 April 2007 :  09:01:00  Show Profile  Send ruirib a Yahoo! Message
Can you do one thing: use a base code, unchanged post_info.asp and see if that sorts the problem. If it does, then you're done, otherwise just post back here.


Snitz 3.4 Readme | Like the support? Support Snitz too
Go to Top of Page
Page: of 2 Previous Topic Topic Next Topic  
Next Page
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.32 seconds. Powered By: Snitz Forums 2000 Version 3.4.07