<?php

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

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

$time=time();

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

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

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