Размер файла: 2.94Kb
<?php
#-----------------------------------------------------#
# ********* WAP-MOTORS WebMod ********* #
#-----------------------------------------------------#
# Original Made by : VANTUZ #
# E-mail : [email protected] #
# Site : http://pizdec.ru #
# WAP-Site : http://visavi.net #
# ICQ : 36-44-66 #
#-----------------------------------------------------#
# WebMod Made by : X-ray (Юрий) #
# E-mail : [email protected] #
# Site : http://city.zugdidi.us #
# WAP-Site : http://zugdidi.us #
#-----------------------------------------------------#
# Вы не имеете право вносить изменения в код скрипта #
#-----------------------------------------------------#
$http_referer = check($_SERVER['HTTP_REFERER']);
$request_uri = urldecode(check($_SERVER['REQUEST_URI']));
$logfiles = BASEDIR."local/datados/".$ip.".dat";
$logdat = BASEDIR."local/logfiles.dat";
$hostname = gethostbyaddr($ip);
$datetime = date("Y-m-d H:i:s");
$time = time();
$timenow = time()-60;
if(empty($http_referer)){$http_referer='Отсутствует';}
if ($opendir = opendir(BASEDIR."local/datados")) {
while (false !== ($doslog = readdir($opendir))) {
if ($doslog != "." and $doslog != "..") {
$file_array_time = file(BASEDIR."local/datados/$doslog");
$file_array_str= explode("|",$file_array_time[0]);
if ($file_array_str[1] < $timenow) {
unlink(BASEDIR."local/datados/$doslog");
}}}}
$write = '|'.$time.'|Время: '.$datetime.'|Хост: '.$hostname.'|Browser: '.$brow.'|Referer: '.$http_referer.'|URL: '.$request_uri.'|';
$fp=fopen($logfiles,"a+");
flock ($fp,LOCK_EX);
fputs($fp,"$write\r\n");
flock ($fp,LOCK_UN);
fclose($fp);
chmod ($fp, 0666);
chmod ($logfiles, 0666);
if (count(file($logfiles)) > $config_doslimit) {
$banlines=file(BASEDIR."local/ban.dat");
$bancount=count($banlines);
for ($bban=0; $bban<$bancount; $bban++) {
list(,$banbase)=explode("|",$banlines[$bban]); if ($ip == $banbase) {
$result="ok"; }}
if($result!="ok"){
$fp=fopen(BASEDIR."local/ban.dat","a+");
flock ($fp,LOCK_EX);
fputs($fp,"|$ip|\r\n");
fflush ($fp);
flock ($fp,LOCK_UN);
fclose($fp);
$write = '|1|Заблокирован доступ для IP: '.$ip.'|Время: '.$datetime.'|Хост: '.$hostname.'|Browser: '.$brow.'|Referer: '.$http_referer.'|URL: '.$request_uri.'|';
$fp=fopen($logdat,"a+");
flock ($fp,LOCK_EX);
fputs($fp,"$write\r\n");
flock ($fp,LOCK_UN);
fclose($fp);
$file=file($logdat);
$i = count($file);
if ($i>=$config_maxlogdat) {
$fp=fopen($logdat,"w");
flock ($fp,LOCK_EX);
unset($file[0]);
unset($file[1]);
fputs($fp, implode("",$file));
flock ($fp,LOCK_UN);
fclose($fp);
}}}
?>