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)
 Single MemberDB, Multiple Sites, Last Visit Issue
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

Jeepaholic
Average Member

USA
697 Posts

Posted - 21 February 2004 :  17:42:23  Show Profile  Visit Jeepaholic's Homepage
Ok...finally migrated my forums to a single user database. Ran into a bit of an issue, though...and am looking for a solution.

It appears that if a member visits ANY of the sites, their LastVisited is marked across ALL sites. I know there's a field for this within the MEMBERS table (which is now universal across all my forusm). But, I was under the impression that cookies were involved in this as well and each site would maintain it's own LastVisited status for each user.

So, since this is not the case...is there a simple way of making this possible? It's unfortunate to visit one site, then go to the next and have your last visit date be 5 minutes earlier...missing out on all the active topics as well as any pink folders!

Please advise...

Al Bsharah
Aholics.com

Jeepaholics Anonymous
Broncoholics Anonymous
Network Insight

ruirib
Snitz Forums Admin

Portugal
26364 Posts

Posted - 21 February 2004 :  17:53:14  Show Profile  Send ruirib a Yahoo! Message
I don't think you can do it without code changes: you probably needed to add some fields to the database and then change the two functions that deal with this: ReadLastHereDate and UpdateLastHereDate, in inc_func_common.asp.


Snitz 3.4 Readme | Like the support? Support Snitz too

Edited by - ruirib on 21 February 2004 17:53:52
Go to Top of Page

Jeepaholic
Average Member

USA
697 Posts

Posted - 21 February 2004 :  18:20:50  Show Profile  Visit Jeepaholic's Homepage
Hmmm... What do you think about this?

* Change doCookies to add a new field (LastHereDate, equal to current time) to the cookie, AFTER the Session Variable for LastHereDate is set.

* Change ReadLastHereDate to look at the user cookie FIRST for the date. If it doesn't exist, THEN look into the database. This function currently ends by calling UpdateLastHereDate.

* Change UpdateLastHereDate to update the new cookie and database simultaneously.

Would this work? Am I missing anything?

What about existing cookies being modified with new fields? Can this be done, or will it corrupt user cookies for those who haven't logged out yet?

Other thoughts?
AL

Al Bsharah
Aholics.com

Jeepaholics Anonymous
Broncoholics Anonymous
Network Insight
Go to Top of Page

ruirib
Snitz Forums Admin

Portugal
26364 Posts

Posted - 21 February 2004 :  20:07:26  Show Profile  Send ruirib a Yahoo! Message
Seems like it should work.


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

Jeepaholic
Average Member

USA
697 Posts

Posted - 21 February 2004 :  21:37:04  Show Profile  Visit Jeepaholic's Homepage
Any idea about the cookies? I'm curious about re-writing new fields into them when they're still active. I don't want to start corrupting everyone's...

Al Bsharah
Aholics.com

Jeepaholics Anonymous
Broncoholics Anonymous
Network Insight
Go to Top of Page

ruirib
Snitz Forums Admin

Portugal
26364 Posts

Posted - 22 February 2004 :  05:13:01  Show Profile  Send ruirib a Yahoo! Message
I don't think it will have any adverse effect. I even did a small test locally and it did not affect the existing values in the cookie.

Anyway, if you want to be on the safe side, you can always test it in a "localhost". But I'm sure it is ok to do it.


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

Jeepaholic
Average Member

USA
697 Posts

Posted - 22 February 2004 :  13:53:59  Show Profile  Visit Jeepaholic's Homepage
Yeah, I'll end up using a test site with other URL's so as not to screw up existing cookies... I did just find some similar texts around the 'net saying it shouldn't hurt to add a cookie field. Thanks for the info, will try it later this week. Thanks!

Al Bsharah
Aholics.com

Jeepaholics Anonymous
Broncoholics Anonymous
Network Insight
Go to Top of Page

ruirib
Snitz Forums Admin

Portugal
26364 Posts

Posted - 22 February 2004 :  23:00:57  Show Profile  Send ruirib a Yahoo! Message
You're welcome. Please post back with the results, I'm sure this can be of use to others as well.


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

Jeepaholic
Average Member

USA
697 Posts

Posted - 23 February 2004 :  20:44:09  Show Profile  Visit Jeepaholic's Homepage
<nod> Of course!

Al Bsharah
Aholics.com

Jeepaholics Anonymous
Broncoholics Anonymous
Network Insight
Go to Top of Page

Jeepaholic
Average Member

USA
697 Posts

Posted - 26 February 2004 :  04:32:49  Show Profile  Visit Jeepaholic's Homepage
Ok, here are my modified functions. This appears to have done the trick! It will check the cookie version of LastHereDate first...if it doesn't exist, it will then look to the database. This assures that each site (using a single FORUM_MEMBERS table) will be able to maintain a LastHereDate of it's own. Code is below, I'll post it over in the MOD's section after a few eyes look at it and I get some more test time in:

inc_func_common.asp

