Файл: test.masteram.us/sivor/index.php
Строк: 80
<?
error_reporting(0);
include '../Core.php';
$set['title'] = 'Сыворотка правды';
include_once '../sys/inc/thead.php';
title();
$ank['id'] = $user['id'];
if (isset($_GET['id']))$ank['id'] = intval($_GET['id']);
$q = mysql_query("SELECT * FROM `user` WHERE `id` = $ank[id] LIMIT 1");
$ank = mysql_fetch_array($q);
$qq=mysql_fetch_array(mysql_query("SELECT * FROM `sivor` ORDER BY RAND() "));
if (!isset($user)){
echo "Чтобы зайти в этот раздел надо зарегистрироваться!";
include_once '../sys/inc/tfoot.php';
}
if (isset($_GET['sivor_edit']))
{
mysql_query("UPDATE `user` SET `sivor_edit` = '".mysql_escape_string($_GET['sivor_edit'])."' WHERE `id` = '$user[id]' LIMIT 1");
header("Location: index.php");
}
if (isset($_GET['golos'])&&$_GET['id_ank']&&$_GET['sivor'])
{
if (isset($user) &&$ank['sivor_top']==0)
mysql_query("UPDATE `user` SET `sivor_top` = '1' WHERE `id` = '".mysql_escape_string($_GET['id_ank'])."' LIMIT 1");
$q_sivor=mysql_fetch_array(mysql_query("SELECT * FROM `sivor` WHERE `id`='".mysql_escape_string($_GET['sivor'])."'"));
mysql_query("INSERT INTO `sivor_user`(`id_user`, `id_ank`, `golos`, `name`) VALUES('".$user['id']."', '".mysql_escape_string($_GET['id_ank'])."', '".mysql_escape_string($_GET['golos'])."', '".$q_sivor['name']."')");
mysql_query("INSERT INTO `jurnal` (`id_user`, `id_kont`, `msg`, `time`) values('0', '".mysql_escape_string($_GET['id_ank'])."', 'Про вас ответили в игре [url=/sivor/spisok.php]Сыворотка правды[/url]', '$time')");
header("Location: index.php");
}
$k_post = mysql_result(mysql_query("SELECT COUNT(*) FROM `frends` WHERE `user` = '$ank[id]' AND `i` = '1'"), 0);
$k_page=k_page($k_post,$set['p_str']);
$page=page($k_page);
$start=$set['p_str']*$page-$set['p_str'];
echo '<table class="post">'."n";
if (isset($user) &&$ank['sivor_edit']==0)
$q = mysql_query("SELECT * FROM `frends` WHERE `user` = '$ank[id]' AND `i` = '1' AND `sivor_zapret` = '0' ORDER BY RAND(), time DESC LIMIT $start, 1");
if (isset($user) &&$ank['sivor_edit']==1)
$q = mysql_query("SELECT `id` FROM `user` WHERE `date_last` > '".(time()-600)."' ORDER BY RAND(),`date_last` DESC LIMIT $start, 1");
if (isset($user) &&$ank['sivor_edit']==2)
$q = mysql_query("SELECT `id` FROM `user` ORDER BY RAND(),`date_last` DESC LIMIT $start, 1");
while ($f = mysql_fetch_array($q))
{
if (isset($user) &&$ank['sivor_edit']==0)
$a = mysql_fetch_array(mysql_query("SELECT * FROM `user` WHERE `id` = '$f[frend]' LIMIT 1"));
else $a = mysql_fetch_array(mysql_query("SELECT * FROM `user` WHERE `id` = '$f[id]' LIMIT 1"));
///////////
$count= mysql_result(mysql_query("SELECT COUNT(*) FROM `sivor_user` WHERE `id_ank` = $user[id]",$db), 0);
echo '<div class="p_m"><center><center>Ответы про : <br/>';
if (isset($user) &&$ank['sivor_edit']==0) echo 'друзей |'; else echo '<a href="?sivor_edit=0">друзей</a> |';
if (isset($user) &&$ank['sivor_edit']==1) echo 'юзеров онлайн |'; else echo '<a href="?sivor_edit=1">юзеров онлайн</a> |';
if (isset($user) &&$ank['sivor_edit']==2) echo 'всех юзеров '; else echo '<a href="?sivor_edit=2">всех юзеров</a> ';
echo '</center></div>';
echo '<td class="gmenu"><center><a href="spisok.php">Ответы про меня ('.$count.')</a><br/>';
//////////
avatar($a['id']);
#echo '<br/><img src="/style/themes/'.$set['set_them'].'/user/'.$a['pol'].'.png" alt="" />';
echo '<a href="/info.php?id='.$a['id'].'">'.$a['nick'].'</a>'.online($a['id'])."n";
echo "<br/>$qq[name]<br/>";
echo ' <a href="?golos=1&id_ank='.$a['id'].'&sivor='.$qq['id'].'"><img src="img/b_yes.gif" alt=""></a> <a href="?golos=2&id_ank='.$a['id'].'&sivor='.$qq['id'].'"><img src="img/b_no.gif" alt=""></a><br/><a href="index.php">Пропустить</a></center></td>';
}
echo '</table>'."n";
if (isset($user)&&$user[level]>=3)echo "<div class=p_m><img src='img/nast.png' alt='!'> <a href='new_vopros.php'><font color=red>Создать вопрос</font></a><br/>n";
echo '<img src="img/nast.png" alt="!"> <a href="zapret.php">Настройки</a> <br/>';
echo '<img src="img/info.gif" alt="!"> <a href="user.php">Ответы про юзеров</a></div>';
include_once '../sys/inc/tfoot.php';
?>