ASP anti-refresh function
Sub Preventrefresh ()
Dim Refreshtime,isrefresh
Refreshtime = 10 ' Prevent refresh time, unit (seconds)
Isrefresh = 1 ' Use anti-refresh function, 0 = no, 1 = yes
If Isrefresh = 1 Then
If (Not IsEmpty ("Refreshtime")) and Refreshtime > 0 Then
If DateDiff ("s", Session ("Refreshtime"), now ()) < Refreshtime Then
Response.Write "<meta Http-equiv=content-type content=text/html; Charset=gb2312><meta http-equiv=refresh content= "&RefreshTime&" ><br> this page has the anti-refresh mechanism enabled, please do not &RefreshTime& "In seconds to refresh this page continuously <BR> is opening the page, please later ..."
Response.End
Else
Session ("refreshtime") = Now ()
End If
Else
Session ("refreshtime") = Now ()
End If
End If
End Sub
Public Sub Getusertodayinfo ()
Dim Lastlogin,userdayinfo
Lastlogin = Request.Cookies ("newasp_net") ("Lasttime")
Userdayinfo = Request.Cookies ("newasp_net") ("Usertoday")
If not IsDate (lastlogin) Then lastlogin = Now ()
On Error Resume Next
If DateDiff ("D", Lastlogin,now ()) <>0 Then
Newasp.execute ("UPDATE [Nc_user] SET usertoday= ' 0,0,0,0,0,0 ', lasttime=" & nowstring & "WHERE username= '" & Newasp.membername & "' and Userid=" & Newasp.memberid)
Userdayinfo = "0,0,0,0,0,0"
Response.Cookies ("Newasp_net") ("usertoday") = Userdayinfo
Response.Cookies ("Newasp_net") ("lasttime") = Now ()
End If
Usertoday = Split (Userdayinfo, ",")
If Ubound (usertoday) <> 5 Then
Newasp.execute ("UPDATE [Nc_user] SET usertoday= ' 0,0,0,0,0,0 ', lasttime=" & nowstring & "WHERE username= '" & Newasp.membername & "' and Userid=" & Newasp.memberid)
Userdayinfo = "0,0,0,0,0,0"
Response.Cookies ("Newasp_net") ("usertoday") = Userdayinfo
Response.Cookies ("Newasp_net") ("lasttime") = Now ()
Usertoday = Split (Userdayinfo, ",")
End If
End Sub
Public Function updateusertoday (ByVal str)
On Error Resume Next
If Trim (str) <> "" Then
Newasp.execute ("UPDATE [Nc_user] SET usertoday= '" & str & ' WHERE username= ' "& Newasp.membername &" ' and Userid= "& Newasp.memberid)
Response.Cookies ("Newasp_net") ("usertoday") = str
End If
End Function