[Asp Development] How can I make a user name online in the forum, the user name cannot be logged on for the second time ??

Source: Internet
Author: User

(Http://community.csdn.net/Expert/FAQ/FAQ_Index.asp? Id = 815)

For example, user a has logged on to the Forum. When user B uses user a's account and password to log on to the same forum on another host, user a will return to the login page, and inform the user that this account is in use. Please log in again.
 
How to implement this function in ASP, please enlighten me!
---------------------------------------------------------------
 
<%
... Get username .....
If application (username) <> "then
Response. Write "this user has logged on"
Response. End
End if
Application (username) = PASSWORD 'the password for storing the user
%>
---------------------------------------------------------------
 
1. Use cookies or sessions
When a user logs in, determines whether the value of Session ("login") or cookies (LOGIN ") is null,
If this parameter is set to null, logon is successful, but not empty.
2. One more field AA in the table
When a user logs in, judge whether the AA value is 0,
0 indicates that the logon is successful, but not 0, and 1 indicates that someone has logged in.
Change the value to 0 when the user exits.
 
---------------------------------------------------------------
 
Yes, just like on the building. You can set a field in the user information data table to 1 when logging on to the user. The default value is 0 (not online ), set the value directly when the user logs in to verify the user name and password. Use session to determine whether the instance is online. If it is not online, set the value to 0. Can this be done?
 
In order to judge the IP address on different hosts, a field is added to record the IP address.
---------------------------------------------------------------
 
There is an online table record online staff, login application ("isuserlogin") = true
<%
If application ("isuserlogin") = true then
Response. Write "this user has logged on"
Response. End
End if
%>
 
Add the session onend event to the global file. Application ("isuserlogin") = false
In addition, we also need to check whether the wire is suspended. There is a special method, that is, a certain item in the server object.
 
---------------------------------------------------------------
 
Cookie cannot guarantee

 

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.