Файл: info.php
Строк: 283
<?
include_once 'sys/includes/start.php';
include_once 'sys/includes/compress.php';
include_once 'sys/includes/sess.php';
include_once 'sys/includes/home.php';
include_once 'sys/includes/settings.php';
include_once 'sys/includes/db_connect.php';
include_once 'sys/includes/ipua.php';
include_once 'sys/includes/fnc.php';
include_once 'sys/includes/user.php';
$set['title']='Личная страница обитателя';
include_once 'sys/includes/header.php';
title();
auter();
if (isset($user))
{
$ank['id']=$user['id'];
}
if (isset($_GET['id']))
{
$ank['id']=intval($_GET['id']);
}
if ($ank['id']==0)
{
echo "<div class='err'>";
echo "<b>Данные о такой личной станице не найдены!</b>";
echo "</div>";
include_once 'sys/includes/footer.php';
exit;
}
$ank=get_user($ank['id']);
if (!$ank)
{
echo "<div class='err'>";
echo "<b>Данные о такой личной станице не найдены!</b>";
echo "</div>";
include_once 'sys/includes/footer.php';
exit;
}
$ank['rating']=intval(@mysql_result(mysql_query("SELECT SUM(`rating`) FROM `user_voice2` WHERE `id_kont` = '$ank[id]'"),0));
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('Ваше мнение о пользователе успешно изменено');
}
$timediff=mysql_result(mysql_query("SELECT `time` FROM `user` WHERE `id` = '".$ank['id']."' LIMIT 1",$db), 0);
$oneMinute=60;
$oneHour=60*60;
$oneDay=60*60*24;
$dayfield=floor($timediff/$oneDay);
$hourfield=floor(($timediff-$dayfield*$oneDay)/$oneHour);
$minutefield=floor(($timediff-$dayfield*$oneDay-$hourfield*$oneHour)/$oneMinute);
$secondfield=floor(($timediff-$dayfield*$oneDay-$hourfield*$oneHour-$minutefield*$oneMinute));
$sDaysLeft=$dayfield;
$sDaysText="дней";
$nDaysLeftLength=strlen($sDaysLeft);
$d_1=substr($sDaysLeft,-1,1);
if (substr($sDaysLeft,-2,1) !=1 && $nDaysLeftLength>1)
{
if ($d_1==2 || $d_1==3 || $d_1==4)
{
$sDaysText="дня";
}
else if ($d_1==1)
{
$sDaysText="день";
}
}
if ($nDaysLeftLength==1)
{
if ($d_1==2 || $d_1==3 || $d_1==4)
{
$sDaysText="дня";
}
else if ($d_1==1)
{
$sDaysText="день";
}
}
$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="часа";
}
else if ($h_1==1)
{
$sHoursText="час";
}
}
if ($nHoursLeftLength==1)
{
if ($h_1=2 || $h_1==3 || $h_1==4)
{
$sHoursText="часа";
}
else if ($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="минуты";
}
else if ($m_1=="1")
{
$sMinsText="минута";
}
}
$sSecsLeft=$secondfield;
$sSecsText="секунд";
$s_1=substr($sSecsLeft,-1,1);
$nSecsLeftLength = strlen($sSecsLeft);
if (substr($sSecsLeft,-2,1)!=1 && $nSecsLeftLength>1)
{
if ($s_1==2 || $s_1==3 || $s_1==4)
{
$sSecsText="секунды";
}
else if ($s_1==1)
{
$sSecsText="секунда";
}
}
if ($nSecsLeftLength==1)
{
if ($s_1==2 || $s_1==3 || $s_1==4)
{
$sSecsText="секунды";
}
else if ($sSecsLeft=="1")
{
$sSecsText="секунда";
}
}
$displaystring="".
$sDaysLeft." ".
$sDaysText." ".
$sHoursLeft." ".
$sHoursText." ".
$sMinsLeft." ".
$sMinsText." ".
$sSecsLeft." ".
$sSecsText;
if ($timediff<0)
{
$displaystring='Ошибка во времени!';
}
echo "<div class='title'>";
echo "<b>Личная страница ".$ank['nick']."</b>";
echo "</div>";
err();
if ($set['web']==true)
{
include_once H."s-klub/inc/info_web.php";
}else{
include_once H."s-klub/inc/info_wap.php";
}
if ($user['level']>$ank['level'])
{
if ($ank['ip']!=NULL)
{
if (user_access('user_show_ip') && $ank['ip']!=0)
{
echo "<div class='forum_tema'>";
echo "<b>IP:</b> ".long2ip($ank['ip'])."";
if (user_access('adm_ban_ip'))
{
echo " [<a href='/panel/ban_ip.php?min=$ank[ip]'>Бан</a>]";
}
echo "</div>";
}
}
if ($ank['ip_cl']!=NULL)
{
if (user_access('user_show_ip') && $ank['ip_cl']!=0)
{
echo "<div class='forum_tema'>";
echo "<b>IP (CLIENT):</b> ".long2ip($ank['ip_cl'])."";
if (user_access('adm_ban_ip'))
{
echo " [<a href='/panel/ban_ip.php?min=$ank[ip_cl]'>Бан</a>]";
}
echo "</div>";
}
}
if ($ank['ip_xff']!=NULL)
{
if (user_access('user_show_ip') && $ank['ip_xff']!=0)
{
echo "<div class='forum_tema'>";
echo "<b>IP (XFF):</b> ".long2ip($ank['ip_xff'])."";
if (user_access('adm_ban_ip'))
{
echo " [<a href='/panel/ban_ip.php?min=$ank[ip_xff]'>Бан</a>]";
}
echo "</div>";
}
}
if (user_access('user_show_ua') && $ank['ua']!=NULL)
{
echo "<div class='forum_tema'>";
echo "<b>UA:</b> ".$ank['ua']."<br />";
echo "</div>";
}
if (user_access('user_show_ip') && opsos($ank['ip']))
{
echo "<div class='forum_tema'>";
echo "<b>Пров:</b> ".opsos($ank['ip'])."<br />";
echo "</div>";
}
if (user_access('user_show_ip') && opsos($ank['ip_cl']))
{
echo "<div class='forum_tema'>";
echo "<b>Пров (CL):</b> ".opsos($ank['ip_cl'])."<br />";
echo "</div>";
}
if (user_access('user_show_ip') && opsos($ank['ip_xff']))
{
echo "<div class='forum_tema'>";
echo "<b>Пров (XFF):</b> ".opsos($ank['ip_xff'])."<br />";
echo "</div>";
}
}
if ($ank['show_url']==1)
{
if (otkuda($ank['url']))
{
echo "<div class='forum_tema'>";
echo "<b>URL:</b> <a href='".$ank['url']."'>".otkuda($ank['url'])."</a><br />";
echo "</div>";
}
}
if (user_access('user_collisions') && $user['level']>$ank['level'])
{
$mass[0]=$ank['id'];
$collisions=user_collision($mass);
if (count($collisions)>1)
{
echo "<div class='forum_tema'>";
echo "<b>Возможные ники:</b><br />";
echo "<span class='ank_d'>";
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 />";
}
echo "</span>";
echo "</div>";
}
}
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='forum_tema'>";
echo "<b>Посещаемые сайты:</b><br />";
echo "</div>";
while ($url=mysql_fetch_assoc($q))
{
echo "<div class='forum_tema'>";
$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 "</div>";
}
}
if (isset($user) && $user['id']==$ank['id'])
{
echo "<a href='/anketa.php'><div class='foot'>";
echo "<img src='/s-klub/img/ank-edit.png'> Изменить анкету";
echo "</div></a>";
}
if ($user['level']>$ank['level'])
{
if (user_access('user_prof_edit'))
{
echo "<a href='/panel/user.php?id=$ank[id]'><div class='foot'>";
echo "<img src='/s-klub/img/adm-user.png'> Редактировать профиль";
echo "</div></a>";
}
if ($user['id']!=$ank['id'])
{
if (user_access('user_ban_set') || user_access('user_ban_set_h') || user_access('user_ban_unset'))
{
$bans=mysql_result(mysql_query("SELECT COUNT(*) FROM `ban` WHERE `id_user` = '".$ank['id']."'"), 0);
echo "<div class='foot'>";
if (user_access('user_ban_set'))
{
echo "<img src='/s-klub/img/ban.png'> <a href='/panel/ban.php?id=$ank[id]'>Нарушения (".$bans.")</a><br />";
}
else if (user_access('user_ban_set_h'))
{
echo "<img src='/s-klub/img/ban.png'> <a href='/panel/ban_h.php?id=$ank[id]'>Нарушения (".$bans.")</a><br />";
}
echo "</div>";
}
if (user_access('user_delete'))
{
echo "<div class='foot'>";
echo "<img src='/s-klub/img/del.png'> <a href='/panel/delete_user.php?id=$ank[id]'>Удалить пользователя</a>";
if (count(user_collision($mass,1))>1)
{
echo " (<a href='/panel/delete_user.php?id=$ank[id]&all'>Все ники</a>)";
}
echo "</div>";
}
}
}
if (user_access('adm_log_read') && $ank['level']!=0 && ($ank['id']==$user['id'] || $ank['level']<$user['level']))
{
echo "<a href='/panel/adm_log.php?id=$ank[id]'><div class='foot'>";
echo "<img src='/s-klub/img/opis.png'> Отчет по администрированию";
echo "</div></a>";
}
include_once 'sys/includes/footer.php';
?>