Giving each random visitor a unique identity?

Discussion in 'PHP' started by ads2help, Feb 14, 2009.

  1. #1
    In my situation, I need a way to give any random visitor a unique identity.

    More Info
    - No membership system exist, therefore this problem arise
    - Ip address cannot be used to achieve this because most of them have dynamic ip
    - No matter what time or which day, he will be carrying the same unique identity as long he is using the same computer.

    Why I need the unique identity?
    - Track the user no matter what name he used when he post a message at my site

    Any way to do this?

    Thank you.
     
    ads2help, Feb 14, 2009 IP
  2. mjewel

    mjewel Prominent Member

    Messages:
    6,693
    Likes Received:
    514
    Best Answers:
    0
    Trophy Points:
    360
    #2
    You would need to use a cookie.
     
    mjewel, Feb 14, 2009 IP
    ads2help likes this.
  3. ads2help

    ads2help Peon

    Messages:
    2,142
    Likes Received:
    67
    Best Answers:
    1
    Trophy Points:
    0
    #3
    Yeah, thanks. I get it now. That will be part of what I need.

    Is there any other way out there?

    Thank you.
     
    ads2help, Feb 14, 2009 IP
  4. xcrox

    xcrox Banned

    Messages:
    232
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Here is the solution

    <?php
    session_start();
    if(!isset($_SESSION['visitor']))
        $_SESSION['visitor'] = md5(uniqid());
    ?>
    <html>
    Dear Visitor, your unique ID is <b><?php echo $_SESSION['visitor']; ?></b>
    </html>
    Code (markup):
     
    xcrox, Feb 15, 2009 IP
  5. ads2help

    ads2help Peon

    Messages:
    2,142
    Likes Received:
    67
    Best Answers:
    1
    Trophy Points:
    0
    #5
    uniqid() is based on the current time. What I need was a unique identity that will not change no matter when the user surf my website, even 2 months later.

    Cookie is near to the solution I think, unless the user clears cookie.

    Thank you anyway.
     
    ads2help, Feb 15, 2009 IP
  6. xcrox

    xcrox Banned

    Messages:
    232
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Another possible solution is flashes..!! Flashes can store data permanently...!!!
     
    xcrox, Feb 15, 2009 IP
  7. joebert

    joebert Well-Known Member

    Messages:
    2,150
    Likes Received:
    88
    Best Answers:
    0
    Trophy Points:
    145
    #7
    Other than a cookie you're out of luck in this situation.
    Even a cookie isn't very dependable.
     
    joebert, Feb 15, 2009 IP
  8. ads2help

    ads2help Peon

    Messages:
    2,142
    Likes Received:
    67
    Best Answers:
    1
    Trophy Points:
    0
    #8
    Agree. Looks like I got my answer here.

    I try to do what I can do using cookie.

    Thank you.
     
    ads2help, Feb 15, 2009 IP