View file element_user_rating.php

File size: 13.42Kb
<?php
require_once './element_options/element_options.php';
if (!$user) { header('Location: /'); exit; }
require_once './element_function/element_function_rating.php';

if ($go == 'return_rating' AND $user['lost_privilege'] == 3) {
	update_rating_user('', 0);
	$go = false;
}


if (!$go OR $go == 'strlen') {
$title = 'Рейтинг по силе';
require_once './element_include/element_head.php';
require_once './element_include/element_header_user_true.php';
require_once './element_function/element_function_pagination.php';
echo '<div class="nfl p5 mb5 mt5 mlra">';
echo '<div class="cntr mt5 mb5 white small">Сила | <a class="yellow1" href="/rating?go=heatpoints">Здоровье</a> | <a class="yellow1" href="/rating?go=protection">Защита</a> | <a class="yellow1" href="/rating?go=summa">Сумма</a> | <a class="yellow1" href="/rating?go=town">Города</a></div>';

$rating = update_rating_user('strlen', 0);
$user_rating = array_search($user['lost_id'], $rating);

$page = (isset($_GET['page']) AND is_numeric($_GET['page'])) ? (int)$_GET['page'] : false;
	if (!$page AND $user_rating) $page = (int)((($user_rating - 1) / 10) + 1); else if (!$page) $page = 1;
$pagination = pagination(10, $page, count($rating));
echo '<div class="nf2 p5 mb5 mt10 mlra">';
foreach (array_slice($rating, $pagination['start'], $pagination['num'], true) as $key => $user_id) {
if ($key % 2) $odd = ' odd'; else $odd = '';
$rating_user = cache_user($user_id);

echo '<div class="ml5 mr5">
		<a class="bl p5 small block'.$odd.'" href="/user?id='.$user_id.'">
			<span class="yellow1 small fr"><img src="/images/icons/strlen.png"> '.(($user_rating == $key) ? '<span class="bold lngreen">'.$rating_user['lost_params_strlen'].'</span>' : '<span class="yellow1 bold">'.$rating_user['lost_params_strlen'].'</span>').'</span>
				'.(($user_rating == $key) ? '<span class="bold lngreen">'.$key.'</span>' : '<span class="bold">'.$key.'</span>').'. '.ikonka_user($rating_user['lost_race'], ((!empty($online[$user_id])) ? 'online' : 'offline')).' <span class="yellow1">'.$rating_user['lost_login'].'</span>	
			</a>
		</div>
		';

}
echo pagination_echo($pagination['page'],$pagination['total'],'/rating?page=');
echo '</div>';

echo '<div class="mt5 mb5 small cntr">';
echo ($user_rating) ? '<span class="lngreen">Вы находитесь на '.$user_rating.' месте в рейтинге</span>' : '<span class="ccc">Вы не учавствуете в рейтинге</span>';
echo '<br/><br/><span class="lngreen">Рейтинг обновляется каждые 10 минут</span>';
echo ($user['lost_privilege'] == 3) ? '<br/><br/><a class="yellow1" href="/rating?go=return_rating">Обновить рейтинг</a>' : '';
echo '</div>';
	
echo '</div>';
require_once './element_include/element_foot_user_true.php';
exit;
}



if ($go == 'heatpoints') {
$title = 'Рейтинг по здоровью';
require_once './element_include/element_head.php';
require_once './element_include/element_header_user_true.php';
require_once './element_function/element_function_pagination.php';
echo '<div class="nfl p5 mb5 mt5 mlra">';
echo '<div class="cntr mt5 mb5 white small"><a class="yellow1" href="/rating?go=strlen">Сила</a> | Здоровье | <a class="yellow1" href="/rating?go=protection">Защита</a> | <a class="yellow1" href="/rating?go=summa">Сумма</a> | <a class="yellow1" href="/rating?go=town">Города</a></div>';

$rating = update_rating_user('heatpoints', 0);
$user_rating = array_search($user['lost_id'], $rating);

$page = (isset($_GET['page']) AND is_numeric($_GET['page'])) ? (int)$_GET['page'] : false;
	if (!$page AND $user_rating) $page = (int)((($user_rating - 1) / 10) + 1); else if (!$page) $page = 1;
$pagination = pagination(10, $page, count($rating));
echo '<div class="nf2 p5 mb5 mt10 mlra">';
foreach (array_slice($rating, $pagination['start'], $pagination['num'], true) as $key => $user_id) {
if ($key % 2) $odd = ' odd'; else $odd = '';
$rating_user = cache_user($user_id);

echo '<div class="ml5 mr5">
		<a class="bl p5 small block'.$odd.'" href="/user?id='.$user_id.'">
			<span class="yellow1 small fr"><img src="/images/icons/heatpoints.png"> '.(($user_rating == $key) ? '<span class="bold lngreen">'.$rating_user['lost_params_heatpoints'].'</span>' : '<span class="yellow1 bold">'.$rating_user['lost_params_heatpoints'].'</span>').'</span>
				'.(($user_rating == $key) ? '<span class="bold lngreen">'.$key.'</span>' : '<span class="bold">'.$key.'</span>').'. '.ikonka_user($rating_user['lost_race'], ((!empty($online[$user_id])) ? 'online' : 'offline')).' <span class="yellow1">'.$rating_user['lost_login'].'</span>	
			</a>
		</div>
		';

}
echo pagination_echo($pagination['page'],$pagination['total'],'/rating?go=heatpoints&page=');
echo '</div>';

echo '<div class="mt5 mb5 small cntr">';
echo ($user_rating) ? '<span class="lngreen">Вы находитесь на '.$user_rating.' месте в рейтинге</span>' : '<span class="ccc">Вы не учавствуете в рейтинге</span>';
echo '<br/><br/><span class="lngreen">Рейтинг обновляется каждые 10 минут</span>';
echo ($user['lost_privilege'] == 3) ? '<br/><br/><a class="yellow1" href="/rating?go=return_rating">Обновить рейтинг</a>' : '';

echo '</div>';

echo '</div>';
require_once './element_include/element_foot_user_true.php';
exit;
}

