出于某种原因,检查 current_time 变量是大于还是小于登录时间的测试由于某种原因是不正确的。我不确定我错过了什么。$user_data 对象的 lock_date 属性代表用户上次登录失败的确切日期时间。所以它总是继续处理代码并传递提交函数的其余部分。
在比较两次时,我考虑过在 if 语句中切换大于号,但对于这两次,我认为这没有意义。
有人有任何额外的想法吗?
$current_time = now();
$current_gmt_human_format = unix_to_human($current_time, TRUE, 'us');
/* Get user data from post username value */
$user_data = $this->users_model->get_by('username', $post_username);
if (count($user_data) > 0)
{
/* User was found in database */
if ($user_data->lock_date !== '0000-00-00 00:00:00')
{
/* User is locked out */
/* How long the user must wait to login */
$wait_time = 60 * 15;
/* Time user is able to login */
$time_to_login = strtotime($user_data->lock_date) + $wait_time;
//echo 'current time is...' . $current_time;
//echo '<br>';
//echo 'time to login is...' . $time_to_login;
//die();
if ($current_time < $time_to_login)
{
}
}
}
根据请求,这里是我拥有的数据。
current readable format is...2013-05-23 08:03:44 PM
current time is...1369353824
user lock out...1369310405
wait time is...900
time to login is...1369311305