At0m
Active Member
- Sep 10, 2011
- 101
- 40
AntiSulake Class
Creator: Leo "At0m" Xgr
Version: 1.0.0 [BETA]
About
Hi there... Inspired by leenster´s little script of avoid Sulake, i have created a class, more improved, that is compatible with all CMS´S. With this script you avoid that employees of the company register on your hotel.
How to Use
First, create a PHP file with the name antisulake.php and copy all the class code and than save it.
Example: How to work using UberCMS: Just put in the Global.php(The central file of the php classes) the code:
PHP:
$antiSulake = new AntiSulake();
Just this ? Yep´, it´s ready. You can make this in other´s CMS.
The Code
PHP:
/* Início das Classe */
class AntiSulake
{
/* ---------------------------------------------\
| AntiSulake Protection v1.0.0 [BETA] |
| --------------------------------------------- |
| Taken from upcoming At0m´s RetroCMS |
| Created by: Leo "At0m" Xgr - [email protected] |
\----------------------------------------------*/
/* Início - [ Atributos ] */
public $urlRedirect = "http://youfaileverything.org/"; /* YouFail Sulake */
public $protectionStatus = true; /* true = Website Protegido / false = Website Desprotegido */
private $currentHostname; /* Hostname do Visitante */
private $currentIp; /* Ip do Visitante */
private $blockedHosts = array("gate.sulake.com", "sulake.com"); /* Sites bloqueados de visitar */
/* Fim - [ Atributos ] */
/* Início - [ Construtor ] */
function __construct(){
if($this->protectionStatus){ if($this->getCurrentHostname()) { if($this->blockSulake() != false) { header('Location: '.$this->urlRedirect.''); } } }
}
/* Fim - [ Construtor ] */
/* Início - [ Métodos ] */
private function getCurrentHostname(){
/* Requerimento de Informações */
if(getenv("HTTP_CLIENT_IP")){ $ip = getenv("HTTP_CLIENT_IP");}
else if(getenv("HTTP_X_FORWARDED_FOR")) { $ip = getenv("HTTP_X_FORWARDED_FOR"); }
else if(getenv("REMOTE_ADDR")) { $ip = getenv("REMOTE_ADDR"); }
else { $ip = "0.0.0.0"; }
/* Atribui o valor do Hostname/IP do visitante. */
$this->currentHostname = gethostbyaddr($ip);
$this->currentIp = $ip;
/* Encontramos algo ? */
if(empty($this->currentHostname) && empty($this->currentIp)){
return (boolean)false;
} return (bool)true;
}
public function blockSulake(){
$weLoveSusu = array();
/* Verifica primeiro se host possui algo com Sulake */
foreach($this->blockedHosts as $hosts){ if(strpos(strtolower($this->currentHostname), strtolower($hosts)) !== false){ $weLoveSusu[] = true; } }
if(count($weLoveSusu) > 0) { return (boolean)true; } return false;
}
/* Fim - [ Métodos ] */
}
/* Fim da Classe */
If you like it, please say loud, WE LOVE SUSU(Sulake) <3.