Welcome Guest, Not a member yet? Register   Sign In
How can I limit access to users logged into the system?
#1

[eluser]soprabaixar1[/eluser]
How can I limit access to users logged into the system?
For example, on my system only 100 users can be logged at the same time.

$users_logged = count($_SESSION);
#2

[eluser]JHackamack[/eluser]
The $_SESSION variable is only for the current user in the current session thus would not provide you a count of everybody using your website. The easiest way I can think of would be to log people's interactions to the site (on an action of some sort: page view, search, etc) and then do a count of all actions within the past 5 minutes or so. This would allow you to see all ACTIVE users within the past five minutes. While it may not be the best its the fastest thing I can think of.
#3

[eluser]soprabaixar1[/eluser]
Would be for a commercial application, as do some software. Restricting access to the software by the number of users. If the system was already at the limit of allowed users in the package that was contracted, the user would not be able to log into the system and then receive a message on it.

I also thought of doing that, but that it would not be feasible.
Even so, thanks.
#4

[eluser]JHackamack[/eluser]
Instead of a database you could try this method:
http://www.devarticles.com/c/a/PHP/The-Q...-With-PHP/
#5

[eluser]soprabaixar1[/eluser]
That does not help, because I need to know in real time whether a particular User or can not login.
#6

[eluser]JHackamack[/eluser]
If you were able to do database queries you can do the following:
set up a table that contains:
--User ID
--SessionID
--Timestamp

When a user logs in the user ID is inserted
When a user logs out the user ID is deleted

This would allow you to count all logged in users at the current time. You'll have to also build a function that goes through and removes session IDs where the timestamp is older than current time - session time limit. That is the only true way I know where you can get an up to the minute account of all active users on one system.
#7

[eluser]soprabaixar1[/eluser]
It really this idea is very good!
It is hardly perfect, but the best I've seen up till now!

Thank you so much!

Sorry for my english ... this is translated by Google! =]
#8

[eluser]soprabaixar1[/eluser]
Does anyone know the ideal solution to this problem?
#9

[eluser]Basketcasesoftware[/eluser]
There are a number of Authorization and Access control packages floating around in these forums. They are pretty spread out. Might try the wikki.




Theme © iAndrew 2016 - Forum software by © MyBB