Temos pavadinimas: WordPress, Shopify ir PHPFusion programuotojų bendruomenė :: Apsauga nuo dvigubu narių

Parašė sniuff· 2008 Sau. 12 15:01:32
#8

bet yra toks dalykas kad į saitą neįleistų su proxy.
tereikia ši kodą į panelę įdėti ir į tavo saitą leis tik vieną narį:
<?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();

?>




o gal ir į subheaderį nžn iš modų siato paėmiau

Redagavo sniuff· 2008 Sau. 12 15:01:52