Web Hosting Talk







View Full Version : Anyway to restrict number of people accessing the page?


Kwatt
12-16-2001, 11:17 AM
Does anyone know anyway to to restrict number of people accessing the particular page at the same time?

Let's say if I set 50 accesses, 51st people will see the error page saying, server is busy etc....

allending
12-16-2001, 03:00 PM
Thats rather hard to do 100% accurately using just HTTP since it isnt persistent. You could probably use a user installed control to do so, but that would be pretty annoying for users (you know, those popups asking this control is signed by blahblah..). Please correct me if I am wrong :)

A way would be to use a scripting language and have a counter somewhere in a database. Each time a user accesses a page add his IP , and time of access, or if his IP is already in the DB, update the time. When user 51 comes, and you have 50 rows in the DB, run checks against each IP's last access time and the current time.. say if someone hasnt accessed a page for more than 2 minutes, he probably isnt on the site anymore, so delete his IP. Then the user 51 gets promoted to user 50. If everyone has accessed a page in the last 2 minutes, user 51 then gets a message "Sorry :( "