Файл: cron.php
Строк: 21
<?php
define('NTOP', 1);
require_once ('system/connect.php');
require_once ('system/core.php');
require_once ('system/function.php');
$saits = mysql_query("SELECT * FROM `".$prefix."sait`");
while($row = mysql_fetch_array($saits)){
$all_hosts = $row['all_hosts']+$row['hosts'];
$all_hits = $row['all_hits']+$row['hits'];
$all_out = $row['all_out']+$row['out'];
$all_in = $row['all_in']+$row['in'];
$up1 = mysql_query("UPDATE `".$prefix."sait` SET `hits1` = '".$row['of_hits']."', `hits2` = '".$row['hits1']."', `hits3` = '".$row['hits2']."', `hits4` = '".$row['hits3']."', `hits5` = '".$row['hits4']."' WHERE `id` = '".$row['id']."'");
$up2 = mysql_query("UPDATE `".$prefix."sait` SET `hosts1` = '".$row['of_hosts']."', `hosts2` = '".$row['hosts1']."', `hosts3` = '".$row['hosts2']."', `hosts4` = '".$row['hosts3']."', `hosts5` = '".$row['hosts4']."' WHERE `id` = '".$row['id']."'");
$up = mysql_query("UPDATE `".$prefix."sait` SET `of_hosts` = '".$row['hosts']."', `of_hits` = '".$row['hits']."' WHERE `id` = '".$row['id']."'");
$update = mysql_query("UPDATE `".$prefix."sait` SET `hosts` = '0', `hits` = '0', `in` = '0', `out` = '0'");
mysql_query("TRUNCATE TABLE `".$prefix."hits`");
mysql_query("TRUNCATE TABLE `".$prefix."hosts`");
mysql_query("TRUNCATE TABLE `".$prefix."go`");
mysql_query("TRUNCATE TABLE `".$prefix."sait_online`");
mysql_query("OPTIMIZE TABLE `".$prefix."sait_online`");
mysql_query("OPTIMIZE TABLE `".$prefix."go`");
mysql_query("OPTIMIZE TABLE `".$prefix."hits`");
mysql_query("OPTIMIZE TABLE `".$prefix."hosts`");
mysql_query("OPTIMIZE TABLE `".$prefix."reputation`");
mysql_query("OPTIMIZE TABLE `".$prefix."sait`");
mysql_query("OPTIMIZE TABLE `".$prefix."users`");
}
$log = "Top Update: ".data(time())."rn";
$fp = fopen("top_log.ntop", "a");
fwrite($fp, $log);
fclose($fp);
?>