Файл: public_html/tours.php
Строк: 80
<?php
require_once './element_options/element_options.php';
if (!$user) { header('Location: /'); exit; }
$title = 'Турниры';
require_once './element_include/element_head.php';
require_once './element_include/element_header_user_true.php';
$count = mysql_result(mysql_query("SELECT COUNT(*) FROM `tours`"), 0);
$has = mysql_fetch_assoc(mysql_query("SELECT * FROM `tours` WHERE `user`='{$user['lost_id']}' LIMIT 1"));
$week = date('w') > 0 && date('w') < 6;
if (isset($_GET['write']) && empty($has) && $week)
{
if ($user['lost_money_gold'] > 9)
{
mysql_query("INSERT INTO `tours` (`user`) VALUES ('{$user['lost_id']}')");
update_money_exp($user, 0, 0, 0, -10);
}
header("Location: ?");
exit;
}
echo '<div class="nfl p5 mb5 mt5 small mlra">';
echo "<span class='lngreen'>Турнир - возможность проявить себя и показать, кто здесь сильнейший игрок. Турнир проводится с понедельника по пятницу каждой недели. За пять дней вам необходимо собрать в миссиях как можно больше кристаллов. Участие в турнире платное, а победитель получает призовой фонд.</span></div>";
if ($count > 0)
{
require_once './element_function/element_function_pagination.php';
$page = (isset($_GET['page']) AND is_numeric($_GET['page'])) ? (int)$_GET['page'] : 1;
$pagination = pagination(10, $page, $count);
$query = mysql_query("SELECT * FROM `tours` ORDER BY `id` DESC LIMIT $pagination[start], $pagination[num]");
echo "<center><span class='yellow1 bold'>Участников {$count} / Бюджет <img src='/images/icons/gold.png'>".($count * 10 / 2)."</span></center>";
$i = 10 * $page - 9;
while ($li = mysql_fetch_assoc($query))
{
$odd = (($i % 2) ? ' odd' : '');
$cache_user = cache_user($li['user']);
echo '<div class="ml5 mr5">
<a class="bl p5 block'.$odd.'" href="/user?id='.$cache_user['lost_id'].'">
<span class="small mb5 yellow1"><span class="white">'.$i.'.</span>
'.ikonka_user($cache_user['lost_race'], ((!empty($online[$cache_user['lost_id']])) ? 'online' : 'offline')).'
'.$cache_user['lost_login'].'</span> </a></div>';
$i++;
}
echo '<div>'.pagination_echo($pagination['page'],$pagination['total'],'/tours.php?page=').'</div>';
}
else
{
echo '<div class="cntr ccc">Нет никого</div>';
}
if (empty($has) && $week)
{
echo '<div class="cntr ccc"><a class="button w70 mt5" href="?write">Записатся за <img src="/images/icons/gold.png">10</a>
';
}
require_once './element_include/element_foot_user_true.php';