Advertisement
AlexM1SHOP

Untitled

Dec 28th, 2018
1,799
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.75 KB | None | 0 0
  1. <?php
  2.  
  3. $client  = @$_SERVER['HTTP_CLIENT_IP'];
  4. $forward = @$_SERVER['HTTP_X_FORWARDED_FOR'];
  5. $remote  = @$_SERVER['REMOTE_ADDR'];
  6. $result  = array('country'=>'', 'city'=>'');
  7.  
  8. if(filter_var($client, FILTER_VALIDATE_IP)) $ip = $client;
  9. elseif(filter_var($forward, FILTER_VALIDATE_IP)) $ip = $forward;
  10. else $ip = $remote;
  11.  
  12. $ip_data = @json_decode(file_get_contents("http://www.geoplugin.net/json.gp?ip=".$ip));
  13. if($ip_data && $ip_data->geoplugin_countryName != null)
  14. {
  15.     $geo = $ip_data->geoplugin_countryCode;
  16. }
  17.  
  18.  
  19.  switch ($geo) {
  20.     case "RU":
  21.         $oldPrice='';
  22.         $newPrice='';
  23.     break;
  24.    
  25.    
  26. default:
  27.         $oldPrice='';
  28.         $newPrice='';
  29.  
  30.  
  31. }
  32.  
  33.  
  34.  
  35. ?>
  36.  
  37. <?include('geo.php');?>
  38. <?=$oldPrice;?>
  39. <?=$newPrice;?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement