ASP to prevent simultaneous landing problems

Source: Internet
Author: User
There are two ways to implement this functionality:

1. Application
Using the Application object: If you are doing a large community, you may want to generate a appliaction for each login ID, which is not recommended here, although the program is simpler to design but has too many landing users and consumes server resources. Because the Appliaction object is easy to generate when the user logs on, but to be truly released as the user exits the system, there is no better way to go.

<%
..... Take user name username .....
If Application (username) <> "" Then
Response.Write "This user is logged in"
Response.End
End If
Application (username) =username ' "" in the user name
%>

Add the session OnEnd event to the global file, application ("Isuserlogin") when offline =false
In addition, to detect whether puppet, there is a special way, is a server object in the

(Ginseng: http://community.111cn.net/Expert/FAQ/FAQ_Index.asp?id=815)

2. Database +asp
It may be more complicated to do, but it is suitable for systems with a large number of landing users.

First create a database for users-create a new onlytol8.mdb with access

Data table 1:users Store user registration data
Under Data table: UID (AutoNumber) userName (character type) Userpass (character type)

Data Table 2:onlylogin Store user temporary login information
Under Data table: Olname (character) oltime (date type) olip (character type)

After the database has been built, add the data directly to the users table by manually adding the username table Tol8,userpass Add 111,

Below to do user login interface, copy the following code to save as onlylogin.asp file.

<meta http-equiv= "Content-type" content= "text/html; charset=gb2312 ">
<title> prohibit the same account in different areas at the same time login </title>
<body>
<form name= "Form1" method= "Post" action= "loginpost.asp" >
User name: <input name= "UserName" type= "text" id= "UserName" size= "maxlength=" "5" >
Password: <input name= "userpass" type= "password" id= "Userpass" size= "" "Maxlength=" >
<input type= "Submit" name= "Submit" value= "Login" >
</form>
</body>


When you are done, copy the following code in a new loginconn.asp file to save the connection database

<%

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.