geoip redirection for superforex.com.au
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

63 行
2.0KB

  1. <?php
  2. require_once 'vendor/autoload.php';
  3. use GeoIp2\Database\Reader;
  4. // This creates the Reader object, which should be reused across
  5. // lookups.
  6. $reader = new Reader(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'GeoLite2-City.mmdb');
  7. // Replace "city" with the appropriate method for your database, e.g.,
  8. // "country".
  9. //$record = $reader->city('128.101.101.101');
  10. // $record = $reader->city('115.64.88.12');
  11. // $record = $reader->city('175.22.14.240');
  12. // print($record->country->isoCode . "\n"); // 'US'
  13. // print($record->country->name . "\n"); // 'United States'
  14. // print($record->country->names['zh-CN'] . "\n"); // '美国'
  15. // print($record->mostSpecificSubdivision->name . "\n"); // 'Minnesota'
  16. // print($record->mostSpecificSubdivision->isoCode . "\n"); // 'MN'
  17. // print($record->city->name . "\n"); // 'Minneapolis'
  18. // print($record->postal->code . "\n"); // '55455'
  19. // print($record->location->latitude . "\n"); // 44.9733
  20. // print($record->location->longitude . "\n"); // -93.2323
  21. //print($record->traits->network . "\n"); // '128.101.101.101/32'
  22. function get_client_ip() {
  23. $ipaddress = '';
  24. if (getenv('HTTP_CLIENT_IP'))
  25. $ipaddress = getenv('HTTP_CLIENT_IP');
  26. else if(getenv('HTTP_X_FORWARDED_FOR'))
  27. $ipaddress = getenv('HTTP_X_FORWARDED_FOR');
  28. else if(getenv('HTTP_X_FORWARDED'))
  29. $ipaddress = getenv('HTTP_X_FORWARDED');
  30. else if(getenv('HTTP_FORWARDED_FOR'))
  31. $ipaddress = getenv('HTTP_FORWARDED_FOR');
  32. else if(getenv('HTTP_FORWARDED'))
  33. $ipaddress = getenv('HTTP_FORWARDED');
  34. else if(getenv('REMOTE_ADDR'))
  35. $ipaddress = getenv('REMOTE_ADDR');
  36. else
  37. $ipaddress = 'UNKNOWN';
  38. return $ipaddress;
  39. }
  40. $ip = get_client_ip();
  41. if ($ip == 'UNKNOWN') {
  42. echo " webtradepay ";
  43. header("Location: https://webtradepay.com.au");
  44. }else{ //determin $ip address
  45. $record = $reader->city($ip);
  46. if ( trim($record->country->isoCode) == 'AU' ){
  47. echo "https://www.supertraderfx.com.au";
  48. }else{
  49. echo "https://www.supertraderfx.com";
  50. }
  51. }