<?php
/**
 *  @author Serkan yildiz
 */

$ip = $_SERVER['REMOTE_ADDR'];
$langIp = explode('.', $ip);

if(empty($_COOKIE['lang'])){

	switch($langIp[0]){
		case 88:
			$language = 'tr';
		break;
		default:
			$language = 'en';
	}
	$_COOKIE['lang'] = $language;
	die('<script type="text/javascript">document.location="http://example.com/"</script>');
}