How can a system allow up to 10 users to log on to the same account simultaneously?

Source: Internet
Author: User
A system allows up to 10 users to log on to the same account simultaneously. how can this problem be solved? A system allows up to 10 users to log on to the same account simultaneously. how can this problem be solved? Let's talk about your ideas... is it an internal system. Create a logs table ipuser_idlast_time. assume that the time is counted as online WHERElast_time + 600 & gt within 10 minutes. a system allows up to 10 people under the same account to log on online simultaneously. how can this problem be solved?
A system allows up to 10 users to log on to the same account simultaneously. how can this problem be solved? Let's talk about your ideas ..

------ Solution --------------------
Is it an internal system.

Create a logs table
Ip user_id last_time

Assume that the instance is online within 10 minutes.
If the WHERE last_time + 600> time () and group by user_id are greater than 10, logon is not allowed.
Delete last_time + 600 <time.

We have to test it in practice ......
------ Solution --------------------
Login is login, and the limit is restriction.

A single login session is no different from a common user.

The limit is an additional addition. each account has one database count field. The question is how to make a login of a user expire.
If you log out every time, you can perform database-1 operations. If the user does not log out, the database should count-1 when the session expires to make it reasonable for the user. However, it is difficult to associate the session validity period with the count-1 automatic operation, that is, a login session expires, and the database does not have-1, which is unfair to users.

Therefore, it would be nice to register a session expiration callback to operate on the database count-1. Unfortunately, I don't know if php. ini can be configured to call a callback php file? No ..

Therefore, the final solution I provided is: the user will always maintain the login status without logging out, relying on a separate COOKIE for maintenance... Crontab runs a php scheduled script to delete the COOKIE records of the database and send them to technology-1 for those who have logged on to the database for longer than N, so that other users can access the database, in addition, the original login student had nothing to say and had to try again.

Add a table: AUTO_ID user cookie. each login point of each USER corresponds to a COOKIE. if the COOKIE of the same USER in this table is limited to 10, 10 users are allowed to log on, as long as the COOKIE is generated and sent to each login, as long as they are not logged out, they are always online for a period of time. PHP checks who they are or not and queries the COOKIE in the database. To clear unlogged users, you can only run crontab to clear them at regular intervals.




Conclusion !~~~~~ In fact, the SESSION will always expire, and no tracing will be available after it expires, so you need to persist the SESSION to the database !!!
Second, the callback function is not available because the SESSION expires. Therefore, after persistence, the crontab is run regularly to clear the timeout COOKIE ~~~~


------ Solution --------------------
Discussion

Login is login, and the limit is restriction.

A single login session is no different from a common user.

The limit is an additional addition. each account has one database count field. The question is how to make a login of a user expire.
If you log out every time, you can perform database-1 operations. If the user does not log out, the database should count-1 when the session expires to make it reasonable for the user. However, it is difficult to automatically associate the session validity period with the count-1, that is, a certain login ......

------ Solution --------------------
You can customize your session handler. the advantage is that you do not need to change the code elsewhere.
Http://ca3.php.net/manual/en/class.sessionhandler.php


Of course, some upstairs methods can also be implemented.

Depending on your specific needs and existing implementations






------ Solution --------------------
Discussion

Reference:

Login is login, and the limit is restriction.

A single login session is no different from a common user.

The limit is an additional addition. each account has one database count field. The question is how to make a login of a user expire.
If you log out every time, you can perform database-1 operations. If the user does not log out, the database should count-1 when the session expires to make it reasonable for the user. However, it is difficult to set the session validity period and count -......

------ Solution --------------------
Discussion

You can customize your session handler. the advantage is that you do not need to change the code elsewhere.
Http://ca3.php.net/manual/en/class.sessionhandler.php


Of course, some upstairs methods can also be implemented.

Depending on your specific needs and existing implementations

------ Solution --------------------
Discussion
If the landlord asks that a system only allows one account to be logged on once
Is that the answer?

------ Solution --------------------
Discussion

Reference:

You can customize your session handler. the advantage is that you do not need to change the code elsewhere.
Http://ca3.php.net/manual/en/class.sessionhandler.php


Of course, some upstairs methods can also be implemented.

Depending on your specific needs and existing implementations


I have read this session handler and don't know if it will call back destroy callba if it expires ......

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.