Created
November 7, 2014 16:05
-
-
Save JBlond/859fbe13e230da45d257 to your computer and use it in GitHub Desktop.
Geo Locate EUROPE by IP
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
</head> | |
<body> | |
<?php | |
$current_ip = $_SERVER["REMOTE_ADDR"]; | |
#echo '<b>' . $current_ip .'</b><br>'; | |
# ip address first bloc 41,196,197,102,105,154 are Africa, rest is Europe (e.g. 41.0.0.0 etc.) | |
$ippool = array( | |
41,196,197,102,105,154, | |
5,24,25,31,37,46,62,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91, | |
92,93,94,95,109,128,129,130,131,134,135,136,137,139,141,144,145,146,147, | |
148,149,150,151,157,158,159,160,161,162,164,165,170,171,176,178,185,188,192, | |
193,194,195,212,213,217,51,132,138,140,143,152,153,154,155,156,163,166,167,168,169 | |
); | |
$check = explode('.',$current_ip); | |
#send all ip bloc user to EU website or US pendant (.com webiste) | |
if(in_array($check,$ippool)) { | |
header('Location: http://www.eu/'); | |
} | |
else | |
{ | |
header('Location: http://www.com/'); | |
} | |
?> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment