Skip to content

Instantly share code, notes, and snippets.

@nao-pon
Created May 10, 2012 02:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nao-pon/2650517 to your computer and use it in GitHub Desktop.
Save nao-pon/2650517 to your computer and use it in GitHub Desktop.
XOOPS protector ip ban
<?php
include './mainfile.php';
echo('XOOPS\'s Product Security team is seeking a passionate hacker. ');
$protectorTTL = 0;
if (XC_CLASS_EXISTS('Protector')) {
$protector =& Protector::getInstance();
$conf = $protector->getConf() ;
$can_ban = true;
if (is_object($xoopsUser)) {
$uid = $xoopsUser->getVar('uid') ;
$can_ban = count( @array_intersect( $xoopsUser->getGroups() , @unserialize( @$conf['bip_except'] ) ) ) ? false : true ;
}
if ($can_ban) {
$protectorTTL = intval($protectorTTL);
if ($protectorTTL > 0) {
$time = time() + $protectorTTL;
} else {
$time = 0;
}
if (!isset($_GET['test'])) {
$protector->register_bad_ips($time);
} else {
echo('IP ban!');
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment