1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-05 06:07:32 +02:00

New events user-ban-flood and user-ban-failed-login

This commit is contained in:
Cameron
2015-02-09 20:11:16 -08:00
parent cbf69d46c7
commit db62f8bdb9
2 changed files with 7 additions and 6 deletions

View File

@@ -541,8 +541,10 @@ class userlogin
$fails = $sql->count("generic", "(*)", "WHERE gen_ip='{$this->userIP}' AND gen_type='failed_login' "); $fails = $sql->count("generic", "(*)", "WHERE gen_ip='{$this->userIP}' AND gen_type='failed_login' ");
if($fails > 10) if($fails > 10)
{ {
$time = time();
e107::getIPHandler()->add_ban(4,LAN_LOGIN_18,$this->userIP,1); e107::getIPHandler()->add_ban(4,LAN_LOGIN_18,$this->userIP,1);
e107::getDb()->insert("generic", "0, 'auto_banned', '".time()."', 0, '{$this->userIP}', '{$extra_text}', '".LAN_LOGIN_20.": ".e107::getParser()->toDB($username).", ".LAN_LOGIN_17.": ".md5($ouserpass)."' "); e107::getDb()->insert("generic", "0, 'auto_banned', '".$time."', 0, '{$this->userIP}', '{$extra_text}', '".LAN_LOGIN_20.": ".e107::getParser()->toDB($username).", ".LAN_LOGIN_17.": ".md5($ouserpass)."' ");
e107::getEvent()->trigger('user-ban-failed-login', array('time'=>$time, 'ip'=>$this->userIP, 'other'=>$extra_text));
} }
} }
} }
@@ -558,10 +560,9 @@ class userlogin
*/ */
protected function logNote($title, $text) protected function logNote($title, $text)
{ {
$e107 = e107::getInstance();
$title = e107::getParser()->toDB($title); $title = e107::getParser()->toDB($title);
$text = e107::getParser()->toDB($text); $text = e107::getParser()->toDB($text);
$e107->admin_log->e_log_event(4, __FILE__."|".__FUNCTION__."@".__LINE__, "LOGIN", $title, $text, FALSE, LOG_TO_ROLLING); e107::getLog()->e_log_event(4, __FILE__."|".__FUNCTION__."@".__LINE__, "LOGIN", $title, $text, FALSE, LOG_TO_ROLLING);
} }
@@ -573,7 +574,6 @@ class userlogin
*/ */
protected function genNote($username, $msg1) protected function genNote($username, $msg1)
{ {
$e107 = e107::getInstance();
$message = e107::getParser()->toDB($msg1." ::: ".LAN_LOGIN_1.": ".$username); $message = e107::getParser()->toDB($msg1." ::: ".LAN_LOGIN_1.": ".$username);
e107::getDb()->insert("generic", "0, 'failed_login', '".time()."', 0, '{$this->userIP}', 0, '{$message}'"); e107::getDb()->insert("generic", "0, 'failed_login', '".time()."', 0, '{$this->userIP}', 0, '{$message}'");
} }

View File

@@ -218,9 +218,10 @@ class e_online
if ($row['online_pagecount'] > $online_bancount) if ($row['online_pagecount'] > $online_bancount)
{ {
include_lan(e_LANGUAGEDIR.e_LANGUAGE.'/admin/lan_banlist.php'); include_lan(e_LANGUAGEDIR.e_LANGUAGE.'/admin/lan_banlist.php');
if (TRUE === e107::getIPHandler()->add_ban(2,str_replace('--HITS--',$row['online_pagecount'],BANLAN_78),$ip,0)) if (true === e107::getIPHandler()->add_ban(2,str_replace('--HITS--',$row['online_pagecount'],BANLAN_78),$ip,0))
{ {
e107::getEvent()->trigger('flood', $ip); e107::getEvent()->trigger('flood', $ip); //BC
e107::getEvent()->trigger('user-ban-flood', $ip);
exit; exit;
} }
} }