ASP user Online program, this is My Learning ASP write a user online judge program.
Sub Check ()
Dim ip
Call Opensql ()
Ip= "SELECT * from online where ip= '" &request. ServerVariables ("REMOTE_ADDR") & "'"
Set Rs=server. CreateObject ("Adodb.recordset")
Rs.Open ip,sqlcn,1,3
' Response.Write (DateDiff ("s", Now (), RS ("Logintime"))
' Response.End
If Rs.eof Then
Response. Redirect (".. /afterfile/login.asp ")
ElseIf DateDiff ("M", RS ("Logintime"), Now ()) >20 Then
Rs.delete
Rs.update
Response.Write (' Sorry, you've had 20 minutes of nothing to do with NN the security server for the website has disconnected from you nn please login again! '); Location= '. /afterfile/login.asp ';</script> ')
Else
Session ("name") =rs ("username")
Session ("User_type") =rs ("Userdj")
RS ("Logintime") =now ()
Rs.update
Sql= "INSERT into Syslogo (Username,user_logintime, USER_DJ,USER_PAGE,USER_IP) VALUES ('" &session ("name") & ", ' "&now () &" ', ' "&session (" User_type ") &" ', ' "&request. ServerVariables ("URL") & "', '" &request. ServerVariables ("Remote_host") & "')"
Sqlcn.execute (SQL)
End If
End Sub
This site original transfer please specify www.111cn.net/asp/asp.html