Файл: sumerki.mobi/sumerki.mobi/ddos.php
Строк: 44
<?
//////////////////////////////////////////////////////////////
//////////////////////Онлайн игра "Сумерки"///////////////////
//////////////////////Основатель: Mc Laren////////////////////
///////////////////Контакты: ICQ - 597687549//////////////////
/////////////////////Пример: Sumerki.Mobi/////////////////////
///////////Если ты это читаешь, значит скрипт слили :D////////
//////////////////////////////////////////////////////////////
/*
$address = $_SERVER['REMOTE_ADDR'];
$ref = $_SERVER['HTTP_REFERER'];
$url = urldecode($_SERVER['REQUEST_URI']);
$limit = $config["ddoslimit"]; //Лимит запросов в секунду
$timenow = time();
$browser = $_SERVER['HTTP_USER_AGENT'];
$htaccess = $_SERVER['DOCUMENT_ROOT']."/.htaccess";
$dirfiles = $_SERVER['DOCUMENT_ROOT']."/temp/";
$logfiles = "$dirfiles".$address;
$hostname = gethostbyaddr($address);
$datetime = date("Y-m-d H:i:s");
$ip1 = getenv("HTTP_X_FORWARDED_FOR");
$ip2 = getenv("REMOTE_ADDR");
$hostip1 = gethostbyaddr($ip1);
$hostip2 = gethostbyaddr($ip2);
if ($ip1 != $ip2) {
$htstring = NULL;
if (!empty($ip1)) {
preg_match_all('/[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}/', $ip1, $ip1);
$ip1 = array_unique($ip1[0]);
foreach ($ip1 as $v) {
$htstring.="Deny from ".$v." \\ Заблокирован Внутренний IP \\ $hostip1rn";
}
}
if (!empty($ip2)) {
$htstring.="Deny from ".$ip2." \\ Заблокирован IP Proxy \\ $hostip2rn";
}
} else {
$htstring = "Deny from ".$address." \\ Заблокирован Внешний IP \\ $hostnamern";
}
$excludes = array(
"yandex.ru",
"rambler.ru",
"googlebot.com",
);
if ($opendir = opendir($dirfiles)) {
while (false !== ($log = readdir($opendir))) {
if ($log != "." and $log != "..") {
$timelog = date(filemtime("$dirfiles"."$log"));
if ($timelog < ($timenow - 1)) {
unlink("$dirfiles"."$log");
}
}
}
}
foreach ($excludes as $v) {
if (ereg($v, $hostname)) {exit;}
}
if (!file_exists($logfiles)) {fopen($logfiles, "w+");}
$write = "$datetime - $hostname<br>Browser: $browser<br>Referer: $ref<br>URL: $url<br>rn";
if ($logfiles) {
if (is_writable($logfiles)) {
if (!$handle = fopen($logfiles, 'a')) {exit;}
if (fwrite($handle, $write) === FALSE) {exit;}
fclose($handle);
}
}
if ((count(file($logfiles)) > $limit) and ($timelog > ($timenow - 1))) {
if ($htaccess) {
foreach (file($htaccess) as $h) {
if ($h === $htstring) {
exit;
}
}
if (is_writable($htaccess)) {
if (!$handle = fopen($htaccess, 'a')) {exit;}
if (fwrite($handle, $htstring) === FALSE) {exit;}
fclose($handle);
}
}
}
*/
?>