Advertisement
Guest User

Untitled

a guest
May 3rd, 2016
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. $xml = simplexml_load_file("http://www.geoplugin.net/xml.gp?ip=".getRealIpAddr());
  2. $country = $xml->geoplugin_countryName ;
  3. if($country != "Germany")
  4. {
  5. //Show your Ad!!
  6. }
  7.  
  8.  
  9.  
  10. //For getting IP Address
  11.  
  12. function getRealIpAddr()
  13. {
  14. if (!empty($_SERVER['HTTP_CLIENT_IP'])) //check ip from share internet
  15. {
  16. $ip=$_SERVER['HTTP_CLIENT_IP'];
  17. }
  18. elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) //to check ip is pass from proxy
  19. {
  20. $ip=$_SERVER['HTTP_X_FORWARDED_FOR'];
  21. }
  22. else
  23. {
  24. $ip=$_SERVER['REMOTE_ADDR'];
  25. }
  26. return $ip;
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement