php不同頁面
發布時間: 2024-10-12 03:40:29
❶ php鏂版墜錛屾兂瀹炵幇鑳藉熷尯鍒嗘槸綆$悊鍛樿繕鏄鏅閫氱敤鎴風櫥闄嗭紝鐒跺悗榪涘叆涓嶅悓欏甸潰錛屼唬鐮佸備笅
$check_query = mysql_query("select S_number from ordinary_user where U_number='$UID' and U_password='$PWD' limit 1");
瀵規瘮涓
$check_query = mysql_query("select S_number from ordinary_user where U_number='{$UID}' and U_password='{$PWD}' limit 1");
$rs=mysql_query("select A_number from admin where A_number='$UID' and A_password='PWD' limit 1");
瀵規瘮涓
$rs=mysql_query("select A_number from admin where A_number='{$UID}' and A_password='{$PWD}' limit 1");
❷ php怎樣識別手機和電腦訪問分別跳轉到不同的頁面
//為true時就是手機訪問否則為PC
functionisMobile(){
//如果有HTTP_X_WAP_PROFILE則一定是移動設備
if(isset($_SERVER['HTTP_X_WAP_PROFILE']))
returntrue;
//如果via信息含有wap則一定是移動設備,部分服務商會屏蔽該信息
if(isset($_SERVER['HTTP_VIA'])){
//找不到為flase,否則為true
returnstristr($_SERVER['HTTP_VIA'],"wap")?true:false;
}
//腦殘法,判斷手機發送的客戶端標志,兼容性有待提高
if(isset($_SERVER['HTTP_USER_AGENT'])){
$clientkeywords=array('nokia','sony','ericsson','mot','samsung','htc','sgh','lg','sharp','sie-','philips','panasonic','alcatel','lenovo','iphone','ipod','blackberry','meizu','android','netfront','symbian','ucweb','windowsce','palm','operamini','operamobi','openwave','nexusone','cldc','midp','wap','mobile');
//從HTTP_USER_AGENT中查找手機瀏覽器的關鍵字
if(preg_match("/(".implode('|',$clientkeywords).")/i",strtolower($_SERVER['HTTP_USER_AGENT'])))
returntrue;
}
//協議法,因為有可能不準確,放到最後判斷
if(isset($_SERVER['HTTP_ACCEPT'])){
//如果只支持wml並且不支持html那一定是移動設備
//如果支持wml和html但是wml在html之前則是移動設備
if((strpos($_SERVER['HTTP_ACCEPT'],'vnd.wap.wml')!==false)&&(strpos($_SERVER['HTTP_ACCEPT'],'text/html')===false||(strpos($_SERVER['HTTP_ACCEPT'],'vnd.wap.wml')<strpos($_SERVER['HTTP_ACCEPT'],'text/html')))){
returntrue;
}
}
returnfalse;
}
熱點內容