Results 1 to 5 of 5
  1. #1

    PHP display Visitors ip address

    Heres the problem i want php to display a visitors ip address, I have this code: echo "$_SERVER[REMOTE_ADDR]"; but the problem is when i have that same script in another directory like say for instance the images directory that code displays not the visitors ip but the servers ip. Is there a way to fix this?

    Thanks

  2. #2
    Join Date
    Nov 2003
    Posts
    477
    On first page (where your script work correctly) create variable or even image, then on the rest of site use that variable/image instead of function
    look here
    http://www.allscoop.com/phpcode.php

  3. #3
    Join Date
    Feb 2006
    Location
    Lancashire, UK
    Posts
    473
    can you try $REMOTE_ADDR on its own?

  4. #4
    Join Date
    Mar 2006
    Posts
    965
    Two good ways you can show this up:

    PHP Code:
    <?php
    echo $_SERVER['REMOTE_ADDR']."<br />";
    echo 
    getenv('REMOTE_ADDR]');
    ?>

  5. #5
    ok ill try it...


    thanks guys

Posting Permissions

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