Файл: cron_logs.php
Строк: 31
<?php
//parse logs for anather day
include_once("settings.php");
include_once("base.php");
include_once("constants.php");
include_once("common_func.php");
$base = new CBase($db);
$end_data=time()-ONE_DAY_SECOND;
//parse main logs
$sql = "select t1.pdate,t1.text,t2.name from logs_players as t1, data_player as t2 where pdate<=$end_data and t1.vnum=t2.vnum order by pdate asc";
$result = $base->execSQL($sql);
//try open file
$fl = gzopen($log_path."/common/".getDatesYear($end_data).".gz","w9");
if($fl==false){
echo("Error open file for logs");
return ;
}
while($row = $result->fetchRow())
{
gzwrite($fl,getTimes($row[0])." ".getDatesYear($row[0])." : ".$row[2]." : ".$row[1]."n");
}
gzclose($fl);
//clear all data
$sql = "delete from logs_players where pdate<=$end_data";
$base->execSQL($sql);
?>