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: MOD Implementation
 Active users record reset
 New Topic  Topic Locked
 Printer Friendly
Previous Page
Author Previous Topic Topic Next Topic
Page: of 2

laser
Advanced Member

Australia
3859 Posts

Posted - 21 July 2002 :  16:47:32  Show Profile
The above code doesn't work ... I just saw my server being reset, now we have 2 users on and AU count is still 0.

http://www.v8central.com/snitz/ if you're interested. If I can find a fix I'll let you know

Edit : I don't have a C_VARIABLE of 'intAURecord'



Edited by - laser on 21 July 2002 17:00:15
Go to Top of Page

laser
Advanced Member

Australia
3859 Posts

Posted - 21 July 2002 :  17:35:13  Show Profile
This will be my first code hack in Snitz, so I'm treading very lightly (& I can't afford to crash my forums )

Can someone clean/correct/verfiy my code ? .. I haven't implemented this yet ... red code should be replaced by green code

quote:

Ok, try replacing the function for this one to see if it helps:


function chkAURecord(intTotalActiveUsers)
Dim rsRec, strRecSql, tempRec

if intTotalActiveUsers > intAURecord then 'We have a new record!!! :)

'test this against the database:

strRecSql = "SELECT C_VALUE FROM " & strTablePrefix & "CONFIG_NEW WHERE C_VARIABLE='intAURecord'"

Set rsRec = Server.CreateObject("ADODB.Recordset")

rsRec.Open strRecSql, my_conn

if rsRec.EOF or rsRec.BOF then 'Exit if you cannot read the current value
rsRec.Close
Set rsRec = nothing
Exit Function
'Create the record for intAURecord ... do we need strAURecordDate as well ?
strRecSql = "INSERT INTO " & strTablePrefix & "CONFIG_NEW (C_VARIABLE, C_VALUE) VALUES ('intAURecord', intAURecord)"
Set rsRec = Server.CreateObject("ADODB.Recordset")
rsRec.Open strRecSql, my_conn

End if

'now test the value from the DB:

tempRec = Cint(rsRec("C_VALUE"))

if intTotalActiveUsers > tempRec Then
strDummy = SetConfigValue(1, "intAURecord", cstr(intTotalActiveUsers))
strDummy = SetConfigValue(1, "strAURecordDate", DateToStr(strForumTimeAdjust))
intAURecord = intTotalActiveUsers
strAURecordDate = DateToStr(strForumTimeAdjust)
Application(strCookieURL & "INTAURECORD") = intTotalActiveUsers
Application(strCookieURL & "STRAURECORDDATE") = DateToStr(strForumTimeAdjust)
end if

rsRec.Close
set rsRec = nothing
end if
end function






Edited by - laser on 21 July 2002 17:37:31
Go to Top of Page

laser
Advanced Member

Australia
3859 Posts

Posted - 21 July 2002 :  17:43:06  Show Profile
For all those who have implemented the above, you might want to do the following to your code if you're having the same problems as me (this is currently in place on my forums so I can still get an AU count

function chkAURecord(intTotalActiveUsers)
Dim rsRec, strRecSql, tempRec

if intTotalActiveUsers > intAURecord then 'We have a new record!!! :)
intAURecord = intTotalActiveUsers
strAURecordDate = DateToStr(strForumTimeAdjust)
Application(strCookieURL & "INTAURECORD") = intTotalActiveUsers
Application(strCookieURL & "STRAURECORDDATE") = DateToStr(strForumTimeAdjust)
Exit Function

'test this against the database:

strRecSql = "SELECT C_VALUE FROM " & strTablePrefix & "CONFIG_NEW WHERE C_VARIABLE='intAURecord'"

Set rsRec = Server.CreateObject("ADODB.Recordset")

rsRec.Open strRecSql, my_conn

if rsRec.EOF or rsRec.BOF then 'Exit if you cannot read the current value
rsRec.Close
Set rsRec = nothing
Exit Function
End if

'now test the value from the DB:

tempRec = Cint(rsRec("C_VALUE"))

if intTotalActiveUsers > tempRec Then
strDummy = SetConfigValue(1, "intAURecord", cstr(intTotalActiveUsers))
strDummy = SetConfigValue(1, "strAURecordDate", DateToStr(strForumTimeAdjust))
intAURecord = intTotalActiveUsers
strAURecordDate = DateToStr(strForumTimeAdjust)
Application(strCookieURL & "INTAURECORD") = intTotalActiveUsers
Application(strCookieURL & "STRAURECORDDATE") = DateToStr(strForumTimeAdjust)
end if

rsRec.Close
set rsRec = nothing
end if
end function


Hope it helps

Edit : correcting the colours


Edited by - laser on 21 July 2002 17:43:42
Go to Top of Page

ruirib
Snitz Forums Admin

Portugal
26364 Posts

Posted - 21 July 2002 :  17:56:07  Show Profile  Send ruirib a Yahoo! Message
I don't see how that code will prevent the record being reset, which was the first problem, and the reason for the code being changed. It even looks like that was what was being done in the first place, so I really fail to see your point here.

I can understand the first change, but the second will put you where you started, as far as I can see.

-------------------------------------------------
Installation Guide | Do's and Dont's | MODs
Go to Top of Page

