0) or ((isset($_SERVER['HTTP_X_WAP_PROFILE']) or isset($_SERVER['HTTP_PROFILE'])))) { $mobile_browser++; } $mobile_ua = strtolower(substr($_SERVER['HTTP_USER_AGENT'], 0, 4)); $mobile_agents = array( 'w3c ','acs-','alav','alca','amoi','audi','avan','benq','bird','blac', 'blaz','brew','cell','cldc','cmd-','dang','doco','eric','hipt','inno', 'ipaq','java','jigs','kddi','keji','leno','lg-c','lg-d','lg-g','lge-', 'maui','maxo','midp','mits','mmef','mobi','mot-','moto','mwbp','nec-', 'newt','noki','palm','pana','pant','phil','play','port','prox', 'qwap','sage','sams','sany','sch-','sec-','send','seri','sgh-','shar', 'sie-','siem','smal','smar','sony','sph-','symb','t-mo','teli','tim-', 'tosh','tsm-','upg1','upsi','vk-v','voda','wap-','wapa','wapi','wapp', 'wapr','webc','winw','winw','xda ','xda-'); if (in_array($mobile_ua,$mobile_agents)) { $mobile_browser++; } if (strpos(strtolower($_SERVER['HTTP_USER_AGENT']),'opera mini') > 0) { $mobile_browser++; //Check for tablets on opera mini alternative headers $stock_ua = strtolower(isset($_SERVER['HTTP_X_OPERAMINI_PHONE_UA'])?$_SERVER['HTTP_X_OPERAMINI_PHONE_UA']:(isset($_SERVER['HTTP_DEVICE_STOCK_UA'])?$_SERVER['HTTP_DEVICE_STOCK_UA']:'')); if (preg_match('/(tablet|ipad|playbook)|(android(?!.*mobile))/i', $stock_ua)) { $tablet_browser++; } } if($_SESSION['temp']==''){ if ($tablet_browser > 0) { // do something for tablet devices // print 'is tablet'; $_SESSION['temp']='templates'; } else if ($mobile_browser > 0) { // do something for mobile devices // print 'is mobile'; $_SESSION['temp']='tempm'; } else { // do something for everything else //print 'is desktop'; $_SESSION['temp']='templates'; } } // tạm thời mặc định /////////////////////////////////////////// END CHUYỂN HƯỚNG WEBMOBILE //////////////////// /*rewrite URL*/ $domain="https://".$_SERVER['HTTP_HOST'].""; $ext = '.html'; //echo $_GET['modules']; $get_header_in_time = str_replace($ext,'',$_GET['modules']); $get_header_in_time = explode("/",$get_header_in_time); $begin_get_var = -1; $id = $get_header_in_time[$begin_get_var+1] ; $id_1 = $get_header_in_time[$begin_get_var+2] ; $id_2 = $get_header_in_time[$begin_get_var+3] ; $id_3 = $get_header_in_time[$begin_get_var+4] ; $id_4 = $get_header_in_time[$begin_get_var+5] ; $id_5 = $get_header_in_time[$begin_get_var+6] ; if($id=='desktop'){ $_SESSION['temp'] ="templates"; } elseif($id=='mobile'){ $_SESSION['temp'] ="tempm"; } elseif($id=='desktop_new'){ $_SESSION['temp'] ="templates_new"; } $modu= "modules"; if($_SESSION['temp']=='tempm'){ $modu= "modm"; } elseif($_SESSION['temp']=='templates_new'){ $modu= "modules_new"; } // Fill_link include("./library/fill_link". PHP_EX); $fill_link = new fill_links; // Template fill_links include("./library/class.Template.inc". PHP_EX); //Template $Tem = new Tem; //Run the module include("./".$modu."/global.php"); include("./".$modu."/header.php"); //Giữa if($_SESSION['temp']!='tempm'){ include("./".$modu."/left.php"); } if($id=='desktop' || $id=='mobile' || $id=='desktop_new' ){ header('Location:'.$domain); } $tag = strrpos($id,"-tag"); $ttag = strrpos($id,"-ttag"); $tki = strrpos($id,"-tki"); $dmtin = strrpos($id,"-dm"); $tinchitiet = strrpos($id,"-tt"); //include("./modules/header2.php"); // Vòng điwwù kiện if(intval($dmtin>0)){ include("./".$modu."/article_new.php"); } elseif(intval($ttag>0)){ include("./".$modu."/tag_tin_new.php"); } elseif(intval($tinchitiet>0)){ include("./".$modu."/article_new.php"); } elseif(intval($tag>0)){ include("./".$modu."/tag_new.php"); } elseif($id){ if($id=="tin-noi-that"){ include("./".$modu."/tag_tin.php"); } elseif($id=="noi-that"){ include("./".$modu."/tag.php"); } elseif($id=="tai-du-lieu-phan-mem"){ include("./".$modu."/tai-du-lieu-phan-mem.php"); } elseif($id=="tim-kiem"){ include("./".$modu."/search.php"); } elseif($id=="rem-manh"){ include("./".$modu."/product.php"); } elseif($id=="rem-cua"){ include("./".$modu."/menutop.php"); } elseif($id=="tin-rem"){ include("./".$modu."/article.php"); } elseif($id=="khach-hang"){ include("./".$modu."/khachhang.php"); } elseif($id=="gioi-thieu-rem-minh-dang"){ include("./".$modu."/gioithieuremminhdang.php"); } elseif($id=="lien-he"){ include("./".$modu."/contact.php"); } else{ include("./".$modu."/product_new.php"); } } else{ include("./".$modu."/main.php"); if($_SESSION['temp']!='tempm'){ include("./".$modu."/right.php"); } } /*// Kết thúc vòng điều kiện */ include("./".$modu."/footer.php"); ?>