<?php 
$url_cn = 'http://lang23.demo.demososo.com/cn/';
$url_jp = 'http://lang23.demo.demososo.com/jp/';
$url_en = 'http://lang23.demo.demososo.com'; 

$lang = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 4); 

 //echo $lang;
 //echo LANG.'--R--'.$lang.'<br>';
 //print_r($_COOKIE);
	
	
	if (preg_match("/zh-c/i", $lang)) {	
	    
	    if(LANG<>'cn') {
	        if(@$_COOKIE['url_cn']<>'y'){
    	       
    	        setcookie("url_cn", "y", time()+360000);
    	         jump($url_cn);
	        }
	    }
	        
		 
	}	
	
 
	if (preg_match("/en/i", $lang)) {		
		  if(LANG<>'en')  {
		     // echo 'e1111';
		      if(@$_COOKIE['url_en']<>'y'){
		        
    	               
    	                setcookie("url_en", "y", time()+360000);
    	                 // echo 'en22222';
    	                 jump($url_en);
        	        }
        	    } 
		   
	}	
	
 
	
	if (preg_match("/ja/i", $lang)) {		
		 if(LANG<>'jp')  
		 {
		     if(@$_COOKIE['url_jp']<>'y'){
    	       
    	        setcookie("url_jp", "y", time()+360000);
    	         jump($url_jp);
	        }
	    } 
	}	
	
 
 