Файл: html/top.php
Строк: 257
<?php
require_once 'system/func.php';
$footval = "top";
require_once ('system/foot/foot.php');
?>
<center>
<table style="border-spacing:7px;">
<tr style="font-size:18px;">
<?php if (isset($_GET['vse'])) { ?>
<td style="font-size:15px"><a onclick="showContent('top.php?vse')"><b>Все</b></a></td>
<?php } else { ?>
<td><a onclick="showContent('top.php?vse')"><u>Все</a></td>
<?php }if (isset($_GET['mylvl'])) { ?>
<td style="font-size:15px"><a onclick="showContent('top.php?mylvl=<?= $user['level'] ?>')"><b><?= $user['level'] ?> Уровень </b></a></td>
<?php } else { ?>
<td><a onclick="showContent('top.php?mylvl=<?= $user['level'] ?>')"><u><?= $user['level'] ?> Уровень</u></a></td>
<?php }if (isset($_GET['clan'])) { ?>
<td style="font-size:15px"><a onclick="showContent('top.php?clan')"></a><b>Кланы</b></a></td>
<?php } else { ?>
<td><a onclick="showContent('top.php?clan')"><u>Кланы</u></a></td>
<?php } ?>
</tr>
</table>
</center>
<table class="table_block2" >
<tr>
<td class="block01" style="width: 2%"></td>
<td class="block02" style="width: 96%"></td>
<td class="block03" style="width: 2%"></td>
</tr>
<tr>
<td class="block04"></td>
<td class="block05">
<?php
$strlist = 1;
$maxstr = 1;
$countstr = 10;
$num = 0;
$strlistnum = 0;
if (!isset($_GET['list'])) {
$strlist = 1;
} else {
$strlist = $_GET['list'];
}
if (!isset($_GET['mylvl']) && !isset($_GET['clan'])) {
$usercount = $mc->query("SELECT COUNT(*) FROM `users`")->fetch_array(MYSQLI_ASSOC);
$maxstr = round($usercount['COUNT(*)'] / $countstr);
$strlistnum = ($strlist * $countstr) - $countstr;
$user = $mc->query("SELECT * FROM `users` WHERE `access`='0' OR `access`='1' ORDER BY `users`.`level` DESC, `users`.`exp` DESC LIMIT " . $strlistnum . "," . $countstr);
echo "<center><b>Нас уже:" . $usercount['COUNT(*)'] . "</b></center>";
?>
<?php
while ($result = $user->fetch_array(MYSQLI_ASSOC)) {
$num++;
if ($result['side'] == 2 || $result['side'] == 3) {
$icon = "<img height='19' src='/img/icon/icogood.png' width='19' alt=''>";
} else {
$icon = "<img height='19' src='/img/icon/icoevil.png' width='19' alt=''>";
}
?>
<table cellspacing="4" style="width:100%">
<tr>
<td style="width: 25px; height:10px; text-align:center">
<?php echo $num + $strlistnum; ?>
</td>
<td style="width:30px; text-align: center">
<?= $icon; ?>
</td>
<td style="max-width:100%">
<a onclick="showContent('/profile/<?php echo $result['id']; ?>');">
<font style="font-size:19px"><u><?= $result['name']; ?></u></font>
</a>
</td>
<td style="width:40px; text-align: center">
<?= $result['level']; ?>
</td>
</tr>
</table>
<?php } ?>
<?php
}
if (isset($_GET['mylvl'])) {
$usercount = $mc->query("SELECT COUNT(*) FROM `users` WHERE `level`='" . $user['level'] . "' ORDER BY `users`.`exp` DESC LIMIT " . $strlistnum . "," . $countstr)->fetch_array(MYSQLI_ASSOC);
$maxstr = round($usercount['COUNT(*)'] / $countstr);
$strlistnum = ($strlist * $countstr) - $countstr;
$user = $mc->query("SELECT * FROM `users` WHERE `level`='" . $user['level'] . "' ORDER BY `users`.`exp` DESC LIMIT " . $strlistnum . "," . $countstr);
while ($result = $user->fetch_array(MYSQLI_ASSOC)) {
$num++;
if ($result['side'] == 2 || $result['side'] == 3) {
$icon = "<img height='19' src='/img/icon/icogood.png' width='19' alt=''>";
} else {
$icon = "<img height='19' src='/img/icon/icoevil.png' width='19' alt=''>";
}
?>
<table cellspacing="4" style="width:100%">
<tr>
<td style="width:25px; height:10px; text-align: center">
<?php echo $num + $strlistnum; ?>
</td>
<td style="width:30px;text-align: center">
<?= $icon; ?>
</td>
<td style="max-width:100%">
<a onclick="showContent('/profile/<?php echo $result['id']; ?>');">
<font style="font-size:19px;"><ins><?= $result['name']; ?></ins></font>
</a>
</td>
<td style="width:40px; text-align: center">
<?= $result['level']; ?>
</td>
</tr>
</table>
<?php } ?>
<?php
}
if (isset($_GET['clan'])) {
$usercount = $mc->query("SELECT COUNT(*) FROM `clan`")->fetch_array(MYSQLI_ASSOC);
$maxstr = round($usercount['COUNT(*)'] / $countstr);
$strlistnum = ($strlist * $countstr) - $countstr;
$clan = $mc->query("SELECT * FROM `clan` ORDER BY `reit` DESC LIMIT " . $strlistnum . "," . $countstr);
while ($resul = $clan->fetch_array(MYSQLI_ASSOC)) {
$clan_side = $mc->query("SELECT `side` FROM `users` WHERE `id_clan` = '".$resul['id']."'")->fetch_array(MYSQLI_ASSOC);
$num++;
$icon = $clan_side['side'] == 0 || $clan_side['side'] == 1 ? '<img width="19px" height="19px" src="/img/icon/icoevil.png" alt="">' : '<img width="19px" height="19px" src="/img/icon/icogood.png" alt="">';
?>
<table cellspacing="4" style="width:100%">
<td style="width:25px; height:10px; text-align: center">
<?php echo $num + $strlistnum . '. ' ?>
</td>
<td style="width:30px;text-align: center">
<?= $icon; ?>
</td>
<td style="max-width:100%">
<a onclick="showContent('/clan/clan_all.php?see_clan=<?php echo $resul['id']; ?>')">
<font style="font-size:19px;"><ins><?php echo $resul['name']; ?></ins></font>
</a>
</td>
<td style="width:40px; text-align: center">
<?php echo $resul['reit']; ?>
</td>
</table>
<?php
}
$mc->query("UPDATE `clan` SET `num`='$num' WHERE `id`='" . $user['id_clan'] . "'");
}
?>
</td>
<td class="block06"></td>
</tr>
<tr>
<td class="block07"></td>
<td class="block08"></td>
<td class="block09"></td>
</tr>
</table>
<?php
$contentgen = "";
if (isset($_GET['vse'])) {
$contentgen = 'vse';
}
if (isset($_GET['mylvl'])) {
$contentgen = 'mylvl';
}
if (isset($_GET['clan'])) {
$contentgen = 'clan';
}
?>
<center>
<?= pagination("top.php", $contentgen, $strlist, $maxstr); ?>
</center>
<?php
//pagination(ссылка "index.php/*?", $strlist номер страницы:>0, максимум страниц:>0)
function pagination($href, $contentgen, $strlist, $maxstr) {
$strend = 0;
$output = 'Страницы: ';
if ($strlist > 4) {
$output .= "<a onclick=showContent('" . $href . "?" . $contentgen . "&list=1');><u style='margin-left:7px;margin-right:7px;font-size: 18px;'>1</u></a> .. ";
} elseif ($strlist == 4) {
$output .= "<a onclick=showContent('" . $href . "?" . $contentgen . "&list=1');><u style='margin-left:7px;margin-right:7px;font-size: 18px;'>1</u></a>";
}
for ($i = -2; $i <= 3; $i++) {
$strnm = $i + $strlist;
if ($strnm + 1 == $maxstr) {
$strend = 1;
}
if ($strnm > 0) {
if ($i == 0) {
$output .= "<a onclick=showContent('" . $href . "?" . $contentgen . "&list=" . $strlist . "');><u style='margin-left:7px;margin-right:7px;font-size: 14px;text-decoration:none;'>" . $strlist . "</u></a>";
} elseif ($i == 3) {
if ($strlist < $maxstr) {
if ($strend == 0) {
$output .= ".. <a onclick=showContent('" . $href . "?" . $contentgen . "&list=" . $maxstr . "');><u style='margin-left:7px;margin-right:7px;font-size: 18px;'>" . $maxstr . "</u></a>";
} else {
$output .= "<a onclick=showContent('" . $href . "?" . $contentgen . "&list=" . $maxstr . "');><u style='margin-left:7px;margin-right:7px;font-size: 18px;'>" . $maxstr . "</u></a>";
}
}
} else {
if ($strnm < $maxstr) {
$output .= "<a onclick=showContent('" . $href . "?" . $contentgen . "&list=" . $strnm . "');><u style='margin-left:7px;margin-right:7px;font-size: 18px;'>" . $strnm . "</u></a>";
}
}
}
}
return $output;
}
?>