Файл: public_html/dev/head.php
Строк: 27
<?
ob_start();
list($msec,$sec)
= explode(chr(32), microtime());
$gtime = $sec+$msec;
?>
<!DOCTYPE html><html>
<head><title><?=$title?></title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel='stylesheet' href='/style.css'>
</head>
<body>
<?php
if(isset($_SESSION['result'])){
echo '<div class="session center">'.$_SESSION['result'].'';
unset($_SESSION["result"]);
echo '</div>';
}
echo '<div class="title center">'.$title.'</div>';
if($user) {
$exp_in = $user['level'] * 100;
$exp_progress = round(100/($exp_in/$user['exp']));
if($exp_progress > 100) {
$exp_progress = 100;
}
echo '<div class="exp"><div class="exp_in" style="width: '.$exp_progress.'%;"></div></div>';
$ip = $_SERVER['REMOTE_ADDR'];
mysql_query("update `users` set `online` = '".time()."', `ip` = '".$ip."' where `id` = '".$user['id']."'");
if($user['ban_time'] > time()) {
echo '<div class="block">Ваш персонаж временно заблокирован! <br> Разблокировка через: '.vremja($user['ban_time'] - time()).'</div>';
exit();
}
$mail = mysql_result(mysql_query('SELECT COUNT(*) FROM `mail` WHERE `to` = "'.$user['id'].'" AND `read` = "0"'),0);
if($mail > 0) {
echo '<a href="/mail.php" class="link"><img src="/img/mail.png"> Новая почта</a>';
}
if($user['exp'] >= $exp_in) {
mysql_query("update `users` set `gold` = `gold` + 50, `level` = `level` + 1, `exp` = 0 where `id` = '".$user['id']."'");
echo '<div class="block">Вы получили новый уровень! <br>Награда: 50 <img src="/img/gold.png"></div>';
echo '<a href="?" class="link">Продолжить игру</a>';
include ('./dev/foot.php');
exit();
}
if($user['health'] < $user['max_health']) {
$health = rand(0, $user['max_health'] - $user['health']);
$time_reg = time() + 10;
mysql_query("update `users` set `health` = `health` + '".$health."', `regen_health` = '".$time_reg."' where '".time()."' > '".$user['regen_health']."' && `id` = '".$user['id']."'");
}
}
?>