Created
May 10, 2012 02:16
-
-
Save nao-pon/2650517 to your computer and use it in GitHub Desktop.
XOOPS protector ip ban
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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