From b653494b151e111cced1aab105064fe021301bea Mon Sep 17 00:00:00 2001 From: misol Date: Sun, 1 Jul 2012 11:43:54 +0000 Subject: [PATCH] Issue 1816, Check if there is too much long before time login access, and if it is, re-count the access from one. git-svn-id: http://xe-core.googlecode.com/svn/branches/1.5.0@10814 201d5d3c-b55e-5fd7-737f-ddc643e51545 --- modules/member/lang/lang.xml | 2 +- modules/member/member.class.php | 27 +++++++++++++++++++++++++-- 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/modules/member/lang/lang.xml b/modules/member/lang/lang.xml index 1e4786a18..3d5aab329 100644 --- a/modules/member/lang/lang.xml +++ b/modules/member/lang/lang.xml @@ -2259,7 +2259,7 @@ Bạn có thể quản lý thành viên bằng cách tạo những nhóm mới, - + diff --git a/modules/member/member.class.php b/modules/member/member.class.php index 7fa87869a..80a343f46 100644 --- a/modules/member/member.class.php +++ b/modules/member/member.class.php @@ -350,8 +350,31 @@ $output = executeQuery('member.getLoginCountByIp', $args); if($output->data && $output->data->count) { - //update - $args->count = $output->data->count + 1; + // Create a member model object + $oMemberModel = &getModel('member'); + $config = $oMemberModel->getMemberConfig(); + + $last_update = $output->data->last_update; + $year = substr($last_update,0,4); + $month = substr($last_update,4,2); + $day = substr($last_update,6,2); + $hour = substr($last_update,8,2); + $min = substr($last_update,10,2); + $sec = substr($last_update,12,2); + $last_update = mktime($hour,$min,$sec,$month,$day,$year); + + $term = intval(time()-$last_update); + //update, if IP address access in a short time, update count. If not, make count 1. + if($term < $config->max_error_count_time) + { + $args->count = $output->data->count + 1; + } + else + { + $args->count = 1; + } + unset($oMemberModel); + unset($config); $output = executeQuery('member.updateLoginCountByIp', $args); } else