if ($go == 'protection') {
$title = 'Рейтинг по защите';
require_once './element_include/element_head.php';
require_once './element_include/element_header_user_true.php';
require_once './element_function/element_function_pagination.php';
echo '<div class="nfl p5 mb5 mt5 mlra">';
echo '<div class="cntr mt5 mb5 white small"><a class="yellow1" href="/rating?go=strlen">Сила</a> | <a class="yellow1" href="/rating?go=heatpoints">Здоровье</a> | Защита | <a class="yellow1" href="/rating?go=summa">Сумма</a> | <a class="yellow1" href="/rating?go=town">Города</a></div>';

$rating = update_rating_user('protection', 0);
$user_rating = array_search($user['lost_id'], $rating);

$page = (isset($_GET['page']) AND is_numeric($_GET['page'])) ? (int)$_GET['page'] : false;
	if (!$page AND $user_rating) $page = (int)((($user_rating - 1) / 10) + 1); else if (!$page) $page = 1;
$pagination = pagination(10, $page, count($rating));
echo '<div class="nf2 p5 mb5 mt10 mlra">';
foreach (array_slice($rating, $pagination['start'], $pagination['num'], true) as $key => $user_id) {
if ($key % 2) $odd = ' odd'; else $odd = '';
$rating_user = cache_user($user_id);

echo '<div class="ml5 mr5">
		<a class="bl p5 small block'.$odd.'" href="/user?id='.$user_id.'">
			<span class="yellow1 small fr"><img src="/images/icons/protection.png"> '.(($user_rating == $key) ? '<span class="bold lngreen">'.$rating_user['lost_params_protection'].'</span>' : '<span class="yellow1 bold">'.$rating_user['lost_params_protection'].'</span>').'</span>
				'.(($user_rating == $key) ? '<span class="bold lngreen">'.$key.'</span>' : '<span class="bold">'.$key.'</span>').'. '.ikonka_user($rating_user['lost_race'], ((!empty($online[$user_id])) ? 'online' : 'offline')).' <span class="yellow1">'.$rating_user['lost_login'].'</span>	
			</a>
		</div>
		';

}
echo pagination_echo($pagination['page'],$pagination['total'],'/rating?go=protection&page=');
echo '</div>';

echo '<div class="mt5 mb5 small cntr">';
echo ($user_rating) ? '<span class="lngreen">Вы находитесь на '.$user_rating.' месте в рейтинге</span>' : '<span class="ccc">Вы не учавствуете в рейтинге</span>';
echo '<br/><br/><span class="lngreen">Рейтинг обновляется каждые 10 минут</span>';
echo ($user['lost_privilege'] == 3) ? '<br/><br/><a class="yellow1" href="/rating?go=return_rating">Обновить рейтинг</a>' : '';

echo '</div>';


echo '</div>';
require_once './element_include/element_foot_user_true.php';
exit;
}


if ($go == 'summa') {
$title = 'Рейтинг по сумме';
require_once './element_include/element_head.php';
require_once './element_include/element_header_user_true.php';
require_once './element_function/element_function_pagination.php';
echo '<div class="nfl p5 mb5 mt5 mlra">';
echo '<div class="cntr mt5 mb5 white small"><a class="yellow1" href="/rating?go=strlen">Сила</a> | <a class="yellow1" href="/rating?go=heatpoints">Здоровье</a> | <a class="yellow1" href="/rating?go=protection">Защита</a> | Сумма | <a class="yellow1" href="/rating?go=town">Города</a></div>';

$rating = update_rating_user('summa', 0);
$user_rating = array_search($user['lost_id'], $rating);

$page = (isset($_GET['page']) AND is_numeric($_GET['page'])) ? (int)$_GET['page'] : false;
	if (!$page AND $user_rating) $page = (int)((($user_rating - 1) / 10) + 1); else if (!$page) $page = 1;
$pagination = pagination(10, $page, count($rating));
echo '<div class="nf2 p5 mb5 mt10 mlra">';
foreach (array_slice($rating, $pagination['start'], $pagination['num'], true) as $key => $user_id) {
if ($key % 2) $odd = ' odd'; else $odd = '';
$rating_user = cache_user($user_id);
echo '<div class="ml5 mr5">
		<a class="bl p5 small block'.$odd.'" href="/user?id='.$user_id.'">
			<span class="yellow1 small fr"><img src="/images/icons/1.gif"> '.(($user_rating == $key) ? '<span class="bold lngreen">'.$rating_user['lost_params_summa'].'</span>' : '<span class="yellow1 bold">'.$rating_user['lost_params_summa'].'</span>').'</span>
				'.(($user_rating == $key) ? '<span class="bold lngreen">'.$key.'</span>' : '<span class="bold">'.$key.'</span>').'. '.ikonka_user($rating_user['lost_race'], ((!empty($online[$user_id])) ? 'online' : 'offline')).' <span class="yellow1">'.$rating_user['lost_login'].'</span>	
			</a>
		</div>
		';

}
echo pagination_echo($pagination['page'],$pagination['total'],'/rating?go=summa&page=');
echo '</div>';

echo '<div class="mt5 mb5 small cntr">';
echo ($user_rating) ? '<span class="lngreen">Вы находитесь на '.$user_rating.' месте в рейтинге</span>' : '<span class="ccc">Вы не учавствуете в рейтинге</span>';
echo '<br/><br/><span class="lngreen">Рейтинг обновляется каждые 10 минут</span>';
echo ($user['lost_privilege'] == 3) ? '<br/><br/><a class="yellow1" href="/rating?go=return_rating">Обновить рейтинг</a>' : '';

echo '</div>';


echo '</div>';
require_once './element_include/element_foot_user_true.php';
exit;
}

if ($go == 'town') {
$title = 'Рейтинг городов';
require_once './element_include/element_head.php';
require_once './element_include/element_header_user_true.php';
require_once './element_function/element_function_pagination.php';
echo '<div class="nfl p5 mb5 mt5 mlra">';
echo '<div class="cntr mt5 mb5 white small"><a class="yellow1" href="/rating?go=strlen">Сила</a> | <a class="yellow1" href="/rating?go=heatpoints">Здоровье</a> | <a class="yellow1" href="/rating?go=protection">Защита</a> | <a class="yellow1" href="/rating?go=summa">Сумма</a> | Города</div>';

$rating = update_rating_user('town', 1);
$user_rating = array_search($user['lost_town'], $rating);


if (!empty($rating)) {
require_once './element_function/element_function_pagination.php';
$page = (isset($_GET['page']) AND is_numeric($_GET['page'])) ? (int)$_GET['page'] : false;
	if (!$page AND $user_rating) $page = (int)((($user_rating - 1) / 10) + 1); else if (!$page) $page = 1;
$pagination = pagination(10, $page, count($rating));
echo '<div class="nf2 p5 mt10 mlra">';
foreach (array_slice($rating, $pagination['start'], $pagination['num'], true) as $key => $town_id) {
if ($key % 2) $odd = ' odd'; else $odd = '';
$rating_town = cache_town($town_id);
echo '<div class="ml5 mr5">
		<a class="bl p5 small block'.$odd.'" href="/town?id='.$town_id.'">
			<span class="yellow1 small fr"><img width="13" height="11" src="/images/icons/experience.png"> '.(($user_rating == $key) ? '<span class="bold lngreen">'.Replace_Bytes($rating_town['lost_exp']).'</span>' : '<span class="yellow1 bold">'.Replace_Bytes($rating_town['lost_exp']).'</span>').'</span>
				'.(($user_rating == $key) ? '<span class="bold lngreen">'.$key.'.</span>' : '<span class="bold">'.$key.'.</span>').' <img width="13" height="12" src="/images/town/race_'.$rating_town['lost_race'].'.png"> <span class="yellow1">'.$rating_town['lost_name'].'</span>	
			</a>
		</div>
		';
}
echo pagination_echo($pagination['page'],$pagination['total'],'/rating?go=town&page=');
echo '</div>';

echo '<div class="mt5 mb5 small cntr">';
echo ($user_rating) ? '<span class="lngreen">Ваш город находитесь на '.$user_rating.' месте в рейтинге</span>' : '<span class="ccc">'.(($user['lost_town'] > 0) ? 'Ваш город не входит в топ 1000 городов' : 'Вы не состоите ни в одном городе').'</span>';
echo '<br/><br/><span class="lngreen">Рейтинг обновляется каждые 10 минут</span>';
echo ($user['lost_privilege'] == 3) ? '<br/><br/><a class="yellow1" href="/rating?go=return_rating">Обновить рейтинг</a>' : '';

echo '</div>';

} else {
echo '<div class="nf2 p5 mt10 mlra"><div class="cntr ccc small">В игре ещё нету городов</div></div>';
}

echo '</div>';
require_once './element_include/element_foot_user_true.php';
exit;
}

?>