Results 1 to 3 of 3

Thread: concurrent users

  1. #1
    Join Date
    Nov 2005
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default concurrent users

    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???

  2. #2
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    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.
    Last edited by Twey; 11-18-2005 at 04:19 PM.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  3. #3
    Join Date
    Nov 2005
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    thank you twey, sounds like a plan!

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •