Просмотр файла forum/on/index.php

Размер файла: 1.87Kb
<?php
Error_Reporting(E_ALL & ~E_NOTICE);
Error_Reporting (ERROR | WARNING);

$maindir = $_SERVER['DOCUMENT_ROOT'];
include_once "$maindir/forum/includ/functions.php";
$OnlineDir="$maindir/forum/data/online";
$time = time();
$time=check($time);
$OnllineTime = $time-200;

$ip=check($_SERVER['REMOTE_ADDR']);

$agentx=check($_SERVER['HTTP_USER_AGENT']);
if(stristr($agentx,'(')){
$agentxx=explode("(",$agentx);
$agent = $agentxx[0];
$agent=str_replace("|", "", $agent);}else{$agent=$agentx;}

$referer=check($_SERVER['HTTP_REFERER']);

$mypagex = urldecode(htmlspecialchars(stripslashes($_SERVER['REQUEST_URI'])));
if(stristr($mypagex,'?')){
$mypagexx=explode("?",$mypagex);
$mypage = $mypagexx[0];
$mypage=str_replace("|", "", $mypage);}else{$mypage=$mypagex;}

$OnlineDate=check(date("Gч:iм:sсек"));

///////////////////////////		ЗАПИСЬ		/////////////////////////////

$text_onl = @file("$OnlineDir/$ip.log");
if($text_onl!=""){
$filetext = @file("$OnlineDir/$ip.log");
$on_dt = explode("|",$filetext[0]);

$ontext=$ip.'|'.$agent.'|'.$time.'|'.$on_dt[3].'|'.$mypage.'|'.$on_dt[5].'|';
$ontext=str_replace("\r\n", "", $ontext);
$fp_onl=@fopen("$OnlineDir/$ip.log","r+");
@ftruncate($fp_onl,0);
@fputs($fp_onl,"$ontext");
@fclose($fp_onl);
}else{
$ontext=$ip.'|'.$agent.'|'.$time.'|'.$referer.'|'.$mypage.'|'.$OnlineDate.'|';
$ontext=str_replace("\r\n", "", $ontext);
$fp_onl=@fopen("$OnlineDir/$ip.log","w");
@ftruncate($fp_onl,0);
@fputs($fp_onl,"$ontext");
@fclose($fp_onl);}

///////////////////////////		УДАЛЯЕМ / ВЫВОД		/////////////////////////////

$dir_onl=opendir("$OnlineDir");
while($file=readdir($dir_onl)){
if(($file != ".") && ($file != "..")){
$filetext = @file("$OnlineDir/$file");
$on_dt = explode("|",$filetext[0]);
if($on_dt[2]<$OnllineTime){ unlink("$OnlineDir/$file");}
}} closedir ($dir_onl);


?>