Что это будет делать он будет блокировать все спамеры за 10минут от затопления вашего сайта.
Как с помощью iptables, но менее безопасно, но эффективно работает.

                        
<?php
/*
@author InCube
@copyright 2013 Gnu gpl 3.0
@des Protect from spamming.
@usage create dir called iplog chmod 7777 and just put this code <?php require "PATH/TO/THIS/FILE/anti_dos.php";?> in main file
*/
class AntiIncubeDos
{
public $cookie;
public $othercookie;
public $iptime;
public $ippenalty = 600;
public $ipmaxvisit;
public $iplogdir = "./iplog/";
public $iplogfile = "iplog.dat";
public $ipfile;
public $oldtime;
public $time;
public $newtime;
public $oldref;
public $domain;

public function init()
{
$this->time = time();
$this->ipfile = substr(md5($_SERVER["REMOTE_ADDR"]), -2);
$this->cookie = $_COOKIE['RaiNran'];
$this->othercookie = $_COOKIE['RaiNRanOnline'];
$this->iptime = 10;
$this->ipmaxvisit = 10;
$this->oldtime = file_exists($this->iplogdir . $this->ipfile) ? filemtime($this->iplogdir . $this->ipfile) : 0;
$this->oldtime = $this->oldtime < $this->time ? $this->time : $this->oldtime;
$this->newtime = $this->oldtime + $this->iptime;
$this->block();
touch($this->iplogdir . $this->ipfile, $this->newtime);
}
public function block()
{
if ($this->newtime >= $this->time + $this->iptime * $this->ipmaxvisit) {
touch($this->iplogdir . $this->ipfile, $this->time + $this->iptime * ($this->ipmaxvisit - 1) + $this->ippenalty);
$this->oldref = $_SERVER['HTTP_REFERER'];
header("HTTP/1.0 503 Service Temporarily Unavailable");
header("Connection: close");
header("Content-Type: text/html");
?>
<html>
<head>
<title>503 Service temporary unavailable</title>
<style>
body
{
background-color:black;
color:white;
}
</style>
</head>

<body>
<h1>Temporary Access Denial</h1>
Too many quick page views from your IP address (You got more than <?= $this->ipmaxvisit ?> visits in <?= $this->iptime ?> seconds).<br/>
Ban will be lifted in: <?= $this->ippenalty ?> secs.
</body>
</html>
<?php
touch($this->iplogdir . $this->iplogfile);
$fp = fopen($this->iplogdir . $this->iplogfile, "a");
$this->domain = $_SERVER['HTTP_HOST'];
if ($fp) {
$this->useragent = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : "(User Agent: UNKNOWN)";
fwrite($fp, $_SERVER['REMOTE_ADDR'] . " " . date("Y-m-d H:i:s") . " " . $this->useragent);

// Continue code if ONLY its writtable
fclose($fp);
if ($_SESSION['reportedflood'] < 1 && ($this->newtime < $this->time + $this->iptime + $this->iptime * $this->ipmaxvisit)) {
// Do whatever you want here. Send mail or wtf i dunno.
}
}
touch($this->iplogdir . $this->ipfile, $this->newtime);

}
}
}
$dos = new AntiIncubeDos;
$dos->init();
?>
1 15 0
0

Нет фото
Man * 0.05
• 1 апр 2015, 11:26


не, зато я твоей мамке с ноги по ебалу дал, а потом выебал у тебя на горбу

0

Нет фото
KEKS * 0.77
• 27 мар 2015, 19:07


Man, мамке иди своей такое скажи

0

Нет фото
Man * 0.05
• 24 мар 2015, 03:02


хлеборезку зашей, уёба

0

Нет фото
KEKS * 0.77
• 23 мар 2015, 21:27


Man, сам ты фигня

0

Нет фото
Man * 0.05
• 21 мар 2015, 04:34


фигня какая то на файлах