<?php
header("Access-Control-Allow-Origin: *"); //全域名
header("Access-Control-Allow-Credentials: true"); //是否可以携带cookie
header("Access-Control-Allow-Methods: POST,GET,PUT,OPTIONS,DELETE"); //允许请求方式
header("Access-Control-Allow-Headers: X-Custom-Header"); //允许请求字段,由客户端决定
header("Content-Type: text/html; charset=utf-8"); //返回数据类型( text/html; charset=utf-8、 application/json; charset=utf-8 )
//header("Access-Control-Allow-Origin: //www.cha128.com");//指定域名访问 //CORS跨域支持post、get、put、options、delete方式,而jsonp跨域只支持get方式
function safe_replace($string) {
$string =strtolower($string); //转换小写
$string = str_replace('a','',$string);
$string = str_replace('b','',$string);
$string = str_replace('c','',$string);
$string = str_replace('d','',$string);
$string = str_replace('e','',$string);
$string = str_replace("f",'',$string);
$string = str_replace('g','',$string);
$string = str_replace('h','',$string);
$string = str_replace('i','',$string);
$string = str_replace('j','',$string);
$string = str_replace('k','',$string);
$string = str_replace('l','',$string);
$string = str_replace('m','',$string);
$string = str_replace('n','',$string);
$string = str_replace('o','',$string);
$string = str_replace('p','',$string);
$string = str_replace('q','',$string);
$string = str_replace('r','',$string);
$string = str_replace('s','',$string);
$string = str_replace('t','',$string);
$string = str_replace('u','',$string);
$string = str_replace('v','',$string);
$string = str_replace('w','',$string);
$string = str_replace('x','',$string);
$string = str_replace('y','',$string);
$string = str_replace('z','',$string);
return $string;
}
//判断偶数,是返回TRUE,否返回FALSE
function is_even($num){
return (is_numeric($num)&(!($num&1)));
}
$pagetitle ="车牌限行限号智能提醒";
$carid = isset($_GET['carid'])? htmlspecialchars($_GET['carid']) : '';
$carid =mb_substr($carid,0,6,'utf-8'); //截取前7个字符
$nowdate=date("Y-m-d");
$nowdate2="2020-01-04"; // 设置开始日期
$nowdate3="2020-02-04"; // 设置结束日期
?>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="renderer" content="webkit">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title><?php echo $pagetitle ?></title>
<!-- Bootstrap -->
<link href="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/css/bootstrap.min.css" rel="stylesheet">
<!-- HTML5 shim 和 Respond.js 是为了让 IE8 支持 HTML5 元素和媒体查询(media queries)功能 -->
<!-- 警告:通过 file:// 协议(就是直接将 html 页面拖拽到浏览器中)访问页面时 Respond.js 不起作用 -->
<!--[if lt IE 9]>
<script src="https://cdn.jsdelivr.net/npm/html5shiv@3.7.3/dist/html5shiv.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/respond.js@1.4.2/dest/respond.min.js"></script>
<![endif]-->
<style type="text/css">
.container {
max-width: 700px;
}
.header {
text-align: center;
}
.header-title {
margin-top: 0;
}
.panel-body span {
padding: 8px;
font-size: 16px;
}
</style>
</head>
<body>
<div class="container">
<div class="row clearfix">
<div class="col-md-12 column">
<div class="panel panel-default">
<div class="panel-heading">信息提示</div>
<div class="panel-body">
xxxxx关于发布重污染天气 临时交通管理措施的通告
</div>
</div>
<div class="alert alert-danger" role="alert">
<?php echo $nowdate2 ?> 0时起开始限行,此次限行直至解除橙色和红色预警为止。
</div>
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">
<?php echo $pagetitle ?>
</h3>
</div>
<div class="panel-body">
<p>
<?php
if ($carid=='')
{
//相等
echo "请填写您的车牌号<br>";
?>
<form action="" method="get">
<div class="form-group">
<label for="exampleInputEmail1">车牌:</label>
<input type="text" class="form-control" name="carid" placeholder="如:晋L16xx">
</div>
<button type="submit" class="btn btn-default">设置</button>微信收藏使用更方便.
</form>
<?php
exit;
}
//获取中文星期几:
$weekarray=array("日","一","二","三","四","五","六"); //先定义一个数组
$weekarray2=array("7","1","2","3","4","5","6"); //先定义一个数组
?>
<span class="label label-info"><?php echo "今天是 " . date("Y-m-d")." 星期".$weekarray[date("w")]; ?></span><br><br>
<?php
if(strtotime($nowdate) > strtotime($nowdate3))
{
?>
<span class="label label-success">已过限行期,所有车辆不限行</span>
<?php
exit;
}
if(strtotime($nowdate) < strtotime($nowdate2))
{
?>
<span class="label label-success">限行期外</span><br><br>
<?php
//exit;
$kg=0;
}
else
{
$kg=1;
}
if ($kg==1) {
$carid2= substr( safe_replace($carid), -1,1);
//echo $carid2;
// 判断车牌双号单号
if (is_even($carid2)){
$ts1="双号";
}
else
{
$ts1="单号";
}
if (is_even($weekarray2[date("w")])){
$ts2="双号";
}
else
{
$ts2="单号";
}
if ($ts1==$ts2){
$ts3= '<span class="label label-danger">今日限行</span>';
}
else
{
$ts3= '<span class="label label-success">今日不限行</span>';
}
?>
<span class="label label-primary"><?php echo "车牌: ".strtoupper($carid)." ".$ts1." ".$ts3 ?></span>
<!--<span class="label label-danger">请注意当前时间在限行期内</span><br><br>-->
<?php }?>
</p>
</div>
</div><!--/panel-->
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">
设置车牌
</h3>
</div>
<div class="panel-body">
<form action="" method="get">
<div class="form-group">
<label for="exampleInputEmail1">车牌:</label>
<input type="text" class="form-control" name="carid" placeholder="车牌" value="<?php echo $carid?>">
</div>
<button type="submit" class="btn btn-default">设置</button> 微信收藏使用更方便.
</form>
</div>
</div><!--/panel-->
</div>
</div>
<div style="height: 10px"></div>
<footer class="footer">
<div align="center">
<p>
<span>www.txttool.com</span>
</p>
</div>
</footer>
</div>
<!-- jQuery (Bootstrap 的所有 JavaScript 插件都依赖 jQuery,所以必须放在前边) -->
<script src="https://cdn.jsdelivr.net/npm/jquery@1.12.4/dist/jquery.min.js"></script>
<!-- 加载 Bootstrap 的所有 JavaScript 插件。你也可以根据需要只加载单个插件。 -->
<script src="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/js/bootstrap.min.js"></script>
<div style=display:none;><script type=text/javascript src=https://js.users.51.la/5625900.js></script></div>
</body>
</html>
如果文章或资源对您有帮助,欢迎打赏作者。一路走来,感谢有您!
txttool.com 说一段 esp56物联 查询128 IP查询