Visiter IP

Discussion in 'PHP' started by babaMBA, Aug 7, 2007.

  1. #1
    I want to get the ip of the visiter at my site.

    Is there any special function or syntax to get the visitor ip.

    Plz help mee.
     
    babaMBA, Aug 7, 2007 IP
  2. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #2
    
    <?php
    
    echo "IP: " . $_SERVER['REMOTE_ADDR'] ."<br />\n";
    echo "Host: " . gethostbyaddr($_SERVER['REMOTE_ADDR']);
    
    ?>
    
    PHP:
     
    nico_swd, Aug 7, 2007 IP
  3. infogle

    infogle Prominent Member

    Messages:
    2,732
    Likes Received:
    128
    Best Answers:
    1
    Trophy Points:
    300
    #3
    If you linux then visit your stats page to get the details
     
    infogle, Aug 7, 2007 IP
  4. ecentricNick

    ecentricNick Peon

    Messages:
    351
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Note, however, that the IP address cannot be relied on for anything. Using a rudimentary web proxy will mask the true IP, as will using something like TOR. Similarly, if behind a firewall, it will be the firewall's ip you see. Which means you can get multiple visitors with the same IP.

    However, if all you wish to do is count the unique visitors, or stuff like track their progress through your site it is reasonably good enough.
     
    ecentricNick, Aug 7, 2007 IP
  5. MWCD

    MWCD Peon

    Messages:
    233
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #5
    I personally use this code:

    This will help getting around transparent proxies.
     
    MWCD, Aug 7, 2007 IP
  6. ecentricNick

    ecentricNick Peon

    Messages:
    351
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Yes, but "transparent" being the operative word. It's a voluntary thing to code the forwarded_for headers and anyone trying to avoid detection still will.
     
    ecentricNick, Aug 7, 2007 IP
  7. Digitalguy

    Digitalguy Active Member

    Messages:
    545
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    60
    #7
    how can we trace a guy behind a vpn ? is there any way to trace him ?
     
    Digitalguy, Aug 7, 2007 IP