find user ip problem

I use this function to find the ip of the user.

I had xp pro and it worked ok when I was working at localhost.

Now I moved at Vista business and the ip (of localhost-my pc) that is returning is

-as I find from debugging it is the $_SERVER[‘REMOTE_ADDR’]

what is wrong?

public  function getRealIpAddr() {

        if (!empty($_SERVER['HTTP_CLIENT_IP']))   //check ip from share internet




        elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR']))   //to check ip is pass from proxy




        else {



        return $ip;


That’s localhost in ipv6 lingo.

(quotation obviously didn’t like “::1”)