ForceVoting - Stuck on Redirection

JayC

Well-Known Member
Aug 8, 2013
5,505
1,401
Hello,

I am using this function to get the current user's IP address:
Code:
final public function GetCurrentIP(){
        if(!empty($_SERVER['HTTP_CLIENT_IP'])){
            $ip = $_SERVER['HTTP_CLIENT_IP'];
        }elseif(!empty($_SERVER['HTTP_X_FORWARDED_FOR'])){
            $ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
        }else{
            $ip = $_SERVER['REMOTE_ADDR'];
        }
        
        return $ip;
    }

The code works for most users, but some users have a IPv4 IP returning from my method, but their public IP address is an IPv6 (which I believe is what findretros is getting).

I am using the code on the Api.findretros to I just modified it to get the IP address from this function (because my REMOTE_ADDR IP is a VPN).

The IP I am using is the HTTP_X_FORWARDED_FOR

Thanks,
Jay
 

Users who are viewing this thread

Top