Beispiel #1
0
    function proxyban()
    {
        global $tpl_page;
        $this->AdministratorsOnly();
        $tpl_page .= '<h2>' . _gettext('Ban proxy list') . '</h2><br />';
        if (isset($_FILES['imagefile'])) {
            $bans_class = new Bans();
            $ips = 0;
            $successful = 0;
            $proxies = file($_FILES['imagefile']['tmp_name']);
            foreach ($proxies as $proxy) {
                if (preg_match('/.[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+.*/', $proxy)) {
                    $proxy = trim($proxy);
                    $ips++;
                    if ($bans_class->BanUser(preg_replace('/:.*/', '', $proxy), 'SERVER', 1, 0, '', 'IP from proxylist automatically banned', '', 0, 0, 1, true)) {
                        $successful++;
                    }
                }
            }
            management_addlogentry(sprintf(_gettext('Banned %d IP addresses using an IP address list.'), $successful), 8);
            $tpl_page .= $successful . ' of ' . $ips . ' IP addresses banned.';
        } else {
            $tpl_page .= '<form id="postform" action="' . KU_CGIPATH . '/manage_page.php?action=proxyban" method="post" enctype="multipart/form-data"> ' . _gettext('Proxy list') . '<input type="file" name="imagefile" size="35" accesskey="f" /><br />
			<input type="submit" value="' . _gettext('Submit') . '" />
			<br />' . _gettext('The proxy list is assumed to be in plaintext *.*.*.*:port or *.*.*.* format, one IP per line.') . '<br /><br /><hr />';
        }
    }