您的位置:首页 > 编程语言 > PHP开发

PHP 实现半个月内只能提交一单数据

2015-07-03 22:40 633 查看
//判断本月该手机提交次数
$telnum=sql("s", "list", "time", "where tel=".$_POST['tel']." order by id desc");
if($telnum){
$telrow=firstrow($telnum);
$one = strtotime($telrow['time']);//开始时间 时间戳
$tow = strtotime(date('Y-m-d H:i:s'));//结束时间 时间戳
$cle = $tow - $one; //得出时间戳差值
$d = floor($cle/3600/24); //得到天数
if($d < 15){
echo "<script>alert('半个月内此手机号码只能提交一次!'); history.back(); </script>";
exit();
}
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: