Файл: public_html/core/head.php
Строк: 273
<?php
if(empty($header)) $header = 'Равноправие, мобильная онлайн игра';
echo '
<html>
<head>
<meta http-equiv="content-type" content="application/xhtml+xml; charset=utf-8"/>
<meta http-equiv="Content-Style-Type" content="text/css" />
<link rel="shortcut icon" href="/images/favicon.ico">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" type="text/css" href="/css/desig.css">
<title> '.$header.' </title>
</head>
<body>
';
$t=microtime(1); //вставляем в шапку
dungeonMobAttacks();
demonsMobAttack();
startDemons();
$issetIPBan = $db->query("SELECT * FROM `ipban` WHERE `ip` = '".$_SERVER['REMOTE_ADDR']."'")->num_rows;
if($issetIPBan > 0)
{
echo '<div class="b">Ваш IP адрес заблокирован по причине флуда или спама!</div>';
exit;
}
$issetUABan = $db->query("SELECT * FROM `uaban` WHERE `ua` = '".$_SERVER['HTTP_USER_AGENT']."'")->num_rows;
if($issetUABan > 0)
{
echo '<div class="b">Ваш User-Agent заблокирован по причине флуда или спама!</div>';
exit;
}
if(isset($_GET['ref']))
{
$refIsset = $db->query("SELECT * FROM `users` WHERE `id` = '".fl($_GET['ref'])."'")->num_rows;
if($refIsset > 0) setcookie('ref',fl($_GET['ref']),time()+86400,'/');
redirect('/');
}
$gameStatus = $db->query("SELECT * FROM `events_config` WHERE `id` = '3'")->fetch_object();
if(isset($u))
{
if($gameStatus->status == 1 && $u['admin'] == 0 && strpos($_SERVER['REQUEST_URI'], 'maintenance') == false)
{
redirect('/maintenance');
}
}
if(isset($u)){
$nextLevel = $db->query("SELECT * FROM `levels` WHERE `level` = '".($u['level']+1)."'")->fetch_object();
if($u['exp'] >= $nextLevel->exp && $u['level'] < 90)
{
$remainingExp = $u['exp'] - $nextLevel->exp;
$db->query("UPDATE `users` SET `level` = `level` + '1', `exp`= '".$remainingExp."', `gold` = `gold` + '".$nextLevel->gems."' WHERE `id` = '".$u['id']."'");
$_SESSION['new_level'] = '<div class = "notif_level"></div><center>
<div class = "b-mini">Награда: <img src="/images/ic-gem.png" width="20px" height="20" alt="гемы" /> '.$nextLevel->gems.'</div></center>';
}
echo'
<div class="profile-nav">
<div class="profile-nav-inner">
<div class="profile-nav-left">
<span class="profile-nav-left-link">
<img src="/images/silver.png" alt="серебро" class="profile-nav-ava">
<div class="profile-nav-l-info">
<div><big><b>Серебро</b></big></div>
<div>'.getLastNumber($u['silver']).'</div>
</div>
</span>
</div>
<div class="profile-nav-center">
<span class="main-nav-link ">
<a href = "?"> <div class="repout-text">'.$u['level'].'ур.</div></a>
</span>
</div>
<div class="profile-nav-right">
<span class="profile-nav-right-link _lock">
<img src="/images/ic-gem.png" alt="гемы" class="profile-nav-div">
<div class="profile-nav-r-info">
<div><big><b>Гемы</b></big></div>
<div>'.getLastNumber($u['gold']).'</div>
</div>
</span>
</div>
</div>
</div>';
if(isset($u))
{
$expProgress = round(($u['exp']*100)/$nextLevel->exp);
if($expProgress > 100) $expProgress = 100;
?>
<div class="t h-bar">
<tbody>
<div class="row">
<div class="cell">
<div style="height: 20px; background: #343434; border: 0px solid #000; background: #171410; position:relative; border-radius: 0px">
<div style="height: 20px;background: #fba41b; width:<?=$expProgress;?>%; max-width:100%; position: absolute; left: 0px; top: 0px; border-radius: 0px; border-bottom-right-radius: 0px;border-top-right-radius: 0px;">
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</tbody>
</div>
</div>
<?
}
if(isset($_SESSION['new_level']))
{
echo $_SESSION['new_level'];
unset($_SESSION['new_level']);
}
if(isset($_SESSION['message']))
{
echo '<div class="b">'.$_SESSION['message'].'</div>';
unset($_SESSION['message']);
}
$ban = $base -> query("SELECT * FROM `ban` WHERE `id_user` = '".$u['id']."' AND `time_ban` > '".time()."' ORDER BY `id` DESC LIMIT 1");
if($ban->num_rows > 0)
{
$ban = $ban->fetch_assoc();
if($ban['blocked'] == 'mute')
{
echo '<div class = "notice_container">
<div class = "gborder notice_alert alert-success">
<center>
Вы забанены! До окончания: '.tl($ban['time_ban']-time()).'!
</center>
</div>
</div>';
}
elseif($ban['blocked'] == 'all')
{
if($ban['blocked'] == 'all') $bans = 'заблокированы';
else $bans = 'заткнуты';
echo '<div class="line"></div>';
echo '<div class="b txt bradius">';
echo '<font color="red"> Вы '.$bans.' за нарушение правил сайта. </font> <br/>';
echo 'Окончание: '.tm($ban['time']).' <br/>';
echo 'Заблокировал(а): '.who($ban['id_ban']).' <br/>';
echo 'Причина: '.fl($ban['reason']).'';
echo '</div>';
include_once ('foot.php');
die();
}
}
$playerIP = fl($_SERVER['REMOTE_ADDR']);
$playerUA = fl($_SERVER['HTTP_USER_AGENT']);
if(isset($u))
{
if($u['ua'] != $playerUA || $u['ipus'] != $playerIP) $db->query("UPDATE `users` SET `ipus` = '".$playerIP."', `ua` = '".$playerUA."' WHERE `id` = '".$u['id']."'");
}
if($u['save_IP'] == 1 && $playerIP == $u['ip']){
echo '<div class="line"></div>';
echo '<div class="b txt bradius">';
echo '<font color="red"> Ваш IP адрес и IP адрес профиля не сходятся. </font> <br/>';
echo '</div>';
include_once 'foot.php';
die();
}
$db->query("UPDATE `users` SET `date_online` = '".(time()+14400)."' WHERE `id` = '".$u['id']."'");
$notReadMessages = $db->query("SELECT * FROM `mail_messages` WHERE `user2` = '".$u['id']."' AND `read` = '0'")->num_rows;
if($notReadMessages > 0)
{
echo '<center><a href="/mail" class="link">'.$notReadMessages.' новых сообщений</a></center>';
}
if($u['alliance_id'] == 0)
{
$invitesInAlliance = $db->query("SELECT * FROM `alliance_invites` WHERE `user` = '".$u['id']."'")->num_rows;
if($invitesInAlliance > 0)
{
echo '<center><a href="/alliance/invites" class="link">'.$invitesInAlliance.' новых приглашений в альянс</a></center>';
}
}
if($u['alliance_id'] > 0)
{
$alliance = $db->query("SELECT * FROM `alliances` WHERE `id` = '".$u['alliance_id']."'")->fetch_object();
$allianceNextLevel = $db->query("SELECT * FROM `alliance_levels` WHERE `level` = '".($alliance->level+1)."'")->fetch_object();
$allianceLevelProgress = round(($alliance->exp*100)/$allianceNextLevel->exp);
if($alliance->exp >= $allianceNextLevel->exp && $alliance->level < 25)
{
$remainingAllianceExp = $alliance->exp - $allianceNextLevel->exp;
$db->query("UPDATE `alliances` SET `level` = `level` + '1', `exp` = '".$remainingAllianceExp."', `gems` = `gems` + '".$allianceNextLevel->gems."' WHERE `id` = '".$u['alliance_id']."'");
redirect('?');
}
$allianceMembersLimit = 8+2*$alliance->level+$alliance->altar_level;
}
}
if(isset($u))
{
addResources();
addQuest();
updateVipStatus();
checkReferals();
setUserStats();
ifNotExistTower();
}
if(isset($_GET['hide']))
{
$db->query("UPDATE `users` SET `read_news` = '0' WHERE `id` = '".$u['id']."'");
redirect('/', 'Новость скрыта!');
}
if($u['read_news'] > 0 && $_SERVER['REQUEST_URI'] == '/')
{
$newsInfo = $db->query("SELECT * FROM `forum_themes` WHERE `id` = '".$u['read_news']."'")->fetch_object();
echo '<div class="b">
<center>
<big>'.$newsInfo->name.'</big><br>
'.mb_strimwidth($newsInfo->text, 0, 100, '...').'<br>
<a href="/forum/'.$newsInfo->section_id.'/theme'.$newsInfo->id.'"><input type="submit" value="Читать"></a> <a href="?hide"><input type="submit" value="Скрыть"></a>
</center>
</div>';
}
if(isset($u))
{
if($u['tutorial'] < 15 && !in_array($u['tutorial'], [7,8,10,12,14,15]) && $u['save'] == 0)
{
if(strpos($_SERVER['REQUEST_URI'], 'tutorial') == false)
{
redirect('/tutorial/'.$u['tutorial']);
}
}
if($u['tutorial'] == 7)
{
include_once($root . '/modules/tutorial/header7.php');
if(strpos($_SERVER['REQUEST_URI'], 'shop') == false)
{
redirect('/shop');
}
}
if($u['tutorial'] == 8)
{
include_once($root . '/modules/tutorial/header8.php');
if(strpos($_SERVER['REQUEST_URI'], 'inventory') == false)
{
redirect('/inventory');
}
}
if($u['tutorial'] == 10)
{
include_once($root . '/modules/tutorial/header10.php');
if(strpos($_SERVER['REQUEST_URI'], 'caves') == false)
{
redirect('/caves');
}
}
if($u['tutorial'] == 12)
{
include_once($root . '/modules/tutorial/header12.php');
if(strpos($_SERVER['REQUEST_URI'], 'forge/slot_upgrade') == false)
{
redirect('/forge/slot_upgrade');
}
}
if($u['tutorial'] == 14)
{
include_once($root . '/modules/tutorial/header14.php');
if(strpos($_SERVER['REQUEST_URI'], 'save') == false)
{
redirect('/save');
}
}
}
if($u['alliance_id'] > 0) campaignUpdate($u['id'],4,4,1,[0],[0]);
$notReadNotification = $db->query("SELECT * FROM `notifications` WHERE `user`= '".$u['id']."' AND `read` = '0'")->num_rows;
if($notReadNotification > 0)
{
echo '<center><a class="link" href="/notifications">Уведомления (+'.$notReadNotification.')</a></center>';
}
$borrowing = $base -> query("SELECT * FROM `borrowing` WHERE `user` = '".$u['id']."' LIMIT 1") -> fetch_assoc();
if($borrowing && $borrowing['times'] < time()) {
$db->query("UPDATE `users` SET `gold` = ".($u['gold'] - $borrowing['cost'])." WHERE `id` = ".$u['id']."");
$db->query("DELETE FROM `borrowing` WHERE `user` = ".$u['id']."");
}
$bgbtl = $db->query("SELECT * FROM `battleground_battles` WHERE `id` = '" . $u['battleground_id'] . "'");
if($bgbtl->num_rows > 0 && strpos($_SERVER['REQUEST_URI'], 'battleground/battle') == false)
{
$bg = $bgbtl->fetch_object();
if($bg->status == 'battle') redirect('/battleground/battle');
}
$cpbtl = $db->query("SELECT * FROM `capture_battles` WHERE `status` = 'prepare' LIMIT 1");
if($cpbtl->num_rows > 0)
{
$cp = $cpbtl->fetch_object();
$cpMyPlayer = $db->query("SELECT * FROM `capture_players` WHERE `user` = '".$u['id']."' AND `battle` = '".$btl_battle->id."'")->num_rows;
if($cpMyPlayer > 0)
{
if($cp->status == 'battle' && strpos($_SERVER['REQUEST_URI'], 'capture/battle') == false) redirect('/capture/battle');
}
}
if(isset($u))
{
if(isset($_GET['hide_not']))
{
$db->query("UPDATE `users` SET `dungeon_result` = '' WHERE `id` = '".$u['id']."'");
redirect('?', 'Уведомление скрыто!');
}
if($u['dungeon_result'] != '')
{
echo '<div class="b">
'.$u['dungeon_result'].'<br>
<center><a href="?hide_not"><input type="submit" value="Скрыть"></a></center>
</div><div class="line"></div>';
}
if(isset($_GET['hide_demons']))
{
$db->query("UPDATE `users` SET `demons_result` = '' WHERE `id` = '".$u['id']."'");
redirect('?', 'Уведомление скрыто!');
}
if($u['demons_result'] != '')
{
echo '<div class="b">
'.$u['demons_result'].'<br>
<center><a href="?hide_demons"><input type="submit" value="Скрыть"></a></center>
</div><div class="line"></div>';
}
}
//echo '<div class="line"></div>';
?>