How to limit the number of logins at a time?

Hi, I have a website. created using php, mysql. I want to set a limit as .. only 10 users can log into my site at a time. How can I make this setup? any body knows that a solution will kindly help me.

+3
source share
5 answers

Use a database table to store the number of registered users, but you need to come up with some way to limit the time for these users. I would suggest a field in the table that marks their last action. When a new user tries to log in, you need to apply some logic (pseudo-code):

if(<10users){
    login
} elseif(any of the users have no activity for 30 mins){
    remove that user and login
} else {
    inform user of no space
}

, .

+3

PHP, - . , .

, , - (, , ), , .

+1

php . : http://www.raditha.com/php/session.php

, 10 , . -, -, 30 , .

0

, 10 , , 10 .

, db, , . . .

, .

0

, , , , , , .... , , ur

0
source

Source: https://habr.com/ru/post/1787679/


All Articles