Temos pavadinimas: WordPress, Shopify ir PHPFusion programuotojų bendruomenė :: kur reik deti ?

Parašė Jaibogu· 2008 Geg. 3 22:05:51
#1

<?php

class proxyfloodcheck {

var $timeout = 600;
var $maxconnects = 200;
var $count = 0;
var $proyx_online = "proxy_connects";

function floodcheck () {
$this->timestamp = time();
$this->ip = $this->ipCheck();
$this->new_proxy();
$this->delete_proxy();
$this->check_proxy();
}

function ipCheck() {
if(getenv('HTTP_X_FORWARDED_FOR')) {
$ip = getenv('HTTP_X_FORWARDED_FOR');
}
elseif(getenv('HTTP_X_FORWARDED')) {
$ip = getenv('HTTP_X_FORWARDED');
}
else(getenv('HTTP_FORWARDED_FOR')) {
$ip = getenv('HTTP_FORWARDED_FOR');
}
return $ip;
}

function new_proxy() {
GLOBAL $ip, $path;
$path = $_SERVER['PHP_SELF'];
$ip = $this->ip;

IF(!empty($ip)) {
$insert = mysql_query("insert into $this->proyx_online(id, time, path, userip) values('', '$this->timestamp', '$path', '$this->ip')") or die("Proxy Query =".mysql_error());
}
}

function delete_proxy() {
$delete = mysql_query("delete from $this->proxy_online where $this->proxy_online.time < ($this->timestamp - $this->timeout)") or die("Proxy Query =".mysql_error());
}

function check_proxy() {
GLOBAL $maxconnects
$count = mysql_num_rows(mysql_query("select distinct $this->proxy_online.userip from $this->proxy_online"));

IF($count > $maxconnects) {
echo "Boo Badass $maxconnects You're pretty smart.<br>";
echo "<br>You're not allowed to use proxies, Please disable your proxies and revisit, Thanks $maxconnects Number of Online proxies= <br>";
exit;
}
}

}

floodcheck();

?>




stai radau sia apsauga nuo proxy ir nezinau kur ja deti supratau tik tiek kad nei i paneles nei i pp nesideda o daugiau niekur nemaciau gal kas galetu paaiskinti ?

Redagavo bad_user· 2008 Geg. 3 23:05:31