Файл: test.masteram.us/present/incpresent.php
Строк: 43
<?
if(!isset($user))
{
$set['title']='Подарки';
include_once '../sys/inc/thead.php';
title();
err();
echo'Доступ закрыт не авторизированым пользователям<br/>';
include_once '../sys/inc/tfoot.php';
exit();
}
if (isset($_GET['user']) && mysql_result(mysql_query("SELECT COUNT(*) FROM `user` WHERE `id` = '".intval($_GET['user'])."'"),0))
{
if (isset($user) && isset($_GET['del']) && mysql_result(mysql_query("SELECT COUNT(*) FROM `present_give` WHERE `id_give` = '$user[id]' AND `id` = '".intval($_GET['del'])."'"),0))
{
mysql_query("DELETE FROM `present_give` WHERE `id` = '".intval($_GET['del'])."' LIMIT 1");
msg('Подарок удален');
}
$k_post=mysql_result(mysql_query("SELECT COUNT(*) FROM `present_give` WHERE `id_give` = '".intval($_GET['user'])."'"),0);
$k_page=k_page($k_post,$set['p_str']);
$page=page($k_page);
$start=$set['p_str']*$page-$set['p_str'];
if ($k_post==0)
{
echo "Нет подарковn";
}
$q=mysql_query("SELECT * FROM `present_give` WHERE `id_give` = '".intval($_GET['user'])."' ORDER BY `id` DESC LIMIT $start, $set[p_str]");
while ($post = mysql_fetch_array($q))
{
echo " <tr>n";
if($num==1){
echo " <div class='rer'>n";
$num=0;
}else{
echo " <div class='aut'>n";
$num=1;}
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `user` WHERE `id` = '$post[id_user]'"),0) && mysql_result(mysql_query("SELECT COUNT(*) FROM `present_list` WHERE `id` = '$post[id_p]'"),0))
{
$qp=mysql_query("SELECT * FROM `present_list` WHERE `id` = '$post[id_p]' LIMIT 1");
$p = mysql_fetch_array($qp);
echo"Подарок от <a href='/info.php?id=$post[id_user]'>".mysql_result(mysql_query("SELECT `nick` FROM `user` WHERE `id` = '$post[id_user]' LIMIT 1"),0)."</a><br/> <font color='#399bd4'>$p[name]</font><br />n";
echo"<img src='$p[url]' /><br />";
if($post['coment'] != NULL)echo"<font color='green'> $post[coment]</font><br />n";
if (isset($user) && $user['id'] == $post['id_give']) echo"[<a href='?user=".intval($_GET['user'])."&del=$post[id]'>Удалить</a>]<br />n";
echo "</div>n";
include_once '../sys/inc/tfoot.php';
?>