<?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”,而是“空”
对不起,我的英语太差了
1条答案
按热度按时间tjvv9vkg1#
考虑以下情况,它使用一分钟而不是一天作为约束的单位:
…大约一分钟后。。。
…几秒钟后。。。