我将我的php.ini中的默认时区从欧洲/柏林更改为另一个时区,突然我的登录限制锁定倒计时混乱了,它显示剩余的15分钟,但它正在计数而不是计数下来,请帮我解决。
限制代码:
<?php
$throttle = array(1 => 1, 10 => 2, 1000 => 'captcha');
$getfailedq = 'SELECT MAX(attempted) AS attempted FROM failed_logins';
$getfailed = $muc->prepare($getfailedq);
$getfailed->bindParam(1, $attempted);
$getfailed->execute();
if ($getfailed->rowCount() > 0) {
$row = $getfailed->fetch(PDO::FETCH_ASSOC);
$latest_attempt = (int) date('U', strtotime($row['attempted']));
$getfailedq = 'SELECT Count(*) AS failed FROM failed_logins WHERE attempted > Date_sub(Now(), INTERVAL 15 minute)';
$getfailed = $muc->prepare($getfailedq);
$getfailed->bindParam(1, $attempted);
$getfailed->execute();
if ($getfailed->rowCount() > 0) {
$row = $getfailed->fetch(PDO::FETCH_ASSOC);
$failed_attempts = (int) $row['failed'];
krsort($throttle);
foreach ($throttle as $attempts => $delay) {
if ($failed_attempts > $attempts) {
if (is_numeric($delay)) {
$remaining_delay = time() - $latest_attempt + $delay;
echo 'You must wait ' . $remaining_delay . ' seconds before your next login attempt';
} else {
echo "captcha";
}
break;
}
}
}
}
?>
答案 0 :(得分:0)
也许您的数据库仍在欧洲/柏林。
尝试编辑你my.cnf,添加此
default_time_zone=TIMEZONE