<?php
include_once('db.php');
//ONLINE
$timeout = time() - 3600;
$online = $db->query("SELECT `id` FROM `users` WHERE online > '$timeout'")->num_rows;
$db->query("Update game_data set online='$online'");
function BBcodeLog($msg)
{
$msg = preg_replace('#\[item](.*?)\[/item]#si', '{$1}', $msg);
$msg = preg_replace('#\[mob](.*?)\[/mob]#si', '{$1}', $msg);
$msg = preg_replace('#\[usr=([0-9]+)\](.*?)\[/usr]#si', '$2{$1}', $msg);
return $msg;
}
/*-----------========---------*/
$reqDndMapLog = $db->query("SELECT * FROM dnd_map_log order by id desc");
while($dsa=$reqDndMapLog->fetch_array()){
$lxy = explode(':',$dsa[cord]);
$map = $db->query("SELECT name from dnd_map where id='$lxy[0]' limit 1")->fetch_array();
$textDndMapLogFile .= '['.date("H:i:s j.n.Y", $dsa[time]).'] : '.BBcodeLog(htmlspecialchars_decode($dsa[text])).' : ['.$map[name].' '.$lxy[2].'-'.$lxy[3]."]\n\n";
}
$dndMapLogNameFile = PATH.'log/dnd_map_log_'.date('n_Y',time()).'.log';
$textDndMapLogFile .= file_get_contents($dndMapLogNameFile) . PHP_EOL;
file_put_contents($dndMapLogNameFile, $textDndMapLogFile);/*---------=============-----------*/
$reqOrenda = $db->query("SELECT `item`,`usr` from `vesh_item` where `orenda`>='1' and `orenda_time_end`<'".time()."'");
if ($reqOrenda->num_rows>0) {
while ($mag=$reqOrenda->fetch_array()) {
$db->query("DELETE from `vesh_item` where `item`='$mag[item]' limit 1");
$db->query("UPDATE `users` set `time_vost_harak`='0' where `id`='$mag[usr]' limit 1");
}
}
$db->query("DELETE from `vesh_trade_area` where `orenda`>='1' and `orenda_time_end`<'".time()."'");
$db->query("DELETE from `vesh_sklad` where `orenda`>='1' and `orenda_time_end`<'".time()."'");
$db->query("DELETE from `vesh_sklad_side` where `orenda`>='1' and `orenda_time_end`<'".time()."'");
$timeVip = time();
$db->query("DELETE from `users_vip` where `day_end`<'$timeVip'");
?>
<?php
include_once('db.php');
//ONLINE
$timeout = time() - 3600;
$online = $db->query("SELECT `id` FROM `users` WHERE online > '$timeout'")->num_rows;
$db->query("Update game_data set online='$online'");
function BBcodeLog($msg)
{
$msg = preg_replace('#\[item](.*?)\[/item]#si', '{$1}', $msg);
$msg = preg_replace('#\[mob](.*?)\[/mob]#si', '{$1}', $msg);
$msg = preg_replace('#\[usr=([0-9]+)\](.*?)\[/usr]#si', '$2{$1}', $msg);
return $msg;
}
/*-----------========---------*/
$reqDndMapLog = $db->query("SELECT * FROM dnd_map_log order by id desc");
while($dsa=$reqDndMapLog->fetch_array()){
$lxy = explode(':',$dsa[cord]);
$map = $db->query("SELECT name from dnd_map where id='$lxy[0]' limit 1")->fetch_array();
$textDndMapLogFile .= '['.date("H:i:s j.n.Y", $dsa[time]).'] : '.BBcodeLog(htmlspecialchars_decode($dsa[text])).' : ['.$map[name].' '.$lxy[2].'-'.$lxy[3]."]\n\n";
}
$dndMapLogNameFile = PATH.'log/dnd_map_log_'.date('n_Y',time()).'.log';
$textDndMapLogFile .= file_get_contents($dndMapLogNameFile) . PHP_EOL;
file_put_contents($dndMapLogNameFile, $textDndMapLogFile);/*---------=============-----------*/
$reqOrenda = $db->query("SELECT `item`,`usr` from `vesh_item` where `orenda`>='1' and `orenda_time_end`<'".time()."'");
if ($reqOrenda->num_rows>0) {
while ($mag=$reqOrenda->fetch_array()) {
$db->query("DELETE from `vesh_item` where `item`='$mag[item]' limit 1");
$db->query("UPDATE `users` set `time_vost_harak`='0' where `id`='$mag[usr]' limit 1");
}
}
$db->query("DELETE from `vesh_trade_area` where `orenda`>='1' and `orenda_time_end`<'".time()."'");
$db->query("DELETE from `vesh_sklad` where `orenda`>='1' and `orenda_time_end`<'".time()."'");
$db->query("DELETE from `vesh_sklad_side` where `orenda`>='1' and `orenda_time_end`<'".time()."'");
$timeVip = time();
$db->query("DELETE from `users_vip` where `day_end`<'$timeVip'");
?>