Multiple people viewing the same webpage...


Results 1 to 4 of 4

Thread: Multiple people viewing the same webpage...

  1. #1
    Join Date
    Sep 2002
    Location
    Harlow, UK
    Posts
    1,788

    Multiple people viewing the same webpage...

    I've been asked by someone to create a simple dice roller on a webpage, where you select the number of dice on 1 page, and it generates another page which can be viewed to see the result. This isn't an issue for me, however one person will generate a random number that's going to be viewed by half a dozen other people.

    Because of the fact that theres going to be several people viewing results at any time, I wanted to create a page which does both, generate and display random rolls, to save each person having to refresh another page. Having a page that does both (generates and displays) results, isn't a problem for me. However my understanding of web applications stops basically at single instances of a page, I'm not sure where to start reading about creating a page that will update for several people. Can anyone give me pointers on where to look? Or rather, what to google. Can PHP do what I'm suggesting? Is AJAX what I want to be looking at?

    Thanks for any replys.
    If you have to ask why you want to install Linux, then perhaps you shouldn't.
    -- Michael D. Watts (Gone but never forgotten)

    Linux is not Windows | Posting Guidelines

    Code Monkey (YouTube)

  2. #2
    Join Date
    Nov 2002
    Posts
    205
    I think it depends on what exactly needs to be done, but the way i would probably approach it is store the roll in a text file, then the other viewers pages could get the roll from that text file. You could make it update every x number of second with an autopage refresh or a tiny bit of ajax if you are feeling fancy.

    This would be very easy if there is a "roller page" and a "viewer page" where only one person at a time is using the "roller page" and the rest use the "viewer". If any of them could roll and any arbitrary time you'd have to do some more work, but still doable in that fashion, i think.

    I think what i'm getting at is i don't believe there is a way to make a page that actually "updates" for multiple people, you just have to make sure those multiple people are getting the same data when _they_ update.
    but really, i dont know what im talking about.

  3. #3
    Join Date
    Jan 2004
    Location
    Singapore
    Posts
    355
    I suppose AJAX is what you need. It allows the page to do a "refresh" of a small portion of itself. perhaps u could get the page to check if the number has been rolled. and if true, check for the rolled number.
    Registered Linux User #388117

  4. #4
    Join Date
    Sep 2002
    Location
    Harlow, UK
    Posts
    1,788
    OK, thanks for the replys.
    If you have to ask why you want to install Linux, then perhaps you shouldn't.
    -- Michael D. Watts (Gone but never forgotten)

    Linux is not Windows | Posting Guidelines

    Code Monkey (YouTube)

Posting Permissions

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