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
 Viewing
 New Topic  Topic Locked
 Printer Friendly
Previous Page
Author Previous Topic Topic Next Topic
Page: of 2

kolucoms6
Average Member

845 Posts

Posted - 03 June 2007 :  12:14:01  Show Profile

U will find the example at

http://forums.aspfree.com
Go to Top of Page

muzishun
Senior Member

United States
1079 Posts

Posted - 03 June 2007 :  23:19:21  Show Profile  Visit muzishun's Homepage
I suppose it could. It would probably require either another db hit per user or another field storing the forum ID of where a user was (in addition to which topic). The latter would probably be more efficient. Give me a little while, and I'll see if I can write up another add-on to do this.

Bill Parrott
Senior Web Programmer, University of Kansas
Co-Owner and Code Monkey, Eternal Second Designs (www.eternalsecond.com)
Personal Website (www.chimericdream.com)
Go to Top of Page

muzishun
Senior Member

United States
1079 Posts

Posted - 04 June 2007 :  00:18:47  Show Profile  Visit muzishun's Homepage
Ok. I've got that working now. As before, this is tested on MySQL/3.4.06/Active Users 4.0 MOD. I can't guarantee that other configurations will work, but I'll assume they will.

First things first, you need to add a field to the database. Go to the alternative MOD setup (you can only do this as the superadmin) and run the following:

[ALTER]
ACTIVE_USERS
ADD#AU_FORUM_ID#varchar(10)#NULL#
[END]


Next, in inc_func_common.asp, replace the current ActiveUserTracker() sub with this one:

Sub ActiveUserTracker()
'Ls3k- Declaire and assign variables.
Dim strUserIP, strScriptName, strQueryString, strUserAgent, strCurrentTime, strTimedOut

strUserIP = Request.ServerVariables("REMOTE_ADDR")
strScriptName = Mid(Request.ServerVariables("SCRIPT_NAME"), InstrRev(Request.ServerVariables("SCRIPT_NAME"), "/")+1)
strQueryString = Request.ServerVariables("QUERY_STRING")
strUserAgent = Request.ServerVariables("HTTP_USER_AGENT")
strCurrentTime = DateToStr(strForumTimeAdjust)
intAUForumID = Request.QueryString("FORUM_ID")

intAUTopicID = Request.QueryString("TOPIC_ID")
If intAUTopicID <> "" Then
strSQL2 = "SELECT FORUM_ID FROM " & strTablePrefix & "FORUM WHERE TOPIC_ID = " & CInt(intAUTopicID) & ";"
Set rs1 = my_conn.execute (strSQL2)

If rs1.EOF or rs1.BOF Then
'Do Nothing
Else
intAUForumID = rs1("FORUM_ID")
End If

rs1.Close
Set rs1 = Nothing
End If

'Ls3k- First Order of business, is this person new?
if MemberID="-1" then 'If this is a Guest, check by IP
strSql = "SELECT AU_LASTACTIVETIME FROM " & strTablePrefix & "ACTIVE_USERS WHERE AU_IP = '" & Chkstring(strUserIP, "SQLString") & "' AND MEMBER_ID = -1"
else 'If this is a Member, check by Member_ID
strSql = "SELECT AU_LASTACTIVETIME FROM " & strTablePrefix & "ACTIVE_USERS WHERE MEMBER_ID = " & MemberID
end if

set rs = my_conn.execute (strSql)

if rs.EOF or rs.BOF then
strNewUser = 1
else
strNewUser = 0
strAUTimedOut = DateToStr(DateAdd("n",-strAUTimeout,strForumTimeAdjust))

if rs("AU_LASTACTIVETIME") < strAUTimedOut then 'Check to see if user has timed out since last active.
strSql = "DELETE FROM " & strTablePrefix & "ACTIVE_USERS WHERE (MEMBER_ID = " & MemberID & " AND MEMBER_ID <> -1) OR (AU_IP = '" & Chkstring(strUserIP, "SQLString") & "' AND MEMBER_ID = -1)"
my_conn.execute (strSql)
strNewUser = 1
end if
end if

rs.close
set rs = Nothing

'Ls3k- Second order of business, lets update those already-active users
if strNewUser = 0 then 'If already-active
strSql = "UPDATE " & strTablePrefix & "ACTIVE_USERS SET " & _
"AU_LASTACTIVETIME='" & Chkstring(strCurrentTime, "SQLString") & "'" & _
", AU_LASTPAGE='" & Chkstring(strScriptName, "SQLString") & "'" & _
", AU_QUERYSTRING='" & Chkstring(strQueryString, "SQLString") & "' " & _
", AU_FORUM_ID='" & Chkstring(intAUForumID, "SQLString") & "' "
if MemberID=-1 then 'If guest, update based on IP
strSql = strSql & "WHERE AU_IP = '" & Chkstring(strUserIP, "SQLString") & "' " & _
"AND MEMBER_ID = " & MemberID
else 'Update members based on MemberID
strSql = strSql & "WHERE MEMBER_ID = " & MemberID
end if

my_conn.execute (strSql)
else 'Is a new user, make new record
if strLoginStatus = 0 then
strSql = "INSERT INTO " & strTablePrefix & "ACTIVE_USERS (" & _
"MEMBER_ID, AU_IP, AU_LOGINTIME, AU_LASTACTIVETIME, " & _
"AU_LASTPAGE, AU_QUERYSTRING, AU_USER_AGENT, AU_FORUM_ID) VALUES(" & _
MemberID & ", " & _
"'" & Chkstring(strUserIP, "SQLString") & "', " & _
"'" & Chkstring(strCurrentTime, "SQLString") & "', " & _
"'" & Chkstring(strCurrentTime, "SQLString") & "', " & _
"'" & Chkstring(strScriptName, "SQLString") & "', " & _
"'" & Chkstring(strQueryString, "SQLString") & "', " & _
"'" & Chkstring(strUserAgent, "SQLString") & "', " & _
"'" & Chkstring(intAUForumID, "SQLString") & "')"
my_conn.execute (strSql)
end if
end if
end sub


Last, in default.asp, around lines 505-518 add the code in red:

if ForumFType = 1 then
Response.Write " colspan=""4"""
end if
strSql2 = "SELECT COUNT(AU_IP) AS CNT FROM " & strTablePrefix & "ACTIVE_USERS WHERE AU_FORUM_ID = " & ForumID & ";"
set rs2 = my_conn.execute (strSql2)
intTotalActiveUsers = rs2("CNT")
rs2.close
set rs2 = nothing

Response.Write " bgcolor=""" & strForumCellColor & """ valign=""top"">" & _
"<font face=""" & strDefaultFontFace & """ color=""" & strForumFontColor & """ size=""" & strDefaultFontSize & """><span class=""spnMessageText""><a href="""
if ForumFType = 0 then
Response.Write "forum.asp?FORUM_ID=" & ForumID
else
Response.Write ForumURL & """ target=""_blank"
end if
Response.Write """>" & chkString(ForumSubject,"display") & "</a> (" & intTotalActiveUsers & " Viewing)<br />" & _
"<font size=""" & strFooterFontSize & """>" & _
formatStr(ForumDescription) & _
"</font></span></font></td>" & vbNewline

Bill Parrott
Senior Web Programmer, University of Kansas
Co-Owner and Code Monkey, Eternal Second Designs (www.eternalsecond.com)
Personal Website (www.chimericdream.com)
Go to Top of Page

kolucoms6
Average Member

845 Posts

Posted - 04 June 2007 :  17:45:19  Show Profile
Error I got :

Microsoft JET Database Engine error '80040e10'

No value given for one or more required parameters.

/forum/inc_func_common.asp, line 106
Go to Top of Page

kolucoms6
Average Member

845 Posts

Posted - 04 June 2007 :  18:01:56  Show Profile
Error :
**************************

Line 106:

my_conn.execute (strSql)


UPDATE FORUM_ACTIVE_USERS SET AU_LASTACTIVETIME='20070605015257', AU_LASTPAGE='default.asp', AU_QUERYSTRING=' ' , AU_FORUM_ID=' ' WHERE MEMBER_ID = 1


Here is the forum:

http://www.ulcindia.com/forum

Edited by - kolucoms6 on 04 June 2007 18:03:20
Go to Top of Page

muzishun
Senior Member

United States
1079 Posts

Posted - 05 June 2007 :  18:43:02  Show Profile  Visit muzishun's Homepage
Hmmm... could you post link to a text copy of your default.asp and inc_func_common.asp pages? It sounds like the db field either didn't get created correctly, or there's something wrong with the function. If possible, I'd also like to see what your old inc_func_common.asp looked like, in case there were any changes to yours that I didn't have in mine.

Bill Parrott
Senior Web Programmer, University of Kansas
Co-Owner and Code Monkey, Eternal Second Designs (www.eternalsecond.com)
Personal Website (www.chimericdream.com)
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.76 seconds. Powered By: Snitz Forums 2000 Version 3.4.07