我已经设置了这个代码,它似乎没有工作。基本上我在数据库中放置了一个时间戳,每当有人尝试提交某些东西时,我都会检查他们的 IP,然后他们最后一次提交时间戳基本上我需要确保在他们发布之前已经超过 30 分钟。这是我到目前为止的代码...
$ip = $_SERVER["REMOTE_ADDR"];
$chkquery = "SELECT * FROM faucet where ip='$ip' ORDER BY timestamp DESC LIMIT 1;";
$chk = mysql_query($chkquery) or die($chkquery."<br/><br/>".mysql_error());
while($row = mysql_fetch_array($chk, MYSQL_ASSOC)){
$timestamp = $row['timestamp'];
}
$timenow = time();
$chktime = strtotime($timestamp);
if($chktime <= ($timenow - 1800)) {
echo "Yay! It has been 30 minutes!";
} else {
echo "Wait! Its not been 30 minutes";
}
我需要更改/修复什么才能使其正常工作吗?非常感谢您的帮助!if 语句可能会被颠倒,但是 IDK,我也以 Yay 结束!不管是什么时间...