Размер файла: 955B
<?php
Error_Reporting(E_ALL & ~E_NOTICE);
Error_Reporting (ERROR | WARNING);
$agent=htmlspecialchars(stripslashes($_SERVER['REMOTE_ADDR']));
$count=@file("data/doss/$agent.dat");
$count =explode("|",$count[0]);
$time=time();
if($count[1]!=$time){
$count="0";
}else{
$count=$count[0]+1;}
$fp=fopen("data/doss/$agent.dat","a+");
flock($fp,LOCK_EX);
ftruncate($fp,0);
fputs($fp,"$count|$time");
fflush($fp);
flock($fp,LOCK_UN);
fclose($fp);
$file=@file("data/doss/$agent.dat");
$data =explode("|",$file[0]);
$times=time();
if($times==$data[1] && $data[0]>="7"){
$file=file(".htaccess");
$text='Deny from '.$agent.'';
$fp=fopen(".htaccess","a+");
flock($fp,LOCK_EX);
fputs($fp,"$text\r\n");
fflush($fp);
flock($fp,LOCK_UN);
fclose($fp);
}
?>