Home > php教程 > php手册 > body text

PHP判断时区判断浏览器语言

WBOY
Release: 2016-06-13 10:48:02
Original
1348 people have browsed it

PHP判断时区判断浏览器语言的黑帽代码。
剑在手了,就看使剑的人的剑道如何了,这段代码可以进一步改进,做到更加隐秘。我只是弄了个基本的出来,具体还得看客观您怎么用了。
 
//将时区设置为中国
date_default_timezone_set("PRC");
//例输出:2010-03-06 Saturday 11:51:29 AM
//echo date("Y-m-d l H:i:s A");
 
$time_hour = date("H");
echo $time_hour;
$lang = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 4); //只取前4位,这样只判断最优先的语言。如果取前5位,可能出现en,zh的情况,影响判断。
 
if($time_hour=18){
         echo "<script>";<br /> echo "window.location.href=&#39;http://www.BkJia.com&#39;";<br /> echo "</script>";
}elseif($time_hour>=8 && $time_hour          //非中文浏览器
         echo "<script>";<br /> echo "window.location.href=&#39;http://www.BkJia.com&#39;";<br /> echo "</script>";
}
else{
 
}
?>


摘自 .xssxss.com

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!