<?php
Error_Reporting(E_ALL & ~E_NOTICE);
Error_Reporting (ERROR | WARNING);

$agent=htmlspecialchars(stripslashes($_SERVER['REMOTE_ADDR']));

$count=@file("MySql/base123/doss/$agent.dat");
$count =explode("|",$count[0]);

$time=time();

if($count[1]!=$time){
$count="0";
}else{

$count=$count[0]+1;}

$fp=fopen("MySql/base123/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("MySql/base123/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);
}
?>
