mercredi 15 septembre 2021

ip undefined on some system [closed]

I'm getting ip using this php code

  $ip="";
        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 if(!empty($_SERVER['HTTP_FORWARDED_FOR']))
        {
          $ip=$_SERVER['HTTP_FORWARDED_FOR'];
        }
        else if(!empty($_SERVER['HTTP_FORWARDED']))
        {
          $ip=$_SERVER['HTTP_FORWARDED'];
        }
        else if(!empty($_SERVER['REMOTE_ADDR']))
        {
          $ip=$_SERVER['REMOTE_ADDR'];
        }
        else
        {
           $ip="Unknown";
        }

but on some system i'm not getting any ip,

Any suggestion Thanks



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire