Author |
Topic  |
|
Jeepaholic
Average Member
  
USA
697 Posts |
Posted - 21 February 2004 : 17:42:23
|
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
|
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 |
 |
|
Jeepaholic
Average Member
  
USA
697 Posts |
Posted - 21 February 2004 : 18:20:50
|
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
|
 |
|
ruirib
Snitz Forums Admin
    
Portugal
26364 Posts |
|
Jeepaholic
Average Member
  
USA
697 Posts |
|
ruirib
Snitz Forums Admin
    
Portugal
26364 Posts |
Posted - 22 February 2004 : 05:13:01
|
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 |
 |
|
Jeepaholic
Average Member
  
USA
697 Posts |
Posted - 22 February 2004 : 13:53:59
|
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
|
 |
|
ruirib
Snitz Forums Admin
    
Portugal
26364 Posts |
|
Jeepaholic
Average Member
  
USA
697 Posts |
|
Jeepaholic
Average Member
  
USA
697 Posts |
Posted - 26 February 2004 : 04:32:49
|
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 |
 |
|
ruirib
Snitz Forums Admin
    
Portugal
26364 Posts |
|
Jeepaholic
Average Member
  
USA
697 Posts |
|
ruirib
Snitz Forums Admin
    
Portugal
26364 Posts |
|
Jeepaholic
Average Member
  
USA
697 Posts |
|
|
Topic  |
|