Файл: index.php
Строк: 158
<?php
require 'sys/sid.php';
require 'sys/config.php';
include 'sys/user.php';
include 'sys/head.php';
if (isset($_GET['errorAut'])) err('Ошибка авторизации!');
if (!isset($_SESSION['us']) && !isset($_SESSION['ps']))
{
$numOnline = mysql_result(mysql_query("SELECT COUNT(*) FROM users WHERE onl + '300' > $rtime"), 0);
$numAll = mysql_result(mysql_query("SELECT COUNT(*) FROM users"), 0);
echo '
<div class="m">
<table style="width:100%;line-height: 50%">
<tr>
<td style="vertical-align:top;width:33%;border-right:solid; border-width:1px">
<a class="mlink" href="/recall.php">Забыли пароль ?</a>
</td>
<td style="vertical-align:top;width:33%;border-right:solid; border-width:1px">
<a class="mlink" href="/reg.php">Регистрация</a></td>
</tr>
</table>
</div>
<div style="text-shadow: 0 0 10px #0000FF;">Добро пожаловать в золотой мир Империи
Выбери свою сторону и покажи на что ты способен!
</div>
<div class="head">Вход в империю</div>
<form method="post" action="aut.php">
Логин:<br/>
<input type="text" name="us"/>
<br/>
Пароль : <br>
<input type="password" name="ps"/>
<br/>
<input type="submit" name="enter" value="Войти"/>
</form>
<br/>
Императоров в сети : [' . $numOnline . '] <br> Всего империй : [' . $numAll . ']
<br/>
</table>
';
}
else
{
visit(0, 'index');
if (isset($_GET['adv']))
{
$advisor = number($_GET['adv']);
if ($advisor == 1 && $user['advisor'] == 0)
{
mysql_query("UPDATE users SET advisor = '1' WHERE id = '$user[id]' LIMIT 1");
}
elseif ($advisor == 2 && $user['advisor'] == 2)
{
mysql_query("UPDATE users SET advisor = '3' WHERE id = '$user[id]' LIMIT 1");
}
elseif ($advisor == 4 && $user['advisor'] == 4) {
mysql_query("UPDATE users SET advisor = '5' WHERE id = '$user[id]' LIMIT 1");
}
header('location: /');
}
echo '<div style="margin:5px;">' . $user['nick'] . '
<u><a href="location'.$user['coor_x'].'_'.$user['coor_y'].'_2">['.$user['coor_x'].';'.$user['coor_y'].']</a></u></div>
' . separator;
if ($user['untouch'] > $rtime)
{
echo '<div style="padding:10px;"><b>Неприкосновенность еще ' . val($user['untouch'] - $rtime) . '</b></div>' . separator;
}
$BUILD = mysql_fetch_assoc(mysql_query("SELECT cid FROM construct WHERE user = '$user[id]' AND timeleft < '$rtime' LIMIT 1"));
if (!isset($BUILD['cid']) == 1 && $user['advisor'] == 1)
{
echo '<div style="padding:10px;"><b>Задание:</b> построить ферму.</div>' . separator;
}
if ($user['advisor'] == 3) {
echo '<div style="padding:10px;"><b>Задание:</b> Купить кольцо для власти .</div> <a href="/kolce'.$user['id'].'">ПРЕОБРЕСТИ КОЛЬЦО</a>' . separator;
}
$myb = mysql_query("SELECT * FROM construct WHERE user = '$user[id]' AND timeleft > '$rtime' LIMIT 1");
$is = mysql_fetch_assoc($myb);
if (mysql_num_rows($myb) != false)
{
switch($is['cid']):
case 1:
$name = '<img src="images/building_group_1_small.png" alt=""/> <a href="upgrade'.$is['id'].'">Ферма</a>';
break;
case 2:
$name = '<img src="images/building_group_2_small.png" alt=""/> <a href="upgrade'.$is['id'].'">Шахта</a>';
break;
case 3:
$name = '<img src="images/building_group_3_small.png" alt=""/> <a href="upgrade'.$is['id'].'">Лесопилка</a>';
break;
case 4:
$name = '<img src="images/building_group_4_small.png" alt=""/> <a href="upgrade'.$is['id'].'">Каменоломня</a>';
break;
case 5:
$name = '<img src="images/building_group_5_small.png" alt=""/> <a href="upgrade'.$is['id'].'">Прииск</a>';
break;
case 6:
$name = '<img src="images/building_group_6_small.png" alt=""/> <a href="upgrade'.$is['id'].'">Казарма</a>';
break;
case 7:
$name = '<img src="images/building_group_7_small.png" alt=""/> <a href="upgrade'.$is['id'].'">Торговая палата</a>';
break;
case 8:
$name = '<img src="images/building_group_8_small.png" alt=""/> <a href="upgrade'.$is['id'].'">Склад</a>';
break;
case 9:
$name = '<img src="images/building_group_9_small.png" alt=""/> <a href="upgrade'.$is['id'].'">Рынок</a>';
break;
case 10:
$name = '<img src="images/building_group_10_small.png" alt=""/> <a href="upgrade'.$is['id'].'">Кузница</a>';
break;
case 11:
$name = '<img src="images/building_group_11_small.png" alt=""/> <a href="upgrade'.$is['id'].'">Дипломатический центр</a>';
break;
case 12:
$name = '<img src="images/building_group_12_small.png" alt=""/> <a href="upgrade'.$is['id'].'">Цитадель</a>';
break;
case 13:
$name = '<img src="images/building_group_13_small.png" alt=""/> <a href="upgrade'.$is['id'].'">Бастион</a>';
break;
case 14:
$name = '<img src="images/building_group_14_small.png" alt=""/> <a href="upgrade'.$is['id'].'">Караульная башня</a>';
break;
endswitch;
if ($user['timeleft'] < $rtime)
{
mysql_query("UPDATE users SET timeleft = '" . ($rtime + $is['stamp']) . "' WHERE id = '$user[id]' LIMIT 1");
header('location: /');
}
$current = $rtime - $user['timeleft'];
if ($current <= $is['stamp'])
{
echo $name . ' [<img src="images/build.png" alt=""/> ' . round(($current + $is['stamp']) * 100 / $is['stamp'], 1) . '%..]';
}
}
$myb = mysql_query("SELECT * FROM construct WHERE user = '$user[id]' AND timeleft < '$rtime' ORDER BY timeleft ASC");
$myb2 = mysql_query("SELECT * FROM construct WHERE user = '$user[id]' AND timeleft > '$rtime'");
$a = 1;
echo '<table cellpadding="3" cellspacing="5">
<tr>';
while($is = mysql_fetch_assoc($myb))
{
switch($is['cid']):
case 1:
$name = '<img src="images/building_group_1_small.png" alt=""/> <a href="upgrade'.$is['id'].'">Ферма</a>';
break;
case 2:
$name = '<img src="images/building_group_2_small.png" alt=""/> <a href="upgrade'.$is['id'].'">Шахта</a>';
break;
case 3:
$name = '<img src="images/building_group_3_small.png" alt=""/> <a href="upgrade'.$is['id'].'">Лесопилка</a>';
break;
case 4:
$name = '<img src="images/building_group_4_small.png" alt=""/> <a href="upgrade'.$is['id'].'">Каменоломня</a>';
break;
case 5:
$name = '<img src="images/building_group_5_small.png" alt=""/> <a href="upgrade'.$is['id'].'">Прииск</a>';
break;
case 6:
$name = '<img src="images/building_group_6_small.png" alt=""/> <a href="upgrade'.$is['id'].'">Казарма</a>';
break;
case 7:
$name = '<img src="images/building_group_7_small.png" alt=""/> <a href="upgrade'.$is['id'].'">Торговая палата</a>';
break;
case 8:
$name = '<img src="images/building_group_8_small.png" alt=""/> <a href="upgrade'.$is['id'].'">Склад</a>';
break;
case 9:
$name = '<img src="images/building_group_9_small.png" alt=""/> <a href="upgrade'.$is['id'].'">Рынок</a>';
break;
case 10:
$name = '<img src="images/building_group_10_small.png" alt=""/> <a href="upgrade'.$is['id'].'">Кузница</a>';
break;
case 11:
$name = '<img src="images/building_group_11_small.png" alt=""/> <a href="upgrade'.$is['id'].'">Дипломатический центр</a>';
break;
case 12:
$name = '<img src="images/building_group_12_small.png" alt=""/> <a href="upgrade'.$is['id'].'">Цитадель</a>';
break;
case 13:
$name = '<img src="images/building_group_13_small.png" alt=""/> <a href="upgrade'.$is['id'].'">Бастион</a>';
break;
case 14:
$name = '<img src="images/building_group_14_small.png" alt=""/> <a href="upgrade'.$is['id'].'">Караульная башня</a>';
break;
endswitch;
echo '<td>' . $name . '</td>' . (++$a % 2 ? '</tr><tr>' : '');
}
echo '</tr></table>';
if (mysql_num_rows($myb) != false || mysql_num_rows($myb2) != false) echo separator;
echo '<table cellpadding="3" cellspacing="5">
<tr>
<td>
<img src="images/build.png" alt="."/> <a href="build.php">Построить здание</a>
</td>
<td>
<img src="images/extraction.png" alt="."/> <a href="extraction.php">Добыча</a>
</td>
</tr>
<tr>
<td>
<img src="images/forum.png" alt="."/> <a href="forum.php">Форум</a>
</td>
<td>
<img src="images/rating.png" alt="."/> <a href="rating.php">Рейтинг</a>
</td>
</tr>
<tr>
<td>
<img src="images/help.png" alt="."/> <a href="help.php">Справка</a>
</td>
<td>
<img src="images/settings.png" alt="."/> <a href="profile.php">Профиль</a>
</td>
<tr>
<td>
<img src="images/prison.png" alt="."/> <a href="prison.php">Тюрьма</a>
</td>
<td>
<a href="logout.php"><img src="images/logout.png" alt="."/> Выход</a>
</td>
</tr>
</table>';
}
include 'sys/foot.php';
?>