I'm running PHP 4.3.0 on OS 10.2 server.

While trying to grab the user's IP, I found that I am getting an odd answer.

I'm getting the server's IP, not the users IP.

echo $_SERVER['REMOTE_ADDR'];
shows the wrong IP.

--yet the server's web log clearly shows the correct IP.

Anyone heard of this?

    try

    $GLOBALS['REMOTE_ADDR'];

    are the users behind a proxy server ?

    reg
    kevin

      The users are not behind a proxy server.

      I'm running a test server at http://dev.videx.com/test.php

      here's the contents of the page:

      <?php
      session_start();
      $user_ip = $SERVER['REMOTE_ADDR'];
      echo getenv("REMOTE_ADDR") . "<BR>";
      echo $
      SERVER['REMOTE_ADDR'] . "<BR>";
      echo $GLOBALS['REMOTE_ADDR'] . "<BR>";

      ?>

        went to that test page you gave, it gave me an ip of

        12.17.172.221

        but i go to www.grc.com and run the shields up, then test my
        shields and it give me our companies TRUE ip address, which is

        12.15.120.209

          I was able to see you test the page and the IP my server logs show is:
          12.15.120.209
          3 hits
          yet PHP does not seem to be giving me correct information.

          Thanks for testing...

            Just on a hunch I turned off the server's performance cache.

            This seems to have fixed the issue, could somone outside my circuits test this and let me know?

            thanks

              Write a Reply...