社区所有版块导航
Python
python开源   Django   Python   DjangoApp   pycharm  
DATA
docker   Elasticsearch  
aigc
aigc   chatgpt  
WEB开发
linux   MongoDB   Redis   DATABASE   NGINX   其他Web框架   web工具   zookeeper   tornado   NoSql   Bootstrap   js   peewee   Git   bottle   IE   MQ   Jquery  
机器学习
机器学习算法  
Python88.com
反馈   公告   社区推广  
产品
短视频  
印度
印度  
Py学习  »  DATABASE

用户24小时按一次按钮?php-mysql

pumosep • 5 年前 • 1435 次点击  
<?php
$username = $_SESSION['username'];  
include('dbcon.php');   
if (isset($_POST['req'])) {

        $query = "SELECT requested FROM users WHERE username='$username' ";
        $result = mysqli_query($db, $query);
        $row = mysqli_fetch_array($result);
        if(empty($row['requested'])) {

    $request = mysqli_real_escape_string($db, $_POST['request']);
    $query = "INSERT INTO requests (username, airid) 
              VALUES('$username', '$request')";

    mysqli_query($db, $query);

    $query2 = "UPDATE users SET requested='1' WHERE username='$username'"; 
    mysqli_query($db, $query2); 
    // timer should go here i guess

    echo '<script>swal({title: "Great!", text: "We will process your request as soon as possible!", type: "success", buttonsStyling: false, heightAuto: false}).then(function(){ location.reload();});</script';    

        } else { 

            echo '<script>swal({title: "Whoa!", text: "You must wait 48 hours before requesting again!", type: "error", buttonsStyling: false, heightAuto: false}).then(function(){ location.reload();});</script'; 
}
}
?>  

如何在将users requested=设置为“1”后设置计时器,以便在24小时后,他的请求将不再是“1”,而是再次为“空”

对不起我的蹩脚英语

Python社区是高质量的Python/Django开发社区
本文地址:http://www.python88.com/topic/39783
 
1435 次点击  
文章 [ 1 ]  |  最新文章 5 年前