View Full Version : concurrent users

11-18-2005, 05:14 AM
how would you go about coding a page that would only be accessible to 150 users?

I can increment easily the number of connected users and then decide that at the 151st user that connects I redirect them to another page, but I believe that this technique would also mean that the existing 150 guys who are connected who then be redirected.

Do you think I need to log each access on a MySQL db to achieve this??? :rolleyes:

11-18-2005, 03:17 PM
From your post title, I assume you mean concurrent users. I suggest that you keep a list (a text file will work as well as a database) of IPs and the last time they clicked a page. Every time a page is accessed, check this data, and if any of them haven't accessed page in the last, say, five minutes, remove their entry from the list. If their IP isn't in the list, and there are less than 150 entries, add them to the list and allow them access. If there are 150 or more, deny them access. If they're already in the list, update their entry and allow them access. This will result in a nice, neat, "first come first served" type scenario. If you have pages that a user will want to spend more than five minutes on, increase the timeout.

11-20-2005, 07:58 PM
thank you twey, sounds like a plan!