Файл: spuff.ru/other/profile.php
Строк: 259
<?php
require_once '../includes/sys.php';
require_once '../includes/header.php';
$user_r = mysql_query("SELECT * FROM `users` WHERE `id` = '$id'");
$user = mysql_fetch_assoc($user_r);
if (!$user['id']) {
redirect(HTTPHOME);
}
$type = 'profile';
switch ($act) {
default:
echo '<div class="title">Профиль пользователя: '.username($id).'</div>';
$ban_r = mysql_query("SELECT * FROM `ban` WHERE `id_user` = '$id' and `until` > '".TIME."'");
$ban = mysql_fetch_assoc($ban_r);
if ($ban['id']) {
if ($ban['reason']) {
echo '<div class="error">Забанил: '.username($ban['by'], 2).'<br/>Юзер в бане до: '.ccdate($ban['until'], 0).'<br />Причина: '.$ban['reason'].'</div>';
} else {
echo '<div class="error">'.username($ban['by'], 2).' пнул этого юзера</div>';
}
}
echo '<div class="body">';
if ($user['avatar']){
echo '<img src="/avatars/resize.php?dir=/avatars/files&name='.$user['avatar'].'">';
}else{echo '<img src="/avatars/resize.php?dir=/images&name=no_avatar.jpg">';}
$online_r = mysql_query("SELECT `id` FROM `online` WHERE `id_user` = '$id'");
if (mysql_num_rows($online_r)) {
echo ' <font color="green" style="text-align: center">Онлайн <img src="/images/on.png"></font>';
} else {
echo ' <font color="red" style="text-align: center">Оффлайн <img src="/images/off.png"></font>';}
echo '</div>';
echo '<div class="row"><img src="/images/rega.png"> Дата регистрации: '.ccdate($user['regtime'], 0).'</div>';
echo '<div class="row"><img src="/images/visited.png"> Последняя активность: '.ccdate($user['lastvisit'], 0).'</div>';
if (($user['name']) or ($user['from']) or ($user['gorod']) or ($user['birthday']) or ($user['icq']) or ($user['gender'])){echo '<div class="title">Информация</div>';}
if ($user['name']) echo '<div class="row"><img src="/images/ank.png"> Имя: <b>'.$user['name'].'</b></div>';
switch ($user['gender']) {
case '1': $gender = 'Мужской'; break;
case '2': $gender = 'Женский'; break;
}
if (isset($gender)) echo '<div class="row"><img src="/images/u_gender.png"> Пол: '.$gender.'</div>';
if ($user['from']) echo '<div class="row"><img src="/images/dom.png"> Страна: '.$user['from'].'</div>';
if ($user['gorod']) echo '<div class="row"><img src="/images/dom.png"> Город: '.$user['gorod'].'</div>';
if ($user['birthday']) echo '<div class="row"><img src="/images/u_year.png"> Дата рождения: '.$user['birthday'].'</div>';
echo '<div class="row"><img src="/images/bank.png"> Репутация: '.$user['karma'].'';
if (($u['id'] != $user['id']) && ($u['id'])){
echo ' <a href="?act=rate&id='.$user['id'].'"><image src="/images/arrow_down.png" alt="arrow_down" /></a> <a href="?act=rate&id='.$user['id'].'&ok=1""><image src="/images/arrow_up.png" alt="arrow_up" /></a>';
}
echo '</div>';
if ($user['icq']) echo '<div class="row"><img src="http://web.icq.com/whitepages/online?icq='.$user['icq'].'&img=27" alt="icq" /> ICQ: '.$user['icq'].'<br /></div>';
if ($user['site']) echo '<div class="row"><img src="/images/site.png"> Сайт: <a href="http://'.$user['site'].'" target="_blank" />'.$user['site'].'</a><br /></div>';
if ($user['about']) echo '<div class="row"><img src="/images/osebe.png"> О себе: '.$user['about'].'<br /></div>';
if (($user['wmr']) or ($user['wmid'])){echo '<div class="title">Webmoney</div>';}
if ($user['wmid']) echo '<div class="raz">WMID: <a href="https://passport.webmoney.ru/asp/certView.asp?wmid='.$user['wmid'].'">'.$user['wmid'].'</a><br/>BL: <img src="http://stats.wmtransfer.com/Levels/pWMIDLevel.aspx?wmid='.$user['wmid'].'&w=35&h=18&bg=0XECECEC"><br/>Притензии/Отзывы: <img src="http://arbitrage.webmoney.ru/xml/AL.aspx?wmid='.$user['wmid'].'"></div>';
if ($user['wmr']) echo '<div class="row">WMR: R'.$user['wmr'].'</div>';
echo '<div class="title">Прочее</div>';
$banhist = mysql_result(mysql_query("SELECT COUNT(`id`) FROM `ban` WHERE `id_user` = '$id'"), 0);
echo '<div class="row"><img src="/images/narusheniya.png"> <a href="?act=banhist&id='.$id.'">Строгих нарушений: '.$banhist.'</a><br /></div>';
if (isset($u['id'])) {
if ($u['id'] == $id) {
echo '<div class="row"><img src="/images/1.png"> <a href="main.php?act=edit">Профиль</a>, <a href="main.php?act=set">Настройки</a></div>';
} else {
echo '';
$friend_r = mysql_query("SELECT `id` FROM `my_friends` WHERE `id_user` = '$id' and `is_friend_of` = ".$u['id']." ");
$blacklist_r = mysql_query("SELECT `id` FROM `blacklist` WHERE `id_user` = '$id' and `blacklisted_by` = ".$u['id']." ");
if (mysql_num_rows($friend_r)) {
echo '<div class="row"><img src="/images/post.png"> <a href="main.php?act=send&id='.$id.'">Написать</a></div>';
} elseif (mysql_num_rows($blacklist_r)) {
echo '<div class="row">В <a href="main.php?act=blacklist">черном списке</a></div>';
} else {
echo '<div class="row"><img src="/images/post.png"> <a href="main.php?act=send&id='.$id.'">Написать</a>, <a href="?act=addfriend&id='.$id.'">в друзья</a> | <a href="?act=blacklist&id='.$id.'">Х</a></div>';
}
}
}
if (access(1)){
if ($user['access'] != '4'){
echo '<div class="row">
<a href="?act=kick&id='.$user['id'].'">Пнуть</a> (100 сек.)</div>';
if (access(2)) echo '<div class="raz"><a href="/panel/ban.php?user='.$user['username'].'">Забанить</a>, <a href="?act=delmsg&id='.$id.'">удалить</a></div>';
if (access(3)) echo '<div class="raz"><a href="../panel/users.php?act=edit&id='.$user['id'].'">Редактировать</a></div>';
}
}
break;
case 'kick':
if (($u['access'] > $user['access']) or ($user['access'] != '4')){
if ($u['id'] != $user['id']) {
$ban_r = mysql_num_rows(mysql_query("SELECT `id` FROM `ban` WHERE `id_user` = '$user[id]' and `until` > '".TIME."'"));
if (!$ban_r) {
$until = $config['kick'] + TIME;
mysql_query("INSERT INTO `ban` SET `id_user` = '$user[id]', `until` = '$until', `by` = '$u[id]'");
}
}
}
redirect('?id='.$user['id']);
break;
case 'rate':
require_once '../includes/rate.php';
break;
case 'ftopics':
$total = mysql_result(mysql_query("SELECT COUNT(`id`) FROM `forum_topics` WHERE `id_user` = '$id'"), 0);
if ($total > 0) {
tp('<a href="?id='.$id.'">Профиль</a>» все темы '.username($id, 1));
$pages = ceil($total / $config['onpage']);
if ($page > $pages or $page == 0) {
$page = 1;
}
$begin = ($page - 1) * $config['onpage'];
$topics_r = mysql_query("SELECT * FROM `forum_topics` WHERE `id_user` = '$id' ORDER BY `last_time` DESC LIMIT $begin, $config[onpage]");
while ($topic = mysql_fetch_assoc($topics_r)) {
echo '<div class="raz">';
if ($topic['stuck']) echo '!';
if ($topic['closed'] == 1 and empty($topic['stuck'])) echo '#';
$t_msg = mysql_result(mysql_query("SELECT COUNT(`id`) FROM `forum_msg` WHERE `id_topic` = '$topic[id]'"), 0);
$last_user_r = mysql_query("SELECT `id_user` FROM `forum_msg` WHERE `id_topic` = '$topic[id]' ORDER BY `time` DESC LIMIT 1");
$last_user = mysql_fetch_assoc($last_user_r);
// output
echo ' <a href="/forum/topic.php?id='.$topic['id'].'">'.$topic['title'].'</a> ('.$t_msg.') '.login($last_user['id_user']).'<a href="../forum/topic.php?act=end&id='.$topic['id'].'">»</a></div>';
}
navig($page, '?act=ftopics&id='.$id.'&', $pages);
} else {
error($user['username'].' не создовал тем в форуме');
}
break;
case 'fposts':
$total = mysql_result(mysql_query("SELECT COUNT(`id`) FROM `forum_msg` WHERE `id_user` = '$id'"), 0);
if ($total > 0) {
tp('<a href="?id='.$id.'">Профиль</a>» cообщения '.username($id, 1));
$pages = ceil($total / $config['onpage']);
if ($page > $pages or $page == 0) {
$page = 1;
}
$begin = ($page - 1) * $config['onpage'];
$msg_r = mysql_query("SELECT * FROM `forum_msg` WHERE `id_user` = '$id' ORDER BY `time` DESC LIMIT $begin, $config[onpage]");
while ($msg = mysql_fetch_assoc($msg_r)) {
echo '<div class="row"><a href="../forum/topic.php?id='.$msg['id_topic'].'">'.bb($msg['text']).'</a></div>';
}
navig($page, '?act=fposts&id='.$id.'&', $pages);
}else{error($user['username'].' не писал(а) в форуме');}
break;
case 'lfiles':
$total = mysql_result(mysql_query("SELECT COUNT(`id`) FROM `loads` WHERE `id_user` = '$id'"), 0);
if ($total > 0) {
echo '<div class="title"><a href="?id='.$id.'">Профиль</a> » Файлы '.username($id, 1).'</div>';
$pages = ceil($total / $config['onpage']);
if ($page > $pages or $page == 0) {
$page = 1;
}
$begin = ($page - 1) * $config['onpage'];
$loads_r = mysql_query("SELECT * FROM `loads` WHERE `id_user` = '$id' ORDER BY `time` DESC LIMIT $begin, $config[onpage]");
while ($load = mysql_fetch_assoc($loads_r)) {
if (!isset($num) ) $num = 1;
$num++;
$row_class = (!($num % 2)) ? 'row1' : 'row2';
$comm = mysql_result(mysql_query("SELECT COUNT(`id`) FROM `loads_comm` WHERE `id_loads` = '$load[id]'"), 0);
$subcat = mysql_fetch_assoc(mysql_query("SELECT * FROM `loads_subcats` WHERE `id` = '$load[id_subcat]'"));
echo '<div class="raz">
<img src="/images/load_file.png"> <a href="/loads/?act=view&id='.$load['id'].'">'.$load['name'].'</a>';
echo '</div>';
}
navig($page, '?act=lfiles&id='.$id.'&', $pages);
} else {
error ($user['username'].' не загружал файлов');
}
break;
case 'addfriend':
if ($id !== $u['id']) {
$friend_r = mysql_query("SELECT `id` FROM `my_friends` WHERE `id_user` = '$id' and `is_friend_of` = ".$u['id']." ");
if (!mysql_num_rows($friend_r)) {
$blacklist_r = mysql_query("SELECT `id` FROM `blacklist` WHERE `id_user` = '$id' and `blacklisted_by` = ".$u['id']." ");
if (!mysql_num_rows($blacklist_r)) {
mysql_query("INSERT INTO `my_friends` SET `id_user` = '$id', `is_friend_of` = ".$u['id']." ");
} else {
$_SESSION['note'] = 'Этот юзер у вас в черном списке.';
}
}
}
redirect('?id='.$id);
break;
case 'blacklist':
if (($id != $u['id']) && ($user['access'] != '4')){
$blacklist_r = mysql_query("SELECT `id` FROM `blacklist` WHERE `id_user` = '$id' and `blacklisted_by` = ".$u['id']." ");
if (!mysql_num_rows($blacklist_r)) {
$friend_r = mysql_query("SELECT `id` FROM `my_friends` WHERE `id_user` = '$id' and `is_friend_of` = ".$u['id']." ");
if (!mysql_num_rows($friend_r)) {
mysql_query("INSERT INTO `blacklist` SET `id_user` = '$id', `blacklisted_by` = ".$u['id']." ");
} else {
mysql_query("DELETE FROM `my_friends` WHERE `id_user` = '$id' and `is_friend_of` = '$u[id]'");
mysql_query("INSERT INTO `blacklist` SET `id_user` = '$id', `blacklisted_by` = ".$u['id']." ");
$_SESSION['note'] = 'Юзер теперь не ваш друг, он в черном списке.';
}
}
}
redirect('?id='.$id);
break;
case 'vote':
if ($u['id'] and $u['id'] != $id) {
$query = mysql_query("SELECT `id` FROM `voting` WHERE `type` = 'profile' and `id_who` = '$u[id]' and `id_for` = '$id'");
if (!mysql_num_rows($query)) {
$type = abs(intval($_GET['type']));
switch ($type) {
case '1': $value = -1; sendpm($id, 'Вас минусанули :('); break;
default: $value = 1; sendpm($id, 'Вас плюсанули :)'); break;
}
mysql_query("UPDATE `users` SET `karma` = (`karma`+$value) WHERE `id` = '$id'");
mysql_query("INSERT INTO `voting` SET `type` = 'profile', `id_who` = '$u[id]', `id_for` = '$id'") or die(mysql_error());
} else {
$_SESSION['note'] = 'Вы уже голосовали за этого юзера.';
}
}
redirect('?id='.$id);
break;
case 'banhist':
tp('<a href="?id='.$id.'">Профиль</a> » История банов');
$total = mysql_result(mysql_query("SELECT COUNT(`id`) FROM `ban` WHERE `id_user` = '$id'"), 0);
if ($total > 0) {
$pages = ceil($total / $config['onpage']);
if ($page > $pages or $page == 0) {
$page = 1;
}
$begin = ($page - 1) * $config['onpage'];
$ban_r = mysql_query("SELECT * FROM `ban` WHERE `id_user` = '$id' ORDER BY `until` DESC LIMIT ".$begin.", ".$config['onpage']."");
while ($ban = mysql_fetch_assoc($ban_r)) {
echo '<div class="raz">';
if ($ban['reason']) {
echo username($ban['by'], 2).' выдал бан до '.ccdate($ban['until'], 0).'<br />Причина: '.$ban['reason'];
} else {
echo username($ban['by'], 2).' дал пинка этому юзеру';
}
echo '</div>';
}
} else {
echo '<div class="error">История банов пуста</div>';
}
break;
case 'delmsg':
if (access(4)){
if ($ok) {
if ($_POST['del_book']) {
mysql_query("DELETE FROM `book` WHERE `id_user` = '$id'");
}
if ($_POST['del_msg']) {
mysql_query("DELETE FROM `forum_msg` WHERE `id_user` = '$id'");
}
if ($_POST['del_topics']) {
mysql_query("DELETE FROM `forum_topics` WHERE `id_user` = '$id'");
}
if ($_POST['del_notes']) {
mysql_query("DELETE FROM `blogs` WHERE `id_user` = '$id'");
}
if ($_POST['del_cnews']) {
mysql_query("DELETE FROM `news_comm` WHERE `id_user` = '$id'");
}
if ($_POST['del_cblog']) {
mysql_query("DELETE FROM `blog_comm` WHERE `id_user` = '$id'");
}
if ($_POST['del_cdl']) {
mysql_query("DELETE FROM `loads_comm` WHERE `id_user` = '$id'");
}
if ($_POST['bans']){
mysql_query("DELETE FROM `ban` WHERE `id_user` = ".$id);
}
$_SESSION['note'] = 'Успешно удалено.';
redirect('?id='.$id);
} else {
tp('Что удалить?');
echo '<div class="body">';
if (access(4)) echo '- <a href="../panel/users.php?act=del&id='.$user['id'].'"><b>Удалить юзера</b></a><br/>';
echo '<form name="form" action="?act=delmsg&id='.$id.'&ok=1" method="post" name="form">
<input name="del_book" type="checkbox" value="1" />все сообщ. в гостевой<br />
<input name="del_msg" type="checkbox" value="1" />все сообщ. форуме<br />
<input name="del_topics" type="checkbox" value="1" />все темы в форуме<br />
<input name="del_notes" type="checkbox" value="1" />все записи в блоге<br />
<input name="del_cnews" type="checkbox" value="1" />все ком. (в новостях)<br />
<input name="del_cblog" type="checkbox" value="1" />все ком. (в блогах)<br />
<input name="del_cdl" type="checkbox" value="1" />все ком. (в ЗЦ)<br />
<input type="checkbox" name="bans" value="1">Всю историю банов<br/>
<input name="submit" type="submit" value="Удалить" /></form></div>';
}
} else {
redirect(HTTPHOME);
}
break;
case 'email_ver':
$ver = check($_GET['ver']);
if ($user['email_ver'] == $ver) {
mysql_query("UPDATE `users` SET `email_ver` = 1 WHERE `id` = '$id'");
$_SESSION['note'] = 'Вы успешно подтвердили ваш E-mail. Ввойдите на сайт используя свои данные.';
redirect(HTTPHOME.'/other/login.php');
} elseif ($user['email_ver'] == 1) {
redirect(HTTPHOME);
} else {
$_SESSION['note'] = 'Неверный код подтверждения';
redirect(HTTPHOME.'/other/login.php');
}
break;
}
require_once '../includes/tail.php';
?>