Code for Ip Based Language Redirecting:
$ziyaretci_ip = getenv(REMOTE_ADDR); // here we get ip from visitor
$ziyaretci_yer = file("http://www.hostip.info/api/get.html?ip=$ziyaretci_ip"); //we use a geoip service for getting ip information
$ziyaretci_yer = join ("", $ziyaretci_yer); // joining lines
if (eregi ("Turkey", $ziyaretci_yer)) { echo ("You should go to Turkish pages!"); } else { echo ("You should go to English pages!"); } // and we look for ip in Turkey because of finding turkish visitors
And here is the code working:
You should go to Turkish pages!
this code was written by cappytoi