Размер файла: 2.84Kb
<?php
#-----------------------------------------------------#
# ********* WAP-MOTORS ********* #
# Made by : VANTUZ #
# E-mail : [email protected] #
# Site : http://pizdec.ru #
# WAP-Site : http://visavi.net #
# ICQ : 36-44-66 #
# Вы не имеете право вносить изменения в код скрипта #
#-----------------------------------------------------#
$http_referer = check($_SERVER['HTTP_REFERER']);
$request_uri = urldecode(check($_SERVER['REQUEST_URI']));
$request_uri=strtok($request_uri,'SID');
$logfiles = BASEDIR."local/datados/".$ip.".dat";
$hostname = gethostbyaddr($ip);
$datetime = date("Y-m-d / H:i:s");
$time = time();
$timenow = time()-60;
if(empty($http_referer)){$http_referer='Отсутствует';}
if($_SESSION['log']==""){$login=$config_guestsuser;}else{$login=$_SESSION['log'];}
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 && $config_doslimit>0) {
$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);
//----------------------------------------------------------------//
$logdat = BASEDIR."local/datalog/ban.dat";
$write = '|Заблокирован доступ для IP|IP: '.$ip.'|Время: '.$datetime.'|Хост: '.$hostname.'|Referer: '.$http_referer.'|Browser: '.$brow.'|URL: '.$request_uri.'|Пользователь: '.$login.'|';
$fp=fopen($logdat,"a+");
flock ($fp,LOCK_EX);
fputs($fp,"$write\r\n");
flock ($fp,LOCK_UN);
fclose($fp);
chmod ($fp, 0666);
chmod ($logdat, 0666);
$file=file($logdat);
$i = count($file);
if ($i>=$config_maxlogdat) {
$fp=fopen($logdat,"w");
flock ($fp,LOCK_EX);
unset($file[0],$file[1]);
fputs($fp, implode("",$file));
flock ($fp,LOCK_UN);
fclose($fp);
}}}
?>