How to display all users who logged?

Discussion in 'PHP' started by nubpro, Aug 26, 2011.

  1. #1
    I knew a little bit about PHP and I'm quite new with it.
    What does it required to display all users who logged into site?
    I really need help!
     
    nubpro, Aug 26, 2011 IP
  2. ssmm987

    ssmm987 Member

    Messages:
    180
    Likes Received:
    4
    Best Answers:
    3
    Trophy Points:
    43
    #2
    There are two ways to do this: 1.Create a table, where everytime a user logs in, a record is added
    2.Add a column in the user table, which tracks the last time a user logged in.
     
    ssmm987, Aug 26, 2011 IP
  3. nubpro

    nubpro Peon

    Messages:
    9
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Here's my question, how am I going to track them?
     
    nubpro, Aug 26, 2011 IP
  4. Rukbat

    Rukbat Well-Known Member

    Messages:
    2,908
    Likes Received:
    37
    Best Answers:
    51
    Trophy Points:
    125
    #4
    How do you want to track them? A list of every time every user logged in? A list of all users who log in? You can't really "track" who's currently logged in, because a lot of people don't ever log out, they log in, then leave the site, and there's no way to tell if they leave. (The web is a "disconnected model" - you connect, get the page and disconnect, you don't stay connected while you're reading the page.)
     
    Rukbat, Aug 26, 2011 IP
  5. nubpro

    nubpro Peon

    Messages:
    9
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    How does everytime user logged and a list of users who log in works
     
    nubpro, Aug 26, 2011 IP
  6. ssmm987

    ssmm987 Member

    Messages:
    180
    Likes Received:
    4
    Best Answers:
    3
    Trophy Points:
    43
    #6
    Everytime someone logs in, you update a timestamp column, which keeps track of the last time people logged in.

    If you want a overview of who's online, you might want to update the column every time an action is taken
     
    ssmm987, Aug 26, 2011 IP
  7. Rukbat

    Rukbat Well-Known Member

    Messages:
    2,908
    Likes Received:
    37
    Best Answers:
    51
    Trophy Points:
    125
    #7
    Every time a user logs in - insert a new record in the database login table for that user.

    A list - "select distinct login from logins"
     
    Rukbat, Aug 26, 2011 IP
  8. nubpro

    nubpro Peon

    Messages:
    9
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #8
    I will try whenever I have time
     
    nubpro, Aug 26, 2011 IP
  9. Ciprian

    Ciprian Peon

    Messages:
    14
    Likes Received:
    0
    Best Answers:
    1
    Trophy Points:
    0
    #9
    Also, after inserting the timestamp into the database, use a script to update the timestamp for each logged in user (using a cookie). If the cookie is not present, the timestamp would be compared to a time value (usually 3 or 5 minutes) and after this period is over, just delete the user (user name or user id).
     
    Ciprian, Aug 28, 2011 IP
  10. ketting00

    ketting00 Well-Known Member

    Messages:
    782
    Likes Received:
    28
    Best Answers:
    3
    Trophy Points:
    128
    #10
    ketting00, Aug 29, 2011 IP
  11. nubpro

    nubpro Peon

    Messages:
    9
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #11
    <br>You sure it works? The tutorial is quite complicated after all it's illegal.
     
    nubpro, Aug 29, 2011 IP
  12. nubpro

    nubpro Peon

    Messages:
    9
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #12
    I started to work with codes but I'm stucked with a problem. I had done the login page and the main page. But how I'm going to add the time stamp?
    I mean when user press the login button, what should I do?
    How does the time stamp works?
    How am I going to add the time stamp to the specific user?
     
    nubpro, Aug 29, 2011 IP
  13. iBank ™

    iBank ™ Peon

    Messages:
    63
    Likes Received:
    4
    Best Answers:
    1
    Trophy Points:
    0
    #13
    Have you ever tried to search for an answer before posting a question ?

    The only two functions you need to get it up and running:

     
    iBank ™, Aug 29, 2011 IP
  14. falconlink

    falconlink Active Member

    Messages:
    285
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    78
    #14
    He is looking for the full PHP code, I think.
     
    falconlink, Aug 29, 2011 IP
  15. HowDoYou

    HowDoYou Well-Known Member

    Messages:
    443
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    130
    #15
    i'll code it for you for $50. :p pm me if your interested.
     
    HowDoYou, Aug 29, 2011 IP
  16. nubpro

    nubpro Peon

    Messages:
    9
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #16
    I won't pay cause I'm learning instead of copying someone else works.
     
    nubpro, Aug 30, 2011 IP
  17. nubpro

    nubpro Peon

    Messages:
    9
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #17
    I really need your help.
     
    nubpro, Aug 30, 2011 IP