Файл: info.php
Строк: 515
<?
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($user))$ank['id']=$user['id'];
if (isset($_GET['id']))$ank['id']=intval($_GET['id']);
if ($ank['id']==0)
{
$ank=get_user($ank['id']);
$set['title']=$ank['nick'].' - анкета '; // заголовок страницы
include_once 'sys/inc/thead.php';
title();
aut();
echo "<span class="status">$ank[group_name]</span><br />n";
if ($ank['ank_o_sebe']!=NULL)echo "<span class="ank_n">О себе:</span> <span class="ank_d">$ank[ank_o_sebe]</span><br />n";
if(isset($_SESSION['refer']) && $_SESSION['refer']!=NULL && otkuda($_SESSION['refer']))
echo "<div class='foot'>«<a href='$_SESSION[refer]'>".otkuda($_SESSION['refer'])."</a><br />n</div>n";
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($_SESSION['refer']) || $_SESSION['refer']==NULL)
&& isset($_SERVER['HTTP_REFERER']) && $_SERVER['HTTP_REFERER']!=NULL &&
!preg_match('#info.php#',$_SERVER['HTTP_REFERER']))
$_SESSION['refer']=str_replace('&','&',preg_replace('#^http://[^/]*/#','/', $_SERVER['HTTP_REFERER']));
if (isset($_POST['rating']) && isset($user) && $user['id']!=$ank['id'] && mysql_result(mysql_query("SELECT SUM(`rating`) FROM `user_voice2` WHERE `id_kont` = '$user[id]'"),0)>=0)
{
$new_r=min(max(@intval($_POST['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();
include_once 's-klub/info/avatar.php';
include_once 's-klub/info/wmid.php';
include_once 's-klub/info/kosh.php';
include_once 's-klub/info/info.php';
include_once 's-klub/info/lich.php';
include_once 's-klub/info/svaz.php';
if (user_access('user_delete'))
{
if (!isset($_GET['aktiv']))
{
echo "<div class = 'shop'><div class = 'foot'>";
echo "<img src='/s-klub/ico/aktiv.png'> ";
echo "Активность <a href='/info.php?id=".$ank['id']."&aktiv'><img src='/s-klub/ico/infa.png'></a><br />";
echo "</div></div>";
}else{
echo "<div class = 'shop'><div class = 'foot'>";
echo "<img src='/s-klub/ico/aktiv.png'> ";
echo "Активность <a href='/info.php?id=".$ank['id']."'><img src='/s-klub/ico/del.png'></a><br />";
echo "</div></div>";
$k_them=mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_t` WHERE `id_user` = '$ank[id]'"),0);
echo "<div class = 'shop'>";
echo "<span class="ank_n">Тем в форуме:</span> <span class="ank_d">$k_them</span><br />n";
echo "</div>";
$k_p_forum=mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_p` WHERE `id_user` = '$ank[id]'"),0);
echo "<div class = 'shop'>";
echo "<span class="ank_n">Сообщений в форуме:</span> <span class="ank_d">$k_p_forum</span><br />n";
echo "</div>";
$zakl3=mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_zakl` WHERE `id_user` = '$ank[id]'"),0);
echo "<div class = 'shop'>";
echo "<span class="ank_n">Закладки:</span> <span class="ank_d">$zakl3</span><br />n";
echo "</div>";
$guest3=mysql_result(mysql_query("SELECT COUNT(*) FROM `guest` WHERE `id_user` = '$ank[id]'"),0);
echo "<div class = 'shop'>";
echo "<span class="ank_n">Гостевая:</span> <span class="ank_d">$guest3</span><br />n";
echo "</div>";
$mail3=mysql_result(mysql_query("SELECT COUNT(*) FROM `mail` WHERE `id_user` = '$ank[id]' OR `id_kont` = '$ank[id]'"),0);
echo "<div class = 'shop'>";
echo "<span class="ank_n">Приватные сообщения:</span> <span class="ank_d">$mail3</span><br />n";
echo "</div>";
$komm_loads=mysql_result(mysql_query("SELECT COUNT(*) FROM `loads_komm` WHERE `id_user` = '$ank[id]'"),0);
echo "<div class = 'shop'>";
echo "<span class="ank_n">Комментарии в загрузках:</span> <span class="ank_d">$komm_loads</span><br />n";
echo "</div>";
$news_komm=mysql_result(mysql_query("SELECT COUNT(*) FROM `news_komm` WHERE `id_user` = '$ank[id]'"),0);
echo "<div class = 'shop'>";
echo "<span class="ank_n">Комментарии новостей:</span> <span class="ank_d">$news_komm</span><br />n";
echo "</div>";
if (isset($access['show_all_info'])){
$user_voice=mysql_result(mysql_query("SELECT COUNT(*) FROM `user_voice2` WHERE `id_user` = '$ank[id]' OR `id_kont` = '$ank[id]'"),0);
echo "<div class = 'shop'>";
echo "<span class="ank_n">Рейтинги:</span> <span class="ank_d">$user_voice</span><br />n";
echo "</div>";
$votes_user=mysql_result(mysql_query("SELECT COUNT(*) FROM `votes_user` WHERE `u_id` = '$ank[id]'"),0);
echo "<div class = 'shop'>";
echo "<span class="ank_n">Голосования:</span> <span class="ank_d">$votes_user</span><br />n";
echo "</div>";
}
}
}
echo "<div class = 'shop'><div class = 'foot'>";
echo "<img src='/s-klub/ico/data.png'> ";
echo "Статистика<br />";
echo "</div></div>";
echo "<div class = 'shop'>";
echo "<span class="ank_n">Рейтинг:</span> <span class="ank_d">$ank[rating]</span><br />n";
echo "</div>";
$timediff=mysql_result(mysql_query("SELECT `time` FROM `user` WHERE `id` = '$ank[id]' LIMIT 1",$db), 0);
$oneMinute=60;
$oneHour=60*60;
$hourfield=floor(($timediff)/$oneHour);
$minutefield=floor(($timediff-$hourfield*$oneHour)/$oneMinute);
$secondfield=floor(($timediff-$hourfield*$oneHour-$minutefield*$oneMinute));
$sHoursLeft=$hourfield;
$sHoursText = "часов";
$nHoursLeftLength = strlen($sHoursLeft);
$h_1=substr($sHoursLeft,-1,1);
if (substr($sHoursLeft,-2,1) != 1 && $nHoursLeftLength>1)
{
if ($h_1== 2 || $h_1== 3 || $h_1== 4)
{
$sHoursText = "часа";
}
elseif ($h_1== 1)
{
$sHoursText = "час";
}
}
if ($nHoursLeftLength==1)
{
if ($h_1== 2 || $h_1== 3 || $h_1== 4)
{
$sHoursText = "часа";
}
elseif ($h_1== 1)
{
$sHoursText = "час";
}
}
$sMinsLeft =$minutefield;
$sMinsText = "минут";
$nMinsLeftLength = strlen($sMinsLeft);
$m_1=substr($sMinsLeft,-1,1);
if ($nMinsLeftLength>1 && substr($sMinsLeft,-2,1) != 1)
{
if ($m_1== 2 || $m_1== 3 || $m_1== 4)
{
$sMinsText = "минуты";
}
else if ($m_1== 1)
{
$sMinsText = "минута";
}
}
if ($nMinsLeftLength==1)
{
if ($m_1== 2 || $m_1==3 || $m_1== 4)
{
$sMinsText = "минуты";
}
elseif ($m_1== "1")
{
$sMinsText = "минута";
}
}
$displaystring="".
$sHoursLeft." ".
$sHoursText." ".
$sMinsLeft." ".
$sMinsText." ";
if ($timediff<0) $displaystring='дата уже наступила';
echo "<div class = 'shop'>";
echo "<span class="ank_n">Регистрация:</span> <span class="ank_d">".vremja($ank['date_reg'])."</span><br />n";
echo "</div>";
echo "<div class = 'shop'>";
echo "<span class="ank_n">На сайте провел:</span> <span class="ank_d">$displaystring</span><br />n";
echo "</div>";
echo "<div class = 'shop'>";
echo "<span class="ank_n">Посл. посещение:</span> <span class="ank_d">".vremja($ank['date_last'])."</span><br />n";
echo "</div>";
echo "<div class='shop'>n";
echo "<div class='foot'>n";
echo "<img src='/style/my_menu/who_rating.png' alt='' /> <a href='who_rating.php?id=$ank[id]'><b>Отзывы</b></a><br />n";
if (isset($user) && $user['id']!=$ank['id'])echo "<img src='/style/icons/mess0.png' alt='' /> <a href="/mail.php?id=$ank[id]"><b>Написать в приват</b></a><br />n";
echo "</div>n";
echo "</div>n";
if ($user['level']>$ank['level']){
if ($ank['ip']!=NULL){
if (user_access('user_show_ip') && $ank['ip']!=0){
echo "<span class="ank_n">IP:</span> <span class="ank_d">".long2ip($ank['ip'])."</span>";
if (user_access('adm_ban_ip'))
echo " [<a href='/adm_panel/ban_ip.php?min=$ank[ip]'>Бан</a>]";
echo "<br />n";
}
}
if ($ank['ip_cl']!=NULL){
if (user_access('user_show_ip') && $ank['ip_cl']!=0){
echo "<span class="ank_n">IP (CLIENT):</span> <span class="ank_d">".long2ip($ank['ip_cl'])."</span>";
if (user_access('adm_ban_ip'))
echo " [<a href='/adm_panel/ban_ip.php?min=$ank[ip_cl]'>Бан</a>]";
echo "<br />n";
}
}
if ($ank['ip_xff']!=NULL){
if (user_access('user_show_ip') && $ank['ip_xff']!=0){
echo "<span class="ank_n">IP (XFF):</span> <span class="ank_d">".long2ip($ank['ip_xff'])."</span>";
if (user_access('adm_ban_ip'))
echo " [<a href='/adm_panel/ban_ip.php?min=$ank[ip_xff]'>Бан</a>]";
echo "<br />n";
}
}
if (user_access('user_show_ua') && $ank['ua']!=NULL)
echo "<span class="ank_n">UA:</span> <span class="ank_d">$ank[ua]</span><br />n";
if (user_access('user_show_ip') && opsos($ank['ip']))
echo "<span class="ank_n">Пров:</span> <span class="ank_d">".opsos($ank['ip'])."</span><br />n";
if (user_access('user_show_ip') && opsos($ank['ip_cl']))
echo "<span class="ank_n">Пров (CL):</span> <span class="ank_d">".opsos($ank['ip_cl'])."</span><br />n";
if (user_access('user_show_ip') && opsos($ank['ip_xff']))
echo "<span class="ank_n">Пров (XFF):</span> <span class="ank_d">".opsos($ank['ip_xff'])."</span><br />n";
}
if ($ank['show_url']==1)
{
if (otkuda($ank['url']))echo "<span class="ank_n">URL:</span> <span class="ank_d"><a href='$ank[url]'>".otkuda($ank['url'])."</a></span><br />n";
}
if (user_access('user_collisions') && $user['level']>$ank['level'])
{
$mass[0]=$ank['id'];
$collisions=user_collision($mass);
if (count($collisions)>1)
{
echo "<span class="ank_n">Возможные ники:</span><br />n";
echo "<span class="ank_d">n";
for ($i=1;$i<count($collisions);$i++)
{
$ank_coll=mysql_fetch_assoc(mysql_query("SELECT * FROM `user` WHERE `id` = '$collisions[$i]' LIMIT 1"));
echo ""<a href='/info.php?id=$ank_coll[id]'>$ank_coll[nick]</a>"<br />n";
}
echo "</span>n";
}
}
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 "<div class='shop'>n";
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";
echo "</div>n";
}
echo "<div class='foot'>n";
if (isset($user) && $user['id']==$ank['id'])echo "»<a href="/anketa.php">Изменить анкету</a><br />n";
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";
if(isset($_SESSION['refer']) && $_SESSION['refer']!=NULL && otkuda($_SESSION['refer']))
echo "«<a href='$_SESSION[refer]'>".otkuda($_SESSION['refer'])."</a><br />n";
echo "</div>n";
include_once 'sys/inc/tfoot.php';
?>