php通过设置session有效期 避免用户误操作 原生php方法

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_27905477/article/details/79151983
 $id = $_POST['id'];

if (isset( id) && id!==”) {
// unset( S E S S I O N [ t i m e ] ) ; / / / / _SESSION[“time”][]=time();//存一次数组存取ok;
//数组存session;
// echo count( S E S S I O N [ t i m e ] ) ; / / / / e c h o ; / / e c h o _SESSION[“time”][“0”];
// echo “
”;
// var_dump( S E S S I O N [ t i m e ] ) ; i f ( c o u n t ( _SESSION[“time”])>2){
m i n u t e = ( t i m e ( ) _SESSION[“time”][“0”])/60;
// echo m i n u t e ; str_minute = substr( m i n u t e , 0 , s t r i p o s ( minute, “.”));//查下是几分钟了
// echo “
”;
// echo s t r m i n u t e ; i f ( str_minute>1){
array_splice( S E S S I O N [ t i m e ] , 0 , 1 ) ; / / sqldel = "delete from zzcms_userneed where id=' i d ; resdel = mysql_query( sqldel);              if(mysql_affected_rows()>0){ _SESSION[“time”][]=time();
echo ““;
}else{
echo ““;
}

      }else{
        echo "<script>alert('操作频繁,请稍后重试!')</script>";
      }
}else{
    $sqldel = "delete from zzcms_userneed where id='$id'";
    $resdel = mysql_query($sqldel);
    if(mysql_affected_rows()>0){
        $_SESSION["time"][]=time();
        echo "<script>alert('删除成功!')</script>";
    }else{
        echo "<script>alert('删除失败,请联系网站管理员!')</script>";
    }  
}

}

猜你喜欢

转载自blog.csdn.net/qq_27905477/article/details/79151983
0条评论
添加一条新回复