Файл: us.php
Строк: 199
<?php
include 'system/sys.php';
include 'system/funcs.php';
if (!isset ($us)) {
header ('location: /');
exit;
}
if (!isset ($_GET['id'])) {
header ('location: /');
exit;
}
$query = DB :: $dbs -> query ("SELECT * FROM `us` WHERE (`id`=?)", array ((int) $_GET['id']));
if ($query -> rowCount () == 0) {
header ('location: /');
exit;
}
$u = $query -> fetch ();
H ('Страница ' . $u['nick'], uNick ($u['id']));
$query = DB :: $dbs -> query ("SELECT * FROM `reg` WHERE (`us`='" . $u['id'] . "') AND (`dop` != '')");
if ($query -> rowCount () != 0) {
$reg = $query -> fetch ();
$kem = DB :: $dbs -> queryFetch ("SELECT * FROM `us` WHERE `id`='" . $reg['kem'] . "'");
echo '<div class="list1">Регистрацию ' . ( ( $reg['dop'] == 'da') ? 'подтвердил' : 'отклонил' ) . ($kem['sex']=='Муж'?'':'а') . ' ' . uNick ($reg['kem']) . '</div>';
}
if ($u['mosh'] != 0) {
echo '<div class="list1">';
echo '<img src="/images/block.png" alt="" align="middle"/> <b style="color: red;">Данный пользователь - мошенник!</b>';
$usk = DB :: $dbs -> queryFetch ("SELECT * FROM `us` WHERE (`id`='" . $u['mosh'] . "')");
if ($usk['id'] == $us['id'] || $us['level']>$usk['level']) {
if (isset ($_GET['mosh'])) {
DB :: $dbs -> query ("UPDATE `us` SET `mosh`='0' WHERE (`id`='" . $u['id'] . "')");
header ('location: /us' . $u['id']);
}
echo ' [<a href="/us' . $u['id'] . '?mosh">x</a>]';
}
echo '</div>';
}
else {
if ($u['id']!=$us['id'] && $u['level']<$us['level']) {
if (isset ($_GET['mosh'])) {
DB :: $dbs -> query ("UPDATE `us` SET `mosh`='" . $us['id'] . "' WHERE (`id`='" . $u['id'] . "')");
header ('location: /us' . $u['id']);
}
echo '<div class="list1"><a href="/us' . $u['id'] . '?mosh">Повесить клеймо мошенника</a></div>';
}
}
//
if ($u['id']==$us['id'] && $us['level']>3 || $u['level']<$us['level'] && $us['level']>3) {
echo '<div class="list1"><a href="/adm/us.php?id=' . $u['id'] . '">Редактировать данные</a></div>';
}
//
if ($u['id']!=$us['id'] && $u['level']<$us['level']) {
echo '<div class="list1"><a href="/adm/mail.php?id=' . $u['id'] . '">Просмотр почты</a></div>';
}
//
if ($u['id']==$us['id'] && $us['level']>0 || $u['level']<$us['level'] && $us['level']>0) {
echo '<div class="list1"><a href="/adm/nick.php?id=' . $u['id'] . '">Сменить ник</a></div>';
}
//
if ($u['id']!=$us['id'] && $u['level']<$us['level']) {
echo '<div class="list1"><a href="/adm/ban.php?id=' . $u['id'] . '">Бан</a></div>';
}
$query = DB :: $dbs -> query ("SELECT * FROM `ban` WHERE (`us`='" . $u['id'] . "') AND (`end`>'" . time () . "')");
if ($query -> rowCount () != 0) {
$ban = $query -> fetch ();
echo '<div class="list1">';
echo '<b style="color:red;">Пользователь в бане!</b><br/>';
echo 'Причина: <b>' . $ban['text'] . '</b><br/>';
echo 'Дата бана: <b>' . date ('d.m.Y в H:i:s', $ban['time']) . '</b><br/>';
echo 'Дата освобождения: <b>' . date ('d.m.Y в H:i:s', $ban['end']) . '</b>';
$who = DB :: $dbs -> queryFetch ("SELECT * FROM `us` WHERE (`id`='" . $ban['who'] . "')");
if ($who['id'] == $us['id'] || $us['level'] > $who['level']) {
if (isset($_GET['unban'])) {
DB :: $dbs -> query ("UPDATE `ban` SET `end`='" . time () . "' WHERE (`id`='" . $ban['id'] . "')");
header ('location:/us' . $u['id']);
}
echo ' [<a href="/us'.$u['id'].'?unban">x</a>]';
}
echo '</div>';
}
echo '<div class="list1">';
echo '<span style="color:#818181;">» Зарегистрирован' . ($u['sex']=='Муж'?'':'а') . ':</span> ' . datef ($u['reg']) . '<br/>';
echo '<span style="color:#818181;">» Последняя активность:</span> '. datef ($u['last']).'<br/>';
//
if ($u['online']!=0) {
echo '<span style="color:#818181;">» Пров' . ($u['sex']=='Муж'?'ёл':'ела') . ' на сайте:</span> ' . timef ($u['online']).'<br/>';
}
if ($u['level'] > 3) $level = '<b style="color:red;">Создатель</b>';
else if ($u['level'] == 3) $level = '<b style="color:red;">Ст. Админ</b>';
else if ($u['level'] == 2) $level = '<b style="color:red;">Админ</b>';
else if ($u['level'] == 1) $level = '<b style="color:red;">Модер</b>';
else $level = '<b style="color:green;">Пользователь</b>';
//
if ($u['jur']==1) {
$level .= ' | <b style="color: green;">Журналист газеты</b>';
}
echo '<span style="color:#818181">» Уровень:</span> ' . $level . '</span>';
echo '</div>';
echo '<div class="list1">';
echo '<img src="' . (file_exists ('./files/avs/' . $u['id'] . '.jpg') ? 'files/avs/'.$u['id'].'.jpg' : 'images/noava.png') .'" alt="" style="max-width:208px;max-height:208px;"/></a><br/>';
if ($us['id']!=$u['id']) {
echo '<img src="/images/004.png" alt=""/> <a href="/msg' . $u['id'] . '">Написать сообщение</a><br/>';
$query = DB :: $dbs -> query ("SELECT * FROM `ignor` WHERE (`us`='" . $us['id'] . "') AND (`kem`='" . $u['id'] . "')");
echo '<img src="/images/' . ($query -> rowCount () != 0 ? 'yes':'stop_2') . '.png" alt=""/> <a href="/msg' . $u['id'] . '?ignor">' . ($query -> rowCount () != 0 ? 'Убрать из игнора' : 'В игнор') . '</a><br/>';
$query = DB :: $dbs -> query ("SELECT * FROM `favorit` WHERE (`kem`='" . $us['id'] . "') AND (`us`='" . $u['id'] . "')");
echo '<img src="/images/' . ($query -> rowCount () != 0 ? 'blue_favorites' : 'favorites_folder') . '.png" alt=""/> <a href="/favorit.php?u=' . $u['id'] . '">' . ($query -> rowCount () != 0 ? 'Убрать из избранных' : 'В избранное') . '</a><br/>';
$query = DB :: $dbs -> query ("SELECT * FROM `podp` WHERE (`us`='" . $us['id'] . "') AND (`na`='" . $u['id'] . "')");
if (isset ($_GET['pods'])) {
if ($query -> rowCount () == 0) {
DB :: $dbs -> query ("INSERT INTO `podp` (`us`, `na`) VALUES ('" . $us['id'] . "', '" . $u['id'] . "')");
}
else {
DB :: $dbs -> query ("DELETE FROM `podp` WHERE (`us`='" . $us['id'] . "') AND (`na`='" . $u['id'] . "')");
}
header ('location: /us' . $u['id']);
}
echo '
<img src="/images/' . ($query -> rowCount () == 0 ? 'kontact-news' : 'news_unsubscribe') . '.png" alt=""/> <a href="/us.php?id=' . $u['id'] . '&pods">' . ($query -> rowCount () == 0 ? 'Подписаться на новости' : 'Отписаться от новостей') . '</a>
';
}
echo '</div>';
echo '<div class="list1">';
echo '» ID: <b>' . $u['id'] . '</b><br/>';
//
if ($u['reit'] >= 0 && $u['reit'] <= 0.20) $status = 'Новичек';
else if ($u['reit'] >= 0.21 && $u['reit'] <= 0.50) $status = 'Продвинутый';
else if ($u['reit'] >= 0.51 && $u['reit'] <= 3.00) $status = 'Узнаваемый';
else if ($u['reit'] >= 3.01 && $u['reit'] <= 10.00) $status = 'Здешний';
else if ($u['reit'] >= 10.01 && $u['reit'] <= 50.00) $status = 'Уважаемый';
else if ($u['reit'] >= 50.01 && $u['reit'] <= 100.00) $status = 'V.I.P';
echo '» Статус: <span style="color:green;">' . (!empty ($u['status']) ? $u['status'] : $status ) . '</span><br/>';
echo '</div>';
echo '<div class="menu2">Личные данные</div>';
echo '<div class="ram">';
echo '<div class="raz">';
$query = DB :: $dbs -> query ("SELECT * FROM `nicks` WHERE (`us`='" . $u['id'] . "')");
echo '<img src="/images/ups.png" alt=""/> <a href="/us' . $u['id'] . '?nicks">История ников</a> (' . $query -> rowCount () .')';
if (isset ($_GET['nicks'])) {
echo '<div class="list1">';
if($query -> rowCount () == 0) {
echo uNick ($u['id']) . ' не менял ник!';
}
else {
$query = DB :: $dbs -> query ("SELECT * FROM `nicks` WHERE (`us`='" . $u['id'] . "') ORDER BY `id` DESC");
while ($nick = $query -> fetch ()) {
echo '<b>' . $nick['old'] . '</b> -> <b>' . $nick['new'] . '</b><br>Сменил: ' . uNick ($nick['kem']) . ' (' . datef ($nick['time']) . ')<hr/>';
}
}
echo '</div>';
}
echo '</div>';
if ($u['id'] != $us['id'] && $u['ank'] == 0) {
echo '<div class="lst">';
echo 'Вы не можете просматривать анкетные данные пользователя ' . uNick ($u['id']) . ', так как он предпочёл их скрыть!';
echo '</div>';
}
else {
if (!empty ($u['name'])) {
echo '<div class="list1">Имя: ' . $u['name'] . '</div>';
}
echo '<div class="list1">Пол: ' . $u['sex'] . '</div>';
echo '<div class="list1">Дата рождения: ' . $u['birthday'] . '</div>';
if (!empty ($u['country'])) {
echo '<div class="list1">Страна: ' . $u['country'] . '</div>';
}
if (!empty ($u['city'])) {
echo '<div class="list1">Город: ' . $u['city'] . '</div>';
}
if (!empty ($u['about'])) {
echo '<div class="list1">О себе: ' . bb ($u['about']) . '</div>';
}
/* Для безопасности
* if (!empty ($u['email'])) {
echo '
<div class="list1">
E-mail: ' . $u['email'] . '
</div>
';
}
*/
}
echo '</div>';
/*
echo '<div class="menu2">Информация</div>';
echo '<div class="ram">';
echo '<div class="raz"><img src="" alt=""/> ' . (!empty ($u['wmid']) ? 'WMID <a href="">' . $u['wmid'] . '</a>' : 'WMID не указан') . '</div>';
echo '<div class="raz"><img src="" alt=""/> ' . (!empty ($u['qiwi']) ? 'QIWI <a href="">' . $u['qiwi'] . '</a>' : 'QIWI не указан') . '</div>';
echo '</div>';
*/
echo '<div class="menu2">Информация и Активность</div>';
echo '<div class="ram">';
//
echo '<div class="raz"><img src="/images/theme.png" alt=""/> Тем в <a href="/thems' . $u['id'] . '">форуме</a>: ' . DB :: $dbs -> querySingle ("SELECT COUNT(*) FROM `forum_t` WHERE (`us` = '" . $u['id'] . "')") . '</div>';
//
echo '<div class="raz"><img src="/images/txt4.png" alt=""/> Постов в <a href="/posts' . $u['id'] . '">форуме</a>: ' . DB :: $dbs -> querySingle ("SELECT COUNT(*) FROM `forum_p` WHERE (`us`='" . $u['id'] . "')") . ' (Сегодня: ' . DB :: $dbs -> querySingle ("SELECT COUNT(*) FROM `forum_p` WHERE (`us`='" . $u['id'] . "') " . ($us['level'] > 0 ? '' : 'AND (`del`='0')') . " AND (`time`>'" . (time () - 86400) . "')") . ')</div>';
//
echo '<div class="raz"><img src="/images/comments.png" alt=""/> Комментариев: <a href="/uskomments.php?id=' . $u['id'] . '">' . ( DB :: $dbs -> querySingle ("SELECT COUNT(*) FROM `news_komm` WHERE (`us`='" . $u['id'] . "')") + DB :: $dbs -> querySingle ("SELECT COUNT(*) FROM `zc_komm` WHERE (`us`='" . $u['id'] . "')") ) . '</a></div>';
//
echo '<div class="raz"><img src="/images/files2.png" alt=""/> <a href="/files.php?id=' . $u['id'] . '">Файлы</a> (' . DB :: $dbs -> querySingle ("SELECT COUNT(*) FROM `zc_f` WHERE (`us`='" . $u['id'] . "') AND (`dop`='da')") . ')</div>';
if ($u['id']!=$us['id'] && $u['new']==0) {
//
echo '<div class="raz"><img src="/images/newspaper.png" alt=""/> <a href="/usnews.php?id=' . $u['id'] . '">Новости</a> (' . DB :: $dbs -> querySingle ("SELECT COUNT(*) FROM `new` WHERE (`us`='" . $u['id'] . "')") . ')</div>';
}
echo '</div>';
echo '<div class="menu2">Репутация на сайте</div>';
echo '<div class="ram">';
//
echo '<div class="raz"><img src="/images/.png" alt=""/> <a href="/podp.php?id=' . $u['id'] . '">Подписчики</a> [' . DB :: $dbs -> querySingle ("SELECT COUNT(*) FROM `podp` WHERE (`na`='" . $u['id'] . "')") . ']</div>';
//
echo '<div class="raz"><img src="/images/clean.png" alt=""/> <a href="/senk' . $u['id'] . '">Поблагодарили</a> [' . DB :: $dbs -> querySingle ("SELECT COUNT(*) FROM `senk` WHERE (`komu`='" . $u['id'] . "')") . ']</div>';
//
echo '<div class="raz"><img src="/images/rating.png" alt=""/> Рейтинг: <font color="green">' . $u['reit'] . '</font></div>';
//
echo '<div class="raz"><img src="/images/infr.png" alt=""/> <a href="/nar' . $u['id'] . '">Пенализации</a> [' . DB :: $dbs -> querySingle ("SELECT COUNT(*) FROM `nar` WHERE (`us`='" . $u['id'] . "')") . ']</div>';
echo '</div>';
if ($u['id']==$us['id'] || $u['new'] == 1) {
echo '<div class="menu2">Новости</div>';
if ($u['id']==$us['id']) {
echo '<form action="/us' . $u['id'] . '?send" method="post">';
echo 'Новость:<br/><textarea name="text"></textarea><br/>';
echo '<input type="submit" value="Отправить"/>';
echo '</form>';
if (isset ($_GET['send'])) {
$_POST['text'] = htmlspecialchars (addslashes (trim ($_POST['text'])));
if (empty ($_POST['text'])) {
echo '<div class="list1">Вы не ввели текст новости..</div>';
}
else {
if (DB :: $dbs -> querySingle ("SELECT COUNT(*) FROM `new` WHERE (`us`='" . $us['id'] . "') AND (`t`>'" . (time () - 60) . "')") != 0) {
echo '<div class="list">Вы пишите слишком часто!</div>';
}
else {
DB :: $dbs -> query ("INSERT INTO `new` (`us`,`kem`,`text`,`t`) VALUES ('" . $u['id'] . "', '" . $us['id'] . "', ?, '" . time () . "')", array ($_POST['text']));
header ('location: /us' . $u['id']);
}
}
}
}
//
if (isset ($_GET['del'])) {
if ($u['id']==$us['id'] || $u['level']<$us['level']) {
$query = DB :: $dbs -> query ("SELECT * FROM `new` WHERE (`id`=?)", array (intval ($_GET['del'])));
if ($query -> rowCount () != 0) {
$new = $query -> fetch ();
if ($new['us']==$u['id']) {
DB :: $dbs -> query ("DELETE FROM `new` WHERE (`id`='" . $new['id'] . "')");
DB :: $dbs -> query ("DELETE FROM `new_komm` WHERE (`id_new`='" . $new['id'] . "')");
}
}
}
header ('location: /us' . $u['id']);
}
//
$items = DB :: $dbs -> querySingle ("SELECT COUNT(*) FROM `new` WHERE (`us`='" . $u['id'] . "')");
if ($items == 0) {
echo 'Новостей нет..';
}
else {
$query = DB :: $dbs -> query ("SELECT * FROM `new` WHERE (`us`='" . $u['id'] . "') ORDER BY `id` DESC LIMIT 5");
while ($new = $query -> fetch ()) {
//
echo '<div class="list1">';
echo uNick ($new['kem']) . ' (' . datef ($new['t']) . ')<br/>';
//
if (!empty ($new['komm'])) {
echo 'Комментарий: <b>' . bb ($new['komm']) . '</b><br/>';
}
if ($new['id_p']!=0) {
$p = DB :: $dbs -> queryFetch ("SELECT * FROM `forum_p` WHERE (`id`='" . $new['id_p'] . "')");
$t = DB :: $dbs -> queryFetch ("SELECT * FROM `forum_t` WHERE (`id`='" . $p['id_t'] . "')");
echo '<img src="/images/re.png" alt=""/> ' . uNick ($p['us']) . '<br/>';
echo 'Тема: <a href="/forum/thema' . $t['id'] . '"><b>' . $t['name'] . '</b></a><br/>';
echo 'Сообщение: ';
if ($p['del']==0) {
if (mb_strlen ($p['text']) > 150) {
echo mb_substr (bb ($p['text']), 0, 150) . '.. <img src="" alt=""/><br/>';
echo '<a href="/newkomm.php?id=' . $new['id'] . '">читать полностью</a>';
}
else {
echo bb ($p['text']);
}
}
else {
echo '<b>Сообщение удалено!</b>';
}
}
//
if ($new['id_f']!=0) {
$f = DB :: $dbs -> queryFetch ("SELECT * FROM `zc_f` WHERE (`id`='" . $new['id_f'] . "')");
echo '<img src="/images/re.png" alt=""/> ' . uNick ($f['us']) . '<br/>';
echo 'Файл: <a href="/zc/file' . $f['id'] . '"><b>' . $f['name'] . '</b></a>';
}
//
if (!empty ($new['text'])) {
echo bb ($new['text']);
}
if ($u['id']==$us['id'] || $u['level']<$us['level']) {
//
echo ' <a href="/us.php?id=' . $u['id'] . '&del=' . $new['id'] . '">удал.</a>';
}
echo '</div>';
//
echo '<div class="lst">';
echo '<form action="/newkomm.php?id=' . $new['id'] . '&add" method="post">';
echo 'Комментарий: <input name="komm"/> <input type="submit" value="Добавить"/>';
echo '</form>';
echo '</div>';
$itemss = DB :: $dbs -> querySingle ("SELECT COUNT(*) FROM `new_komm` WHERE (`id_new`='" . $new['id'] . "')");
if ($itemss != 0) {
echo '<div style="padding-left:15%;">';
$q = DB :: $dbs -> query ("SELECT * FROM `new_komm` WHERE (`id_new`='" . $new['id'] . "') ORDER BY `id` DESC LIMIT 5");
while ($komm = $q -> fetch ()) {
$kommus = DB :: $dbs -> queryFetch ("SELECT * FROM `us` WHERE (`id`='" . $komm['id'] . "')");
echo '<div class="lst">';
echo uNick ($komm['us']) . ' (' . datef ($komm['t']) . ')';
if ($komm['us']!=$us['id']) {
echo ' [<a href="/newkomm.php?id=' . $new['id'] . '&komu=' . $komm['us'] . '">отв</a>] ';
}
if ($kommus['id']==$us['id'] && $us['level']>1 || $kommus['level']<$us['level'] && $us['level']>1) {
echo ' [<a href="/newkomm.php?id=' . $new['id'] . '&del=' . $komm['id'] . '">x</a>] ';
}
echo '<br/>';
echo bb ($komm['text']);
echo '</div>';
}
//
if ($itemss>5) {
echo '<div class="list1"><a href="/newkomm.php?id=' . $new['id'] . '">Показать все комментарии</a> (' . $itemss . ')</div>';
}
echo '</div>';
}
echo '<hr/>';
}
//
if ($items>=5) {
echo '<div class="list1"><a href="/usnews.php?id=' . $u['id'] . '">Больше новостей</a> (' . $items . ')</div>';
}
}
}
F ();