function ReadLastHereDate(UserName)
	dim rs_date
	dim strSql
	if trim(UserName) = "" then 
		ReadLastHereDate = DateToStr(DateAdd("d", -10, strForumTimeAdjust))
		exit function
	end if

	if Request.Cookies(strUniqueID & "LHD")("LastHereDate") <> "" then
		ReadLastHereDate = DateToStr(Request.Cookies(strUniqueID & "LHD")("LastHereDate")) 
	else

		'## Forum_SQL
		strSql = "SELECT M_LASTHEREDATE "
		strSql = strSql & " FROM " & strMemberTablePrefix & "MEMBERS "
		strSql = strSql & " WHERE " & strDBNTSQLName & " = '" & ChkString(UserName, "SQLString") & "' "
		Set rs_date = Server.CreateObject("ADODB.Recordset")
		rs_date.open strSql, my_Conn
		if (rs_date.BOF and rs_date.EOF) then
			ReadLastHereDate = DateToStr(DateAdd("d",-10,strForumTimeAdjust))
		else
			if rs_date("M_LASTHEREDATE") = "" or IsNull(rs_date("M_LASTHEREDATE")) then
				ReadLastHereDate = DateToStr(DateAdd("d",-10,strForumTimeAdjust))
			else
				ReadLastHereDate = rs_date("M_LASTHEREDATE")
			end if
		end if
		rs_date.close
		set rs_date = nothing
	end if

	UpdateLastHereDate DateToStr(strForumTimeAdjust),UserName
end function


function UpdateLastHereDate(fTime,UserName)
	'## Forum_SQL - Do DB Update
	strSql = "UPDATE " & strMemberTablePrefix & "MEMBERS "
	strSql = strSql & " SET M_LASTHEREDATE = '" & fTime & "'"
	strSql = strSql & ",    M_LAST_IP = '" & Request.ServerVariables("REMOTE_ADDR") & "'"
	strSql = strSql & " WHERE " & strDBNTSQLName & " = '" & ChkString(UserName, "SQLString") & "' "
	my_conn.Execute (strSql),,adCmdText + adExecuteNoRecords       
	Response.Cookies(strUniqueID & "LHD").Expires = dateAdd("d", intCookieDuration, strForumTimeAdjust)
	Response.Cookies(strUniqueID & "LHD")("LastHereDate") = fTime

end function



'##############################################
'##        Cookie functions and Subs         ##
'##############################################

sub doCookies(fSavePassWord)
	if strSetCookieToForum = 1 then
		Response.Cookies(strUniqueID & "User").Path = strCookieURL
		Response.Cookies(strUniqueID & "LHD").Path = strCookieURL
	else
		Response.Cookies(strUniqueID & "User").Path = "/"        
		Response.Cookies(strUniqueID & "LHD").Path = "/"		
	end if
	Response.Cookies(strUniqueID & "User")("Name") = strDBNTFUserName
	Response.Cookies(strUniqueID & "User")("Pword") = strEncodedPassword
	'Response.Cookies(strUniqueID & "User")("Cookies") = Request.Form("Cookies")
	if fSavePassWord = "true" then
		Response.Cookies(strUniqueID & "User").Expires = dateAdd("d", intCookieDuration, strForumTimeAdjust)
		Response.Cookies(strUniqueID & "LHD").Expires = dateAdd("d", intCookieDuration, strForumTimeAdjust)		
	end if
	Session(strCookieURL & "last_here_date") = ReadLastHereDate(strDBNTFUserName)
	Response.Cookies(strUniqueID & "LHD")("LastHereDate") = Session(strCookieURL & "last_here_date")
end sub


sub ClearCookies()
	if strSetCookieToForum = 1 then
		Response.Cookies(strUniqueID & "User").Path = strCookieURL 
		Response.Cookies(strUniqueID & "LHD").Path = strCookieURL
	else
		Response.Cookies(strUniqueID & "User").Path = "/"        
		Response.Cookies(strUniqueID & "LHD").Path = "/"
	end if
	Response.Cookies(strUniqueID & "User") = ""
	Response.Cookies(strUniqueID & "LHD") = ""	
	Session(strCookieURL & "Approval") = ""
	Session.Abandon
	'Response.Cookies(strUniqueID & "User").Expires = dateadd("d", -2, strForumTimeAdjust)
end sub

Al Bsharah
Aholics.com

Jeepaholics Anonymous
Broncoholics Anonymous
Network Insight

Edited by - Jeepaholic on 26 February 2004 04:35:31
Go to Top of Page

ruirib
Snitz Forums Admin

Portugal
26364 Posts

Posted - 26 February 2004 :  06:39:35  Show Profile  Send ruirib a Yahoo! Message
Thanks for posting them!


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

Jeepaholic
Average Member

USA
697 Posts

Posted - 26 February 2004 :  13:58:33  Show Profile  Visit Jeepaholic's Homepage
NP. I posted the MOD here:
http://forum.snitz.com/forum/topic.asp?TOPIC_ID=51583

Al Bsharah
Aholics.com

Jeepaholics Anonymous
Broncoholics Anonymous
Network Insight
Go to Top of Page

ruirib
Snitz Forums Admin

Portugal
26364 Posts

Posted - 26 February 2004 :  18:19:04  Show Profile  Send ruirib a Yahoo! Message
Hmmm... I like the mod's name .


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

Jeepaholic
Average Member

USA
697 Posts

Posted - 29 February 2004 :  11:58:35  Show Profile  Visit Jeepaholic's Homepage
<chuckle>

Al Bsharah
Aholics.com

Jeepaholics Anonymous
Broncoholics Anonymous
Network Insight
Go to Top of Page
  Previous Topic Topic Next Topic  
 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.59 seconds. Powered By: Snitz Forums 2000 Version 3.4.07