Файл: vk.com_vhllam/games_xhata/sims/gift.php
Строк: 88
<?php
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/adm_check.php';
include_once '../../sys/inc/user.php';
$set['title']='The Sims';
include_once '../../sys/inc/thead.php';
title();
err();
aut();
if(!isset($user)){
echo 'Вы неавторизованы';
include_once '../../sys/inc/tfoot.php';
exit;
}
include_once 'inc/start.php';
echo '<div class="'.$diz['post_1'].'"><img src="i/15.png" /><b style="font-size:1.3em;"> Магазин игрушек</b><b style="font-size:1.3em;float:right;">'.date("H:i",time()).'</b></div>
';
if(isset($_REQUEST['id_u']) && isset($_GET['id']))
{
$id_u=abs(intval($_REQUEST['id_u']));
$id=abs(intval($_GET['id']));
$total=mysql_result(mysql_query("SELECT COUNT(*) FROM `sims_present` WHERE `id`='".$id."'"),0);
if($total==0)
{
header("location:gift.php");
exit;
}
$total=mysql_result(mysql_query("SELECT COUNT(*) FROM `sims_user` WHERE `id_u`='".$id_u."'"),0);
if($total==0 || $user_id==$id_u)
{
header("location:gift.php");
exit;
}
if(isset($_POST['submit3']) && $sims_user['money']>299)
{
$msg = mb_substr($_POST['msg'],0,512,'UTF-8');
$msg = sims_in($msg);
mysql_query("UPDATE `sims_user` SET `money`=`money`-300 WHERE `id_u`='".$user_id."'");
mysql_query("INSERT INTO `sims_presents`(`id_u`,`id_ank`,`id_p`,`msg`) VALUES('".$user_id."','".$id_u."','".$id."','".$msg."')");
header("Location:gifts.php?id=".$id_u);
exit;
}
echo "<div class='".$diz['post_2']."'>
<img src='i/p_".$id.".png' /><br/>
Подарок пользователю ".mysql_result(mysql_query("SELECT `name` FROM `sims_user` WHERE `id_u`='".$id_u."'"),0)." ".mysql_result(mysql_query("SELECT `fam` FROM `sims_user` WHERE `id_u`='".$id_u."'"),0)." <br/>
Текст поздравления :<br/> <form method='post' action='gift.php?id=".$id."&id_u=".$id_u."'>
<input name='msg' />
<input type='submit' name='submit3' value='»'/></form>
</div>";
}
else
{
if(isset($_GET['id']))
{
$id=abs(intval($_GET['id']));
$total=mysql_result(mysql_query("SELECT COUNT(*) FROM `sims_present` WHERE `id`='".$id."'"),0);
if($total==0)
{
header("location:gift.php");
exit;
}
echo "<div class='".$diz['post_2']."'>
<img src='i/p_".$id.".png' /><br/>
Выберите пользователя или введите его id<br/>
<form method='post' action='gift.php?id=".$id."'>
<input name='id_u' />
<input type='submit' name='submit' value='»'/></form>
</div>";
$quert=mysql_query("SELECT * FROM `sims_user` WHERE `id_u`!='".$user_id."' ORDER BY `id` ASC LIMIT ".$start.",5");
while($array=mysql_fetch_array($quert)){
echo '<div class="'.$diz['post_1'].'">
<table cellpadding="0">
<tr>
<td>
<img width="30" src="i/face_'.$array['face'].'.png" alt="." />
</td>
<td>
<a href="profile.php?id='.$array['id_u'].'"><b>'.$array['name'].' '.$array['fam'].'</b></a>
<br/>
<a href="gift.php?id='.$id.'&id_u='.$array['id_u'].'">Выбрать</a>
</td></tr></table></div>';
}
if ($total > 5)
echo sims_pagenav('gift.php?id='.$id.'&', $start, $total, 5);
sims_ret($diz['ret'],'Магазин игрушек','gift.php?');
}
else
{
$total=mysql_result(mysql_query("SELECT COUNT(*) FROM `sims_present`"),0);
if($total == 0)
echo 'Нет подарков';
else
{
$quert=mysql_query("SELECT * FROM `sims_present` ORDER BY `id` ASC LIMIT ".$start.",5");
while($array=mysql_fetch_array($quert)){
echo '<div class="'.$diz['post_1'].'">
<table cellpadding="0">
<tr>
<td>
<img width="50" src="i/p_'.$array['id'].'.png" alt="." />
</td>
<td>
<a href="gift.php?id='.$array['id'].'"><b> Подарить</b></a>
<br/>
300 $
</td></tr></table></div>';
}
if ($total > 5)
echo sims_pagenav('gift.php?', $start, $total, 5);
}
}
}
sims_ret($diz['ret'],'В город','city.php?');
sims_ret($diz['ret'],'Назад','index.php');
include_once '../../sys/inc/tfoot.php';
?>