<?
function real_ip_adress() { 
        global $HTTP_SERVER_VARS;  
        $gizli_ipler = array( '10.0.0.', '192.168.', '127.0.0.', '172.16.0.' );  
        if( isset($_SERVER['HTTP_X_FORWARDED_FOR']) && $_SERVER['HTTP_X_FORWARDED_FOR'] != '' ) {  
            $ip_strings = explode( ',',$_SERVER['HTTP_X_FORWARDED_FOR']);  
                foreach($ip_strings as $k => $v) { 
                    if( empty($v) ) { 
                        unset( $ip_strings[$k] );  
                    } else { 
                        if(!isset($ip_string)) {  
                            $ip_string = $v;  
                        }  
                    }  
                }  
        }  
        if( isset($_SERVER['REMOTE_ADDR']) && $_SERVER['REMOTE_ADDR'] != '' ) {  
            $ip_strings[] = $_SERVER['REMOTE_ADDR'];  
                if(!isset($ip_string)) { 
                    $ip_string = $_SERVER['REMOTE_ADDR']; 
                }  
        }  
        foreach($ip_strings as $k1 => $ip) { 
            foreach($gizli_ipler as $k2 => $pip) {  
                if(strpos($ip, $pip) === 0) {  
                    unset($ip_strings[$k1]); break;  
                }  
            }  
        }  
        if(!empty($ip_strings) ) {  
            foreach( $ip_strings as $v ) { 
                if(!empty($v)) {  
                    $ip_string = $v;  
                    $is_local_ip = false;  
                    break;  
                } 
            } 
        } else {  
            $is_local_ip = true; 
        }  
        return $ip_string;  
    } 
    $ip    = real_ip_adress();
    $bol = substr($ip, 0, 2);
    if($bol=="88"){header("loaction: www.site.com/tr");}
    if($bol=="84"){header("loaction: www.site.com/sudi");}
?>