liberty Posted June 10, 2008 Share Posted June 10, 2008 I need some help with my GeoIP script. BTw! I couldn't get into this site for some reason. It said I was banned :'( <?php include('geo_ip/geoip.inc'); $gi = geoip_open('geo_ip/geoip.dat',GEOIP_STANDARD); $addr = getenv('REMOTE_ADDR'); $country = geoip_country_name_by_addr($gi, $addr); geoip_close($gi); $ifgerman = array('Germany','Austria','Liechtenstein','Switzerland','Luxembourg'); if(in_array($country, $ifgerman)) header('Location: /de/') ?> okay basically I want to make some if statements that checks for each country regions. So First I'm checking there German (or german speaking) this redirect them to /de/ I wanted to next see if there Asia region or middle eat region. So I tried this. <?php include('geo_ip/geoip.inc'); $gi = geoip_open('geo_ip/geoip.dat',GEOIP_STANDARD); $addr = getenv('REMOTE_ADDR'); $country = geoip_country_name_by_addr($gi, $addr); geoip_close($gi); $ifgerman = array('Germany','Austria','Liechtenstein','Switzerland','Luxembourg'); $ifasia = array('China','Iran','UAE','Iraq','India','Malaysia','Japan','Isreal'); if(in_array($country, $ifgerman)){ header('Location: /de/') } if(in_array($country, $ifasia)){ header('Location: /ar-as/') } ?> It didn't work however, it threw an error Parse error: syntax error, unexpected '}'. Which I don't understand I thought the IF statement is supposed to have the } { things :? Link to comment https://forums.phpfreaks.com/topic/109666-solved-geoip-redirection-script/ Share on other sites More sharing options...
DarkWater Posted June 10, 2008 Share Posted June 10, 2008 It's saying that because you forgot ; on all of the header() lines in both files, lol. =P Link to comment https://forums.phpfreaks.com/topic/109666-solved-geoip-redirection-script/#findComment-562664 Share on other sites More sharing options...
liberty Posted June 11, 2008 Author Share Posted June 11, 2008 omfg lol! Thanks a bunch. It works now. O_O Link to comment https://forums.phpfreaks.com/topic/109666-solved-geoip-redirection-script/#findComment-562667 Share on other sites More sharing options...
DarkWater Posted June 11, 2008 Share Posted June 11, 2008 Any time. Please click "Solved" (bottom-left). Link to comment https://forums.phpfreaks.com/topic/109666-solved-geoip-redirection-script/#findComment-562671 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.