Файл: html/chattav.php
Строк: 176
<?php
require_once ('system/func.php');
$footval = "chattav";
auth(); // Закроем от неавторизированых
requestModer(); // Закроем для тех у кого есть запрос на модератора
$tavcount = 10;
$date = time();
if (isset($_GET['chat'])) {
$chat = (int) $_GET['chat'];
} else {
$chat = 0;
}
$result = $mc->query("SELECT * FROM `users` WHERE `onlinechat`>($date-15) AND `room`='" . $chat . "' ORDER BY `access` DESC ");
$num_rows = $result->num_rows;
$page = ceil($num_rows / $tavcount);
if (!empty($_GET['list'])) {
if ((int) $_GET['list'] >= 0 && (int) $_GET['list'] <= ceil($num_rows / $tavcount)) {
$listcount = (int) $_GET['list'] - 1;
$str = $listcount * $tavcount;
} else {
$listcount = 0;
$str = 0;
}
} else {
$str = 0;
$listcount = 0;
}
$onlineid = $str;
$online1 = $mc->query("SELECT * FROM `users` WHERE `onlinechat`>($date-15) AND `room`='" . $chat . "' ORDER BY `access` DESC LIMIT " . $str . ",10");
$innerHtml = "";
while ($online = $online1->fetch_array(MYSQLI_ASSOC)) {
$access = (int) $online['access'];
$star = "";
$onlineid++;
if ($online['side'] == 2 || $online['side'] == 3) {
$icon = "<img height=17 src=/img/icon/icogood.png width=17>";
} else {
$icon = "<img height=17 src=/img/icon/icoevil.png width=17>";
}
if ($access == 1) {
$star = "<img height='15' src='/img/icon/star.png' width='15' alt=''>";
} else if ($access == 2) {
$star = "<img height='15' src='/img/icon/star2.png' width='15' alt=''>";
} else if ($access > 2) {
$star = "<img height='15' src='/img/icon/star3.png' width='15' alt=''>";
}
$innerHtml = $innerHtml . '<div style="margin-left: 5px;float:left;">' . $onlineid . ' ' . $icon . $star . ' </div><div style="float:right;margin-right: 5px;">' . $online['level'] . '</div><div style="text-align: center;"><a style="font-size:17px; text-decoration:underline;" onclick='showContent("/profile/' . $online['id'] . '")'><font>' . $online['name'] . '</font></a></div><br>'; //<hr class="hr_01"/>
}
?>
<html>
<head>
<title>Mobitva v1.0</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="theme-color" content="#C8AC70">
<link rel="shortcut icon" href="favicon.ico" />
<meta name="author" content="Kalashnikov"/>
</head>
<body>
<center>
<?php if ($chat == 0) { ?>
<a class="nl">- Общий зал(<?php echo $num_rows; ?>)-</a>
<?php } else if ($chat == 1) { ?>
<a class="nl">- Задворки(<?php echo $num_rows; ?>)-</a>
<?php } else if ($chat == 2 || $chat > 5) { ?>
<a class="nl">- Клан(<?php echo $num_rows; ?>)-</a>
<?php } else if ($chat == 3) { ?>
<a class="nl">- МД(<?php echo $num_rows; ?>)-</a>
<?php } else if ($chat == 4) { ?>
<a class="nl">- АДМИН(<?php echo $num_rows; ?>)-</a>
<?php } else if ($chat == 5) { ?>
<a class="nl">- Логи(<?php echo $num_rows; ?>)-</a>
<?php } ?>
</center>
<table class="table_block2">
<tr>
<td class="block101" style="width: 2%"></td>
<td class="block102" style="width: 96%"></td>
<td class="block103" style="width: 2%"></td>
</tr>
<tr>
<td class="block104"></td>
<td class="block105">
<br>
<?php echo $innerHtml; ?>
</td>
<td class="block106"></td>
</tr>
<tr>
<td class="block107"></td>
<td class="block108"></td>
<td class="block109"></td>
</tr>
</table>
<center>
<table align="center">
<tr class="tableheader">
<td colspan="2"><?= $page > 1 ? pagination("chattav.php", $chat, $listcount + 1, $page) : ""; ?></td>
</tr>
</table>
</center>
<?php
//pagination(ссылка "index.php/*?", $strlist номер страницы:>0, максимум страниц:>0)
function pagination($href, $chat, $strlist, $maxstr) {
$strend = 0;
$output = 'Страницы: ';
if ($strlist > 4) {
$output .= "<a onclick=showContent('" . $href . "?chat=" . $chat . "&list=1');><u style='margin-left:7px;margin-right:7px;font-size: 18px;'>1</u></a> .. ";
} elseif ($strlist == 4) {
$output .= "<a onclick=showContent('" . $href . "?chat=" . $chat . "&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 . "?chat=" . $chat . "&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 . "?chat=" . $chat . "&list=" . $maxstr . "');><u style='margin-left:7px;margin-right:7px;font-size: 18px;'>" . $maxstr . "</u></a>";
} else {
$output .= "<a onclick=showContent('" . $href . "?chat=" . $chat . "&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 . "?chat=" . $chat . "&list=" . $strnm . "');><u style='margin-left:7px;margin-right:7px;font-size: 18px;'>" . $strnm . "</u></a>";
}
}
}
}
return $output;
}
require_once ('system/foot/foot.php');
?>