ASP to determine how many users log in, how to judge not to let the same user name on multiple machines at the same time landing a system
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 ' The user name of the user
%>
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.
<HTML>
<meta http-equiv= "Content-type" content=; charset=gb2312 ""
<title> prohibit the same account in different areas of the same 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=" 15 "
<input type= "Submit" name= "Submit" value= "Login"
</form>
</body>