Results 1 to 6 of 6
  1. #1
    Join Date
    Feb 2003
    Location
    Panorama City, CA
    Posts
    2,581

    Question Display IP address in php?

    i couldnt find a scritp that is all ready made? do any u know 1 or use 1? java is ok will me to if u know 1.

    o and i mean the client pc the "surfer" of the web
    Last edited by Jeremy; 09-18-2003 at 02:47 AM.
    Remote Hands and Your Local Tech for the Los Angeles area.

    (310) 573-8050 - LinkedIn

  2. #2
    Join Date
    Mar 2002
    Location
    PDX
    Posts
    81
    http://www.google.com/search?hl=en&i...lay+ip+address

    or

    it's easy to do it in php, just print $_SERVER["REMOTE_ADDR"]
    Source: Heh, they're **** out but they are listed in the search above.

    Hope that helps!

  3. #3
    Join Date
    Mar 2002
    Location
    PDX
    Posts
    81
    all ready made
    Oops, try this:
    Code:
    <html>
    <head>
    </head>
    
    <body>
    
    <?php
       echo $_SERVER["REMOTE_ADDR"];
    ?>
    
    </body>
    </html>

  4. #4
    Join Date
    Dec 2002
    Location
    England
    Posts
    726
    But remember this will not always give you the actual users, if for instance they are using a proxy you will get the proxy ip not the user, although some proxies wil forward the information which can be picked up with $_SERVER['HTTP_X_FORWARDED'], but even then I don't think you can can get the IP of AOL users for example, because AOL uses caching.

  5. #5
    Join Date
    Apr 2003
    Location
    London, UK
    Posts
    4,721
    PHP Code:
    if (getenv('HTTP_X_FORWARDED_FOR'))

      
    $ip=getenv('HTTP_X_FORWARDED_FOR'); 

    else

      
    $ip=getenv('REMOTE_ADDR'); 

    Would be a little better than just $_SERVER["REMOTE_ADDR"]; when it comes to people that might be behind a proxy server.
    Hyperconfused (™)

  6. #6
    Join Date
    Feb 2003
    Location
    Panorama City, CA
    Posts
    2,581
    ahhhh sweet thx all. i tryied to make 1 my self "script" learning at valley college it looks so simple and yet i get brain dead..

    i think i better stick to my networking class

    thx u again
    Remote Hands and Your Local Tech for the Los Angeles area.

    (310) 573-8050 - LinkedIn

Posting Permissions

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