<?
include 'system.php';
$helka = mysql_query("SELECT id,health,max_health from `user` order by `id` desc");
while($m = mysql_fetch_assoc($helka)){
if($m['health'] + 0 > $m['max_health']){
mysql_query("UPDATE `user` set `health` = '".$m['max_health']."' where `id` = '".$m['id']."'");
}else{
mysql_query("UPDATE `user` set `health` = `health` + '0' where `id` = '".$m['id']."'");
}
}


$now = new Date();
$now.setTime((now.getTime()+now.getTimezoneOffset()*60*1000)+(3*60*60*1000));
$date = $now.getHours();
if($date == 1){
mysql_query("update `user` set `health` = '".$user['max_health']."' WHERE  `id` = '".$user['id']."' LIMIT 1");
}
if($date == 2){
mysql_query("update `user` set `health` = '".$user['max_health']."' WHERE  `id` = '".$user['id']."' LIMIT 1");
}
if($date == 3){
mysql_query("update `user` set `health` = '".$user['max_health']."' WHERE  `id` = '".$user['id']."' LIMIT 1");
}
if($date == 4){
mysql_query("update `user` set `health` = '".$user['max_health']."' WHERE  `id` = '".$user['id']."' LIMIT 1");
}
if($date == 5){
mysql_query("update `user` set `health` = '".$user['max_health']."' WHERE  `id` = '".$user['id']."' LIMIT 1");
}
if($date == 6){
mysql_query("update `user` set `health` = '".$user['max_health']."' WHERE  `id` = '".$user['id']."' LIMIT 1");
}
if($date == 7){
mysql_query("update `user` set `health` = '".$user['max_health']."' WHERE  `id` = '".$user['id']."' LIMIT 1");
}
if($date == 8){
mysql_query("update `user` set `health` = '".$user['max_health']."' WHERE  `id` = '".$user['id']."' LIMIT 1");
}
if($date == 9){
mysql_query("update `user` set `health` = '".$user['max_health']."' WHERE  `id` = '".$user['id']."' LIMIT 1");
}
if($date == 10){
mysql_query("update `user` set `health` = '".$user['max_health']."' WHERE  `id` = '".$user['id']."' LIMIT 1");
}
if($date == 11){
mysql_query("update `user` set `health` = '".$user['max_health']."' WHERE  `id` = '".$user['id']."' LIMIT 1");
}
if($date == 12){
mysql_query("update `user` set `health` = '".$user['max_health']."' WHERE  `id` = '".$user['id']."' LIMIT 1");
}
if($date == 13){
mysql_query("update `user` set `health` = '".$user['max_health']."' WHERE  `id` = '".$user['id']."' LIMIT 1");
}
if($date == 14){
mysql_query("update `user` set `health` = '".$user['max_health']."' WHERE  `id` = '".$user['id']."' LIMIT 1");
}
if($date == 15){
mysql_query("update `user` set `health` = '".$user['max_health']."' WHERE  `id` = '".$user['id']."' LIMIT 1");
}
if($date == 16){
mysql_query("update `user` set `health` = '".$user['max_health']."' WHERE  `id` = '".$user['id']."' LIMIT 1");
}
if($date == 17){
mysql_query("update `user` set `health` = '".$user['max_health']."' WHERE  `id` = '".$user['id']."' LIMIT 1");
}
if($date == 18){
mysql_query("update `user` set `health` = '".$user['max_health']."' WHERE  `id` = '".$user['id']."' LIMIT 1");
}
if($date == 19){
mysql_query("update `user` set `health` = '".$user['max_health']."' WHERE  `id` = '".$user['id']."' LIMIT 1");
}
if($date == 20){
mysql_query("update `user` set `health` = '".$user['max_health']."' WHERE  `id` = '".$user['id']."' LIMIT 1");
}
if($date == 21){
mysql_query("update `user` set `health` = '".$user['max_health']."' WHERE  `id` = '".$user['id']."' LIMIT 1");
}
if($date == 22){
mysql_query("update `user` set `health` = '".$user['max_health']."' WHERE  `id` = '".$user['id']."' LIMIT 1");
}
if($date == 23){
mysql_query("update `user` set `health` = '".$user['max_health']."' WHERE  `id` = '".$user['id']."' LIMIT 1");
}
if($date == 0){
mysql_query("update `user` set `health` = '".$user['max_health']."' WHERE  `id` = '".$user['id']."' LIMIT 1");
}
?>