Файл: BlogExl_v_3/modules/user/profile.php
Строк: 91
<?
$id = $func->num($_GET['id']);
$usr = $dbs->query("SELECT * FROM `blogger` where `id` = '$id' limit 1");
if(!$usr->num_rows){
$func->msg('Пользователь не найден!');
foot();
exit();
}
$us = $usr->fetch_assoc();
head($us['login']);
info();
echo '<div class="rega">Блоггер '.$us['login'].'</div>';
echo '<div class="text_stat">';
if(empty($us['ava'])){
echo '<img src="/design/avatar.png" alt="*"/><br/>';
} else {
echo '<a href="'.URL.'/files/avs/'.$us['ava'].'"><img src="'.URL.'/system/resize.php?image='.URL.'/files/avs/'.$us['ava'].'" alt="'.$us['ava'].'" /></a>';}
echo '</div>';
echo '<div class="rega">Личные данные</div>';
echo '<div class="text_stat">';
echo 'ID: '.$us['id'].'<br/>Пcевдоним: '.$us['login'].'<br/>';
echo 'Имя: '.$us['name'].'<br/>';
echo 'Пол: '.($us['sex']==1?'Мужской':'Женский').'<br/>';
echo 'Уровень: '.elite($us['level']).'<br/>';
echo 'Страна: '.$us['city'].'<br/>';
if(isset($user) and $user['id'] != $us['id']){echo '<a href="my/mail.php?&send&id='.$us['id'].'">Написать письмо</a><br/>';}
echo '</div>';
echo '<div class="rega">Контакты</div>';
echo '<div class="text_stat">';
if(!empty($us['email'])){echo 'E-mail: '.$us['email'].'<br/>';}
if(!empty($us['icq'])){echo 'ICQ: '.$us['icq'].'<br/>';}
echo '</div>';
echo '<div class="rega">Активность</div>';
echo '<div class="text_stat">Статей: <a href="?id='.$id.'&blog">'.$dbs->query("SELECT * FROM `blog` where `id_us` = '$us[id]' and `activ` = '1'")->num_rows.'</a><br/>Комментариев: '.$dbs->query("SELECT * FROM `komm` where `id_us` = '$us[id]'")->num_rows.'<br/>Регистрация: '.times($us['time_reg']).'<br/>Посл.посещение: '.times($us['onl']).'</div>';
if(isset($_GET['blog'])){
$ram = $dbs->query("SELECT * FROM `blog` where `id_us` = '$us[id]'")->num_rows;
$num = 2;
$total = intval(($ram - 1) / $num) + 1;
$page = abs(intval($_GET['page']));
if(empty($page) or $page < 0) $page = 1;
if($page > $total) $page = $total;
$start = $page * $num - $num;
$q = $dbs->query("SELECT * FROM `blog` where `id_us` = '$us[id]' and `activ` = '1' order by `time` desc limit $start,$num");
if(!$q->num_rows){echo '<div class="post2">Статей нет!</div>';}
while($a = $q->fetch_assoc()){
$raz = $dbs->query("SELECT * FROM `cat` where `id` = '$a[id_cat]' limit 1")->fetch_assoc();
echo '<div class="razd"><img
src="/design/044.png" alt="*"/> <a
href="read'.$a['id'].'" style="text-
decoration:none;">'.$a['name'].'</a></div><div class="pod_razd">'.$a['msg'].'....<a href="read'.$a['id'].'"><img src="/design/020.png"
alt="*" align="middle" />читать далее</a><br/>Раздел: <a href="pages/cat.php?id='.$raz['id'].'">'.$raz['name'].'</a></div>';
}
str('?id='.$id.'&');
}
echo '<div class="rega">Репутация</div>';
echo '<div class="text_stat">';
$cp = $dbs->query("SELECT * FROM `avt` where `id_us` = '$us[id]' and `type` = 'plus'")->num_rows-$dbs->query("SELECT * FROM `avt` where `id_us` = '$us[id]' and `type` = 'minus'")->num_rows;
echo '<a href="?id='.$id.'&rep">Репутация '.$us['login'].'</a> ('.$cp.')<br/>';
echo '<a href="?id='.$id.'&rep"><img src="/design/+.png">Плюс </a><b><font color="green">('.$dbs->query("SELECT * FROM `avt` where `id_us` = '$us[id]' and `type` = 'plus'")->num_rows.')</font></b> | <a href="?id='.$id.'&rep"><img src="/design/-.png">Минус </a><b><font color="red">('.$dbs->query("SELECT * FROM `avt` where `id_us` = '$us[id]' and `type` = 'minus'")->num_rows.')</font></b><br/>';
echo '</div>';
if(isset($user)){
if(isset($_GET['add'])){
$msg = $func->txt($_POST['msg']);
$type = $func->txt($_POST['type']);
if(empty($msg)){ $msg ='Без комментария...'; }
if(empty($type)){ $err .='Ошибка! Вы не выбрали тип отзыва!';}
if(!isset($err)){
$dbs->query("INSERT INTO `avt` set `kto` = '$user[id]', `id_us` = '$us[id]', `msg` = '$msg', `type` = '$type', `time` = '$time'");
$action = '[b]Система[/b]: Пользователь [b]'.$user['login'].'[/b] пoставил'.(($user['sex']==1)?'':'а').' вам [url=/us'.$us['id'].']'.(($type=='plus')?'плюс':'минус').'[/url]!';
$dbs->query("INSERT INTO `action` SET `id_us` = '$us[id]', `msg` = '$action', `read` = '0', `time` = '$time'");
header('location:/us'.$id);
}
}
}
$func->error($err);
if(isset($_GET['rep'])){
$toda = $dbs->query("SELECT * FROM `avt` where `kto` = '$user[id]' and `id_us` = '$us[id]' and `time` > '".(time()-3600)."'")->num_rows;
if($toda ==0 && $us['id']!==$user['id']){
echo '<div class="post2"><form action="?id='.$id.'&add" method="post">Ваш комментарий:<br /><textarea cols="20" rows="5" name="msg" maxlength="300"></textarea><br/>Ваш отзыв:<br /><select size="1" name="type">
<option disabled>Выберите отзыв</option>
<option selected value="plus">Плюс</option>
<option value="minus">Минус</option>
</select><br/><input type="submit" value="Добавить" /></form></div>';
}
$alls = $dbs->query("SELECT * FROM `avt` where `id_us` = '$us[id]' order by `time` desc");
while($r = $alls->fetch_assoc()){
echo '<div class="post2">'.$func->nik($r['kto']).'</a> ['.times($r['time']).'] <b>['.(($r['type']=='plus')?'<font color="green">Положительно</font>':'<font color="red">Отрицательно</font>').']</b><br/> '.$func->out($r['msg']).'</div>';
}
}
$blog = $dbs->query("SELECT * FROM `blog` where `id_us` = '$us[id]' order by `time` desc limit 1")->fetch_assoc();
$kom = $dbs->query("SELECT * FROM `komm` where `id_us` = '$us[id]' order by `time` desc limit 1")->fetch_assoc();
echo '<div class="text_stat">Последняя статья: <a href="/read'.$blog['id'].'">'.$blog['name'].'</a><br/>Последний коммент: <a href="/read'.$kom['id_blog'].'">'.$kom['msg'].'</a></div>';
if($user['level']==2){echo'<div class="post2"><a href="admin/us.php?id='.$us['id'].'"><b>Апдейт</b></a></div>';}
foot();
?>