Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $IP = $_SERVER['REMOTE_ADDR'];
- //$IP = '31.3.223.255'; //uk ip for test
- $Url='https://geoip.maxmind.com/geoip/v2.1/country/'.$IP;
- $username = 100969;
- $password = 'uESdyU1V0cyJ';
- $ch = curl_init();
- curl_setopt($ch, CURLOPT_URL, $Url);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
- curl_setopt($ch, CURLOPT_USERPWD, "$username:$password");
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
- $tmp_json_country_code = curl_exec($ch);
- curl_close($ch);
- $record=json_decode($tmp_json_country_code);
- $country_name=$record->country->names->en;
- if($country_name=="United Kingdom" || $country_name=="Ireland" || $country_name=="England" || $country_name=="Wales" || $country_name=="Scotland")
- {
- $tmp_ip=1;
- }
- else
- {
- $tmp_ip=0;
- }
- $tmp_str_filenames=$_SERVER['REQUEST_URI'];
- $tmp_str_file_path=substr($tmp_str_filenames,1); // remove the first/
- if(strpos($_SERVER['UNENCODED_URL'], 'special') !== false && $tmp_ip==1){
- header("HTTP/1.1 301 Moved Permanently");
- header( "Location: http://www.eliteislandresorts.co.uk/pages/special-offers.php" ); exit;
- }else if(strpos($_SERVER['UNENCODED_URL'],'contact') !== false && $tmp_ip==1){
- header("HTTP/1.1 301 Moved Permanently");
- header( "Location: http://www.eliteislandresorts.co.uk/pages/contact-us.php" ); exit;
- }
- if($tmp_ip==1)
- {
- header("HTTP/1.1 301 Moved Permanently");
- header( "Location: http://www.eliteislandresorts.co.uk/index.php" ); exit;
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement