function ActionLog($last_info = 'default_action') { global $config, $bd_names; $ip = GetRealIp(); getDB()->ask("DELETE FROM `{$bd_names['action_log']}` " . "WHERE `first_time` < NOW() - INTERVAL {$config['action_time']} SECOND"); $sql = "INSERT INTO `{$bd_names['action_log']}` (IP, first_time, last_time, query_count, info) " . "VALUES (:ip, NOW(), NOW(), 1, :info) " . "ON DUPLICATE KEY UPDATE " . "`last_time` = NOW(), " . "`query_count` = `query_count` + 1, " . "`info` = :info2"; getDB()->ask($sql, array('info' => $last_info, 'ip' => $ip, 'info2' => $last_info)); $line = getDB()->fetchRow("SELECT `query_count` FROM `{$bd_names['action_log']}` " . "WHERE `IP`=:ip", array('ip' => $ip), 'num'); $query_count = (int) $line[0]; if ($query_count > $config['action_max']) { getDB()->ask("DELETE FROM `{$bd_names['action_log']}` WHERE `IP`=:ip", array('ip' => $ip)); RefreshBans(); $sql = "INSERT INTO {$bd_names['ip_banning']} (IP, time_start, ban_until, ban_type, reason) " . "VALUES (:ip, NOW(), NOW()+INTERVAL {$config['action_ban']} SECOND, '2', 'Many BD connections (" . $query_count . ") per time') " . "ON DUPLICATE KEY UPDATE `ban_type` = '2', `reason` = 'Many BD connections (" . $query_count . ") per time' "; getDB()->ask($sql, array('ip' => $ip)); } return $query_count; }
public function ShowIpBans($list) { global $bd_names; RefreshBans(); ob_start(); include $this->GetView('admin/ban/ban_ip_caption.html'); $result = getDB()->ask("SELECT * FROM `{$bd_names['ip_banning']}` ORDER BY ban_until DESC LIMIT " . 10 * ($list - 1) . ",10"); while ($line = $result->fetch()) { if (!isset($found)) { $found = true; include $this->GetView('admin/ban/ban_ip_header.html'); } $ban_ip = $line['IP']; $ban_start = $line['time_start']; $ban_end = $line['ban_until']; $ban_type = $line['ban_type']; $ban_reason = $line['reason']; include $this->GetView('admin/ban/ban_ip_string.html'); } if (!isset($found)) { include $this->GetView('admin/ban/ban_ip_not_found.html'); return ob_get_clean(); } include $this->GetView('admin/ban/ban_ip_footer.html'); $html = ob_get_clean(); $result = getDB()->fetchRow("SELECT COUNT(*) FROM `{$bd_names['ip_banning']}`", false, 'num'); $html .= $this->arrowsGenerator($this->work_skript, $list, $result[0], 10); return $html; }
break; } if ($modifed) { $message .= "<br />"; } } aExit(2, $message); } if ($input['method'] == 2) { $tmp_user = new User($input['id']); if ($tmp_user->id() and !strcmp($tmp_user->getVerificationStr(), $input['verificate'])) { $tmp_user->changeGroup(1); } exit(View::ShowStaticPage('mail_verification_ok.html', 'other/')); } RefreshBans(); $female = $input['female'] ? 1 : 0; if (!CanAccess()) { aExit(11, lng('IP_BANNED')); } if (empty($input['login']) || empty($input['pass']) || empty($input['repass'])) { aExit(1, lng('INCOMPLETE_FORM')); } if (!preg_match("/^[a-zA-Z0-9_-]+\$/", $input['login'])) { $rcodes[] = 2; } if (!preg_match("/^[a-zA-Z0-9_-]+\$/", $input['pass'])) { $rcodes[] = 3; } if (!preg_match("/^[a-zA-Z0-9_-]+\$/", $input['repass'])) { $rcodes[] = 4;