Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: How to: show users on the page they are

  1. #1
    Join Date
    Aug 2005
    Posts
    94
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default How to: show users on the page they are

    Hi,

    I've made a script where guests can put in there name and a message. All guests can do this and all guests currently online on the page can read it.

    Now I've added a second page, but this shows all the users and their messages even from page 1. I want it so that all the guests on page one see all the messages and guestnames on page one. The guests on page 2 will only see the guest names and messages on page 2 etc

    And if possible, the menu will show how many guests are currently on the page.

    I have a demo here (don't mind the looks it's just a demo).

    Other issues:
    If I refresh the page after 30 min or so, I have to re-fill in my message and name. Why is this, I mean, I am still on the page, never left it, so my info shouldn't be deleted. (It's supposed to delete a guest from the db when he leaves the page).

    Also, I just started learning php so if there is some code clean up etc plz do

    Hope you guys can help me fix these things

    Null

    ps In the attachment are all the files you need

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

    Default

    It's supposed to delete a guest from the db when he leaves the page
    No, it's supposed to delete a guest from the database when s/he enters another page in which a user object is used. There's quite a big difference.
    If I refresh the page after 30 min or so, I have to re-fill in my message and name.
    Well, you've done it by IP, so I can only conclude that your IP must be changing. Do you use a dial-up connection?
    I want it so that all the guests on page one see all the messages and guestnames on page one.
    Then you want to keep track of the page the user is on in that database too.
    Also, I just started learning php so if there is some code clean up etc plz do
    It's actually quite good, especially for a beginner. You've even used objects. In fact, you've even used objects properly, which is a lot rarer to see
    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
    Aug 2005
    Posts
    94
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    "Well, you've done it by IP, so I can only conclude that your IP must be changing. Do you use a dial-up connection?"

    No I have cable. I also used ip instead of sessions cause peeps told me it was more accurate...

    "It's actually quite good, especially for a beginner. You've even used objects. In fact, you've even used objects properly, which is a lot rarer to see"

    Thx had some help though

    "Then you want to keep track of the page the user is on in that database too."

    Owkee and how to do that? Cause if I have that, I think I can fix the menu myself

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

    Default

    Owkee and how to do that?
    The same way you stored the user's IP, name, avatar and timestamp to the database. You can access the name of the current page with $PHP_SELF.
    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!

  5. #5
    Join Date
    Aug 2005
    Posts
    94
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by Twey
    The same way you stored the user's IP, name, avatar and timestamp to the database. You can access the name of the current page with $PHP_SELF.
    Could you do this for me? And add some comments in the script? This way I can see what and how you've changed it and learn from it. I cannot seem to get it done right myself

    Thx

  6. #6
    Join Date
    Dec 2004
    Location
    UK
    Posts
    2,358
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by Null
    Quote Originally Posted by Twey
    Well, you've done it by IP, so I can only conclude that your IP must be changing. Do you use a dial-up connection?
    No I have cable. I also used ip instead of sessions cause peeps told me it was more accurate...
    Presumably you're both discussing identifying users by IP address. That's a bad idea, and one only needs to consider AOL to see why.

    The AOL browser (based on IE) usually routes requests through load-balanced proxy servers run by AOL. These caches are shared by thousands of people (possibly more). Not only will these people appear to have the same IP address, but as the proxies are load-balanced, a single user could appear to have multiple IP addresses for the same batch of requests.

    AOL is an extreme case (though at over 20 million users, an influential one), but not the only such scenario. Other users can and do use caches provided by their server provider, and other ISPs also rely on NAT, similar to AOL.

    Mike

  7. #7
    Join Date
    Aug 2005
    Posts
    94
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by Null
    Could you do this for me? And add some comments in the script? This way I can see what and how you've changed it and learn from it. I cannot seem to get it done right myself

    Thx
    Darn it wont work, some help? Excample?

    Null

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

    Default

    What've you got? Post it and I'll have a look. In [code] tags would be nice.
    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!

  9. #9
    Join Date
    Aug 2005
    Posts
    94
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by Twey
    What've you got? Post it and I'll have a look. In [code] tags would be nice.
    See zip at first post, got so frusterated I deleted my not working addings

  10. #10
    Join Date
    Aug 2005
    Posts
    94
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Any luck?

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
  •