laser
Advanced Member

Australia
3859 Posts

Posted - 21 July 2002 :  18:19:06  Show Profile
quote:

I can understand the first change, but the second will put you where you started, as far as I can see.


Oh definitely !! .. as I said, with the code fix that was posted at the beginning of this thread then your AU count will always be 0, even when you have users on the forums. The reason for this (in my instance) is that the code never gets to set the Application variable, because the record doesn't exist in the table.

I'm a newbie to changing Snitz code though, so if my red/green alterations are ok I'll try them - do you thnk that will solve the problem ?

Go to Top of Page

ruirib
Snitz Forums Admin

Portugal
26364 Posts

Posted - 21 July 2002 :  19:04:59  Show Profile  Send ruirib a Yahoo! Message
Well, if you have a value at the table, that code should work, as far as I can tell. Your fix, writing the value to the database when EOF or BOF is found should really not be needed if you execute this code when that happens:


strDummy = SetConfigValue(1, "intAURecord", cstr(intTotalActiveUsers))
strDummy = SetConfigValue(1, "strAURecordDate", DateToStr(strForumTimeAdjust))
intAURecord = intTotalActiveUsers
strAURecordDate = DateToStr(strForumTimeAdjust)
Application(strCookieURL & "INTAURECORD") = intTotalActiveUsers
Application(strCookieURL & "STRAURECORDDATE") = DateToStr(strForumTimeAdjust)


That function, SetConfigValue, writes the value to the database, so no need to write it directly. And when there is no value in the database, you should also change the app vars values, which this code does.

Hope this is clear.

-------------------------------------------------
Installation Guide | Do's and Dont's | MODs
Go to Top of Page

ruirib
Snitz Forums Admin

Portugal
26364 Posts

Posted - 21 July 2002 :  19:56:00  Show Profile  Send ruirib a Yahoo! Message
Just to make it clear, this is how it should look:


function chkAURecord(intTotalActiveUsers)
Dim rsRec, strRecSql, tempRec

if intTotalActiveUsers > intAURecord then 'We have a new record!!! :)

'test this against the database:

strRecSql = "SELECT C_VALUE FROM " & strTablePrefix & "CONFIG_NEW WHERE C_VARIABLE='intAURecord'"

Set rsRec = Server.CreateObject("ADODB.Recordset")

rsRec.Open strRecSql, my_conn

if rsRec.EOF or rsRec.BOF then 'Exit if you cannot read the current value
rsRec.Close
Set rsRec = nothing

strDummy = SetConfigValue(1, "intAURecord", cstr(intTotalActiveUsers))
strDummy = SetConfigValue(1, "strAURecordDate", DateToStr(strForumTimeAdjust))
intAURecord = intTotalActiveUsers
strAURecordDate = DateToStr(strForumTimeAdjust)
Application(strCookieURL & "INTAURECORD") = intTotalActiveUsers
Application(strCookieURL & "STRAURECORDDATE") = DateToStr(strForumTimeAdjust)

End if

'now test the value from the DB:

tempRec = Cint(rsRec("C_VALUE"))

if intTotalActiveUsers > tempRec Then
strDummy = SetConfigValue(1, "intAURecord", cstr(intTotalActiveUsers))
strDummy = SetConfigValue(1, "strAURecordDate", DateToStr(strForumTimeAdjust))
intAURecord = intTotalActiveUsers
strAURecordDate = DateToStr(strForumTimeAdjust)
Application(strCookieURL & "INTAURECORD") = intTotalActiveUsers
Application(strCookieURL & "STRAURECORDDATE") = DateToStr(strForumTimeAdjust)
end if

rsRec.Close
set rsRec = nothing
end if
end function



-------------------------------------------------
Installation Guide | Do's and Dont's | MODs
Go to Top of Page

laser
Advanced Member

Australia
3859 Posts

Posted - 22 July 2002 :  05:17:50  Show Profile
Does that code really work ?? ... in the EOF/BOF condition you close rsRec before writing to the db ? ... and where can I find the code for SetConfigValue ? - I did a quick search, but couldn't find it.

Go to Top of Page

ruirib
Snitz Forums Admin

Portugal
26364 Posts

Posted - 22 July 2002 :  06:50:40  Show Profile  Send ruirib a Yahoo! Message
quote:

Does that code really work ?? ... in the EOF/BOF condition you close rsRec before writing to the db ? ... and where can I find the code for SetConfigValue ? - I did a quick search, but couldn't find it.


Well it should work. rsRec is just a local var, SetConfigValue will use its own variables to do the DB writing.

As wrote elsewhere, SetConfigValue is located in inc_functions.asp.

-------------------------------------------------
Installation Guide | Do's and Dont's | MODs
Go to Top of Page

laser
Advanced Member

Australia
3859 Posts

Posted - 22 July 2002 :  07:35:15  Show Profile
quote:

As wrote elsewhere, SetConfigValue is located in inc_functions.asp.



Fair enough, it wasn't in mine, but it is now ... .I found it in the 3.3.05 version of inc_functions. All seems well now, I just have to wait for another server reboot.

Go to Top of Page
Page: of 2 Previous Topic Topic Next Topic  
Previous 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.34 seconds. Powered By: Snitz Forums 2000 Version 3.4.07