How does the ASP judge the user's online program

Source: Internet
Author: User
Tags servervariables

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.