Ubb This is the recent use of ASP rewrite UBB forum experience, improper place please correct me
Reference to Chinaasp's Web club (a UBB-style forum)
UBB Forum has a very good feature, that will be marked since your last visit since the new posts, mainly in two places
: The discussion area list and a list of posts in a discussion area.
Usually the graphics used are on.gif,off.gif (the discussion area list), Closed.gif,closedb.gif (a discussion area
List of posts, where on.gif,closedb.gif represents the new or modified post since the last visit.
implementation:
By using a combination of session and cookie variables to implement
1. Session variable
Firstin, identifies whether to enter the page for the first time, or to enter the page by refreshing
2. Cookie variable
Simplified here, the cancellation of the original official version of the UBB Sessionlogin/lastlogin two cookies
Use only Sessionlogindt/lastlogindt two cookies
sessionlogindt-Save the last logon time
lastlogindt-save time for this login
principle:
Takes the last logon time for this session time, and the time of the last post in the discussion area or a discussion area
Compare the last time of the topic, choose the appropriate graphic according to the actual situation, such as:
If Rslist.fields ("status") = "Close" Then
' Topic closed
Response.Write "<tr><td bgcolor= #f7f7f7 >Src=http://www.163design.net/a/q/images/lock.gif > <a href=newsdetail.asp?id= "& RsList.Fields
("PostID") & ">" & Rslist.fields ("Subject") & "</a> </td>"
Else
' Lastly post time for the theme
If Rslist.fields ("lastly") >sessionlogindt then
Response.Write "<tr><td bgcolor= #f7f7f7 >Src=http://www.163design.net/a/q/images/closedb.gif> <a href=newsdetail.asp?id= "& RsList.Fields
("PostID") & ">" & Rslist.fields ("Subject") & "</a> </td>"
Else
Response.Write "<tr><td bgcolor= #f7f7f7 >Src=http://www.163design.net/a/q/images/closed.gif > <a href=newsdetail.asp?id= "& RsList.Fields
("PostID") & ">" & Rslist.fields ("Subject") & "</a> </td>"
End If
End If
Pages: Discussion area list (default.asp)
Code fragment:
If IsEmpty (Session ("Firstin")) Then
' first entry or use of cookies is not allowed
' Take the last access time and assign it to Sessionlogindt
If Not IsEmpty (Request.Cookies ("Lastlogindt")) Then
Sessionlogindt=request.cookies ("Lastlogindt")
If not IsDate (Sessionlogindt) Then
Sessionlogindt=formatdatetime (now)
Else
Sessionlogindt=cdate (Sessionlogindt)
End If
Else
Sessionlogindt=formatdatetime (now)
End If
' Write cookies
' Write Sessionlogindt
Response.Cookies ("Sessionlogindt") =sessionlogindt
Response.Cookies ("Sessionlogindt"). expires=date+365
Response.Cookies ("Lastlogindt") =lastlogindt
Response.Cookies ("Lastlogindt"). expires=date+365
Session ("Firstin") = "yes"
Else
' Refresh, while indicating that cookies are allowed
Session ("Firstin") = "No"
' Read time
If Not IsEmpty (Request.Cookies ("Sessionlogindt")) Then
Sessionlogindt=request.cookies ("Sessionlogindt")
' Sessionlogindt is not legal, this problem generally does not exist
If not IsDate (Sessionlogindt) Then
Sessionlogindt=formatdatetime (now)
Else
Sessionlogindt=cdate (Sessionlogindt)
End If
Else
' No Sessionlogindt cookies, this problem does not generally exist
Sessionlogindt=formatdatetime (now)
' Write Sessionlogindt
Response.Cookies ("Sessionlogindt") =sessionlogindt
&nbs