<?
include_once '../sys/inc/start.php';
include_once '../sys/inc/compress.php';
include_once '../sys/inc/sess.php';
include_once '../sys/inc/home.php';
include_once '../sys/inc/settings.php';
include_once '../sys/inc/db_connect.php';
include_once '../sys/inc/ipua.php';
include_once '../sys/inc/fnc.php';
include_once '../sys/inc/user.php';
if (isset($_GET['id']) && is_numeric($_GET['id']))$ank['id']=intval($_GET['id']);
elseif (isset($user))$ank['id']=$user['id'];
else {header("Location: /index.php?".SID);exit;}
if ($ank['id']==0)
{
$smarty_info = new Smarty_conf();
$posts=array();
$ank=get_user($ank['id']);
$set['title']=$ank['nick'].' - анкета '; // заголовок страницы
include_once '../sys/inc/thead.php';
title();
aut();
$posts[]=array('status'=>$ank['group_name']);
$posts[]=array('О себе',output_text($ank['ank_o_sebe']));
$smarty_info->assign('post',$posts);
$smarty_info->display('body.key-value.tpl');
include_once 'sys/inc/tfoot.php';
exit;
}
$ank=get_user($ank['id']);
if(!$ank){header("Location: /index.php?".SID);exit;}
$ank['rating']=intval(@mysql_result(mysql_query("SELECT SUM(`rating`) FROM `user_voice2` WHERE `id_kont` = '$ank[id]'"),0));
$set['title']=$ank['nick'].' - анкета '; // заголовок страницы
include_once '../sys/inc/thead.php';
title();
if (isset($_GET['rating']) && isset($user) && $user['id']!=$ank['id'] && $user['balls']>=50 && mysql_result(mysql_query("SELECT SUM(`rating`) FROM `user_voice2` WHERE `id_kont` = '$user[id]'"),0)>=0)
{
$new_r=min(max(@intval($_GET['rating']),-2),2);
mysql_query("DELETE FROM `user_voice2` WHERE `id_user` = '$user[id]' AND `id_kont` = '$ank[id]' LIMIT 1");
if ($new_r)
mysql_query("INSERT INTO `user_voice2` (`rating`, `id_user`, `id_kont`) VALUES ('$new_r','$user[id]','$ank[id]')");
$ank['rating']=intval(mysql_result(mysql_query("SELECT SUM(`rating`) FROM `user_voice2` WHERE `id_kont` = '$ank[id]'"),0));
mysql_query("UPDATE `user` SET `rating` = '$ank[rating]' WHERE `id` = '$ank[id]' LIMIT 1");
if ($new_r>0)
mysql_query("INSERT INTO `mail` (`id_user`, `id_kont`, `msg`, `time`) values('0', '$ank[id]', '$user[nick] оставил положительный отзыв в [url=/who_rating.php]Вашей анкете[/url]', '$time')");
if ($new_r<0)
mysql_query("INSERT INTO `mail` (`id_user`, `id_kont`, `msg`, `time`) values('0', '$ank[id]', '$user[nick] оставил негативный отзыв в [url=/who_rating.php]Вашей анкете[/url]', '$time')");
if ($new_r==0)
mysql_query("INSERT INTO `mail` (`id_user`, `id_kont`, `msg`, `time`) values('0', '$ank[id]', '$user[nick] оставил нейтральный отзыв в [url=/who_rating.php]Вашей анкете[/url]', '$time')");
msg('Ваше мнение о пользователе успешно изменено');
}
aut();
$smarty_info = new Smarty_conf();
$posts=array();
//avatar($ank['id']);
$posts[]=array('img'=>avatar_path($ank['id']),'alt'=>'Аватар');
if ($ank['level'])$posts[]=array('status'=>$ank['group_name']);
$posts[]=array('ID',$ank['id']);
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `ban` WHERE `id_user` = '$ank[id]' AND `time` > '$time'"), 0)!=0)
{
$q=mysql_query("SELECT * FROM `ban` WHERE `id_user` = '$ank[id]' AND `time` > '$time' ORDER BY `time` DESC LIMIT 5");
while ($post = mysql_fetch_assoc($q))
{
$posts[]=array('Забанен до '.vremja($post['time']),$post['prich']);
}
}
else
{
$narush=mysql_result(mysql_query("SELECT COUNT(*) FROM `ban` WHERE `id_user` = '$ank[id]'"), 0);
$posts[]=array('Нарушений',$narush?$narush:'нет');
}
$posts[]=array('Реальное имя',$ank['ank_name']);
$posts[]=array('Пол',$ank['pol']?'мужской':'женский');
$posts[]=array('Город',$ank['ank_city']);
if ($ank['ank_d_r'] && $ank['ank_m_r'] && $ank['ank_g_r']){
$posts[]=array('Дата рождения',$ank['ank_d_r'].' '.rus_mes($ank['ank_m_r']).' '.$ank['ank_g_r']);
$ank['ank_age']=date("Y")-$ank['ank_g_r'];
if (date("n")<$ank['ank_m_r'])$ank['ank_age']=$ank['ank_age']-1;
elseif (date("n")==$ank['ank_m_r']&& date("j")<$ank['ank_d_r'])$ank['ank_age']=$ank['ank_age']-1;
$posts[]=array('Возраст',$ank['ank_age']);
}
elseif($ank['ank_d_r'] && $ank['ank_m_r'])$posts[]=array('День рождения',$ank['ank_d_r'].' '.rus_mes($ank['ank_m_r']));
$posts[]=array('<img src="http://web.icq.com/whitepages/online?icq='.$ank['ank_icq'].'&img=27" alt="icq" height="16" width="16" />',$ank['ank_icq']);
if ($ank['ank_mail'] && ($ank['set_show_mail'] || isset($user) && ($user['level']>$ank['level']))){
if (preg_match("#\@(mail|bk|inbox|list)\.ru$#i", $ank['ank_mail']))
$posts[]=array("<img src='http://status.mail.ru/?$ank[ank_mail]' width='13' height='13' alt='' />","<a href='mailto:$ank[ank_mail]'>$ank[ank_mail]</a>".($ank['set_show_mail']?null:' (скрыт)'));
else $posts[]=array('E-mail',"<a href='mailto:$ank[ank_mail]'>$ank[ank_mail]</a>".($ank['set_show_mail']?null:' (скрыт)'));
}
$posts[]=array('Телефон',$ank['ank_n_tel']);
$posts[]=array('О себе',output_text($ank['ank_o_sebe']));
$posts[]=array('Баллы',$ank['balls']);
$posts[]=array('Рейтинг',$ank['rating'].($ank['id']==$user['id']?" <a href='/who_rating.php'>[?]</a>":null));
$posts[]=array('Регистрация',vremja($ank['date_reg']));
$posts[]=array('Посл. посещение',vremja($ank['date_last']));
if (isset($user) && $user['level']>$ank['level']){
// показ IP - адресов
if (user_access('user_show_ip')){
if ($ank['ip'])$posts[]=array('IP',long2ip($ank['ip']).(user_access('adm_ban_ip')?" [<a href='/adm_panel/ban_ip.php?min=$ank[ip]'>Бан</a>]":null));
if (opsos($ank['ip']))$posts[]=array('Пров',opsos($ank['ip']));
if ($ank['ip_cl'])$posts[]=array('IP (CL)',long2ip($ank['ip_cl']).(user_access('adm_ban_ip')?" [<a href='/adm_panel/ban_ip.php?min=$ank[ip_cl]'>Бан</a>]":null));
if (opsos($ank['ip_cl']))$posts[]=array('Пров (CL)',opsos($ank['ip_cl']));
if ($ank['ip_xff'])$posts[]=array('IP (XFF)',long2ip($ank['ip_xff']).(user_access('adm_ban_ip')?" [<a href='/adm_panel/ban_ip.php?min=$ank[ip_xff]'>Бан</a>]":null));
if (opsos($ank['ip_xff']))$posts[]=array('Пров (XFF)',opsos($ank['ip_xff']));
}
// показ USER-AGENT (браузер)
if (user_access('user_show_ua') && $ank['ua'])$posts[]=array('UA',$ank['ua']);
}
if ($ank['show_url'] && otkuda($ank['url']))$posts[]=array('URL',"<a href='$ank[url]'>".otkuda($ank['url']).'</a>');
if (user_access('user_collisions') && $user['level']>$ank['level'])
{
$mass[0]=$ank['id'];
$collisions=user_collision($mass);
if (count($collisions))
{
$nicks=null;
for ($i=1;$i<count($collisions);$i++)
{
$ank_coll=get_user($collisions[$i]);
$nicks.=""<a href='/info.php?id=$ank_coll[id]'>$ank_coll[nick]</a>" ";
}
$posts[]=array('Ники',$nicks);
}
}
if (isset($user) && $user['id']!=$ank['id'] && $user['balls']>=50 && mysql_result(mysql_query("SELECT SUM(`rating`) FROM `user_voice2` WHERE `id_kont` = '$user[id]'"),0)>=0)
{
$my_r=intval(@mysql_result(mysql_query("SELECT `rating` FROM `user_voice2` WHERE `id_user` = '$user[id]' AND `id_kont` = '$ank[id]'"),0));
$my_rating=array();
for($i=-2;$i<=2;$i++)$my_rating[]=$my_r==$i?'['.$i.']':'<a href="?id='.$ank['id'].'&rating='.$i.'">'.$i.'</a>';
$posts[]=array('Мое отношение',implode(' ',$my_rating));
}
$smarty_info->assign('post',$posts);
$smarty_info->display('body.key-value.tpl');
/*
if (user_access('adm_ref') && ($ank['level']<$user['level'] || $user['id']==$ank['id']) && mysql_result(mysql_query("SELECT COUNT(*) FROM `user_ref` WHERE `id_user` = '$ank[id]'"), 0))
{
$q=mysql_query("SELECT * FROM `user_ref` WHERE `id_user` = '$ank[id]' ORDER BY `time` DESC LIMIT $set[p_str]");
echo "Посещаемые сайты:<br />\n";
while ($url=mysql_fetch_assoc($q)) {
$site=htmlentities($url['url'], ENT_QUOTES, 'UTF-8');
echo "<a".($set['web']?" target='_blank'":null)." href='/go.php?go=".base64_encode("http://$site")."'>$site</a> (".vremja($url['time']).")<br />\n";
}
echo "<br />\n";
}
*/
$smarty = new Smarty_conf();
$menu=array();
if (isset($user))
{
if ($user['id']!=$ank['id'])$menu[]=array('/mail.php?id='.$ank['id'],'Личное сообщение');
if ($user['id']==$ank['id'])$menu[]=array('/anketa.php','Изменить анкету');
}
$smarty->assign('menu',$menu);
$smarty->assign('menu_title','Навигация');
$smarty->assign('menu',$menu);
if ($menu)$smarty->display('links.links.tpl');
if (isset($user) && $user['level']>$ank['level'] && $user['id']!=$ank['id']){
$smarty = new Smarty_conf();
$menu=array();
if (user_access('user_prof_edit'))$menu[]=array("/adm_panel/user.php?id=$ank[id]",'Редактировать профиль');
if (user_access('user_ban_set') || user_access('user_ban_set_h') || user_access('user_ban_unset'))$menu[]=array("/adm_panel/ban.php?id=$ank[id]",'Нарушения (бан)');
if (user_access('user_delete'))
{
$menu[]=array("/adm_panel/delete_user.php?id=$ank[id]",'Удалить пользователя');
if (user_access('user_collisions') && count(user_collision($mass,1))>1)
$menu[]=array("/adm_panel/delete_user.php?id=$ank[id]&all",'Удалить все учетные записи');
}
if (user_access('adm_log_read') && $ank['level'] && ($ank['id']==$user['id'] || $ank['level']<$user['level']))
$menu[]=array("/adm_panel/adm_log.php?id=$ank[id]&all",'Отчет по администрированию');
$smarty->assign('menu',$menu);
$smarty->assign('menu_title','Управление');
$smarty->display('links.actions.tpl');
}
/*
if ($user['level']>$ank['level']){
if (user_access('user_prof_edit'))
echo "»<a href='/adm_panel/user.php?id=$ank[id]'>Редактировать профиль</a><br />\n";
if ($user['id']!=$ank['id']){
if (user_access('user_ban_set') || user_access('user_ban_set_h') || user_access('user_ban_unset'))
echo "»<a href='/adm_panel/ban.php?id=$ank[id]'>Нарушения (бан)</a><br />\n";
if (user_access('user_delete'))
{
echo "»<a href='/adm_panel/delete_user.php?id=$ank[id]'>Удалить пользователя</a>";
if (count(user_collision($mass,1))>1)
echo " (<a href='/adm_panel/delete_user.php?id=$ank[id]&all'>Все ники</a>)";
echo "<br />\n";
}
}
}
if (user_access('adm_log_read') && $ank['level']!=0 && ($ank['id']==$user['id'] || $ank['level']<$user['level']))
echo "»<a href='/adm_panel/adm_log.php?id=$ank[id]'>Отчет по администрированию</a><br />\n";
echo "</div>\n";
*/
echo '<hr color="DeepSkyBlue1" hr noshade size="1"></font>';
echo "«<a href='/love/index.php'>В знакомства</a><br/>\n";
include_once '../sys/inc/tfoot.php';
?>