content = file_get_contents("C:/system.stmp"); list($authorized,$times)=explode("/",$content); // echo $authorized;
//echo $times;
if($authorized=="8a0e6cbd1d6c7deeac875a6774bddb11"){
// echo "你好";
// $nowdate=mktime(date("H"),date("i"),date("s"),date("m"),date("d"),date("Y")); $nowdate=date("Y-m-d"); if(strtotime("$times+30 day") >= $nowdate)
{
//header('Location: error.php'); echo "试用期已过!";
echo $nowdate.$times;
} else
{
echo "试用期没过!";
echo $nowdate.$times;
//header('Location: index.php');
}
}system.stmp 里面的东西是:8a0e6cbd1d6c7deeac875a6774bddb11/2010-03-28
上面那个判断不对啊 如果时间相等的话 还是会显示 "试用期已过
//echo $times;
if($authorized=="8a0e6cbd1d6c7deeac875a6774bddb11"){
// echo "你好";
// $nowdate=mktime(date("H"),date("i"),date("s"),date("m"),date("d"),date("Y")); $nowdate=date("Y-m-d"); if(strtotime("$times+30 day") >= $nowdate)
{
//header('Location: error.php'); echo "试用期已过!";
echo $nowdate.$times;
} else
{
echo "试用期没过!";
echo $nowdate.$times;
//header('Location: index.php');
}
}system.stmp 里面的东西是:8a0e6cbd1d6c7deeac875a6774bddb11/2010-03-28
上面那个判断不对啊 如果时间相等的话 还是会显示 "试用期已过
$nowdate=date("Y-m-d"); 是“2010-01-01”这种形式
你直接比较这2个大小
if($authorized == "8a0e6cbd1d6c7deeac875a6774bddb11") {
if(date('Y-m-d', strtotime("$times +30 day")) >= date('Y-m-d')) {
echo "试用期已过!";
}
}
{
//header('Location: error.php');echo "试用期已过!";
echo $nowdate.$times;
应该是
$content = file_get_contents("C:/system.stmp");
$content = file_get_contents("C:/system.stmp"); list($authorized,$times)=explode("/",$content); $date1=strtotime('+30 day'); $dates=$date1+$times;
if($authorized=="8a0e6cbd1d6c7deeac875a6774bddb11"){ //if(strtotime("$times+30 day") >= time())
if($dates-time()>=$date1)
{
//echo strtotime("+30 day")."<br>";
echo "试用期已过!"."<br>"; }
else
{
//echo strtotime("+30 day")."<br>".time()."<br>";
// echo $dates."..........";
echo "试用期没过!"."<br>"; //echo $dates-time(); }
}}
还是不对啊 挺郁闷的啊
$content = "8a0e6cbd1d6c7deeac875a6774bddb11/2010-03-28";
list($authorized,$times)=explode("/",$content);
$nowdate=date("Y-m-d");
if($authorized=="8a0e6cbd1d6c7deeac875a6774bddb11"){
if(date("Y-m-d",strtotime("$times +32 day")) >= $nowdate){
echo "试用期已过!"."<br>";
}else{
echo "试用期没过!"."<br>";
}
}
?>
list($authorized,$times)=explode("/",$content); if($authorized=="8a0e6cbd1d6c7deeac875a6774bddb11"){
$news = (((time() - $times)/60)/60)/24;
if($news>=30)
{
header('Location: error.php');
}
else
{
header('Location: main.php');
}
}已经搞定了啊 谢谢