Setting the same account does not allow simultaneous login

Source: Internet
Author: User
Tags copy
Premise: The use of ASP to achieve this function is obviously a bit far-fetched, because the ASP generally rely on refreshing the Web page to change the last activity time to get the user whether online, this tutorial is not perfect, just provide a train of thought!

There are two ways to implement this functionality:

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

2. 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.

So let's take a look at how to use the database +asp is how to achieve the same account can not log in at the same time!

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.

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

Below do a loginpost.asp file also exists in this directory, which is key, look carefully at the following code:

After successful landing, the leaf will jump to loginok.asp

The next thing to do is loginframe.asp

So far, the program is completed, the key to the program is to determine whether the user online, this example is to use frame to determine the user online critical leaf nesting in the main program of the surface, the actual operation can be the wide and high of the IFRAME to 0 to allow the general user to see, or let the main program's web page background and that nested in the timed refresh of the page as OK.
As for some people say that using the session and cookies and other things can be judged, this is obviously impossible, because they are generated by the object of their own work, and its data content can not be shared with other users. Appliaction should be another way to do this, but if there are a lot of users logged in to generate at least one to three appliaction for each user, the server will be dragged down

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.