<?
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) && !isset($_GET['id'])){header("Location: /index.php?".SID);exit;}
if (isset($user))$ank['id']=$user['id'];
if (isset($_GET['id']))$ank['id']=intval($_GET['id']);
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `user` WHERE `id` = '$ank[id]' LIMIT 1"),0)==0){header("Location: /index.php?".SID);exit;}
$ank=mysql_fetch_array(mysql_query("SELECT * FROM `user` WHERE `id` = $ank[id] LIMIT 1"));
if ((!isset($_SESSION['refer']) || $_SESSION['refer']==NULL)
&& isset($_SERVER['HTTP_REFERER']) && $_SERVER['HTTP_REFERER']!=NULL &&
!ereg('gifts\.php',$_SERVER['HTTP_REFERER']))
$_SESSION['refer']=str_replace('&','&amp;',ereg_replace('^http://[^/]*/','/', $_SERVER['HTTP_REFERER']));

if (isset($user))
{
$p = (isset($_GET['p'])) ? htmlspecialchars($_GET['p']) : null;
switch($p){
case 'send_gifts':
include_once '../sys/inc/thead.php';
$set['title']='Отправить подарок'; // заголовок страницы
title();
aut();
$pid = intval($_GET['pid']);

if (isset($_GET['go'])){
$curr=date("d.m.y / H:i");
$balls = 50;
$msg=$_POST['msg'];
$ank['id'];
if($ank==0){
msg ('Пользователь не найден :(');
}else{if (isset($user) & $user['balls']<=$balls){
msg ('У Вас не достаточно денег :(');}else{

mysql_query("UPDATE `user` SET `balls` = '".($user['balls']-$balls)."' WHERE `id` = '$user[id]' LIMIT 1",$db);
mysql_query("UPDATE `user` SET `balls` = '".($ank['balls']+$balls)."' WHERE `id` = '$ank[id]' LIMIT 1");

mysql_query("INSERT INTO `fin_oper` (`user`, `oper`, `time`, `cena`) values('$user[id]', 'Отправлен подарок $balls KM для $ank[nick]', '$time', '$balls')",$db);

mysql_query("INSERT INTO `gifts` (`id_user`, `ot_id`, `text`, `time`, `id_gifts`) values('$ank[id]', '$user[id]', '$msg', '$time', '$pid')",$db);

$msgrat="$user[nick] подарил Вам подарок!";
mysql_query("INSERT INTO `mail` (`id_user`, `id_kont`, `msg`, `time`) values('0', '$ank[id]', '$msgrat', '$time')");
msg ('Отправка подарка успешно завершена :)');
}}
include_once '../sys/inc/tfoot.php';}
echo"<div class='faz'><img src='/gifts/".$pid.".png' alt='' class='icon'/></div>";
echo "<form method=\"post\" action=\"gifts.php?p=send_gifts&id=$ank[id]&pid=".$_GET['pid']."&go\">";
echo "Подарок для:<b> $ank[nick]</b><br /><br />\n";
echo "Ваше сообщение:<br />";
echo "<input type=\"text\" name=\"msg\" value=\"\"/><br />\r\n";
echo "<input type=\"submit\" value=\"Подарить\" />";
echo "</form>\n";
echo'<div class="faz">За отправку подарка с вашего счета будет снято <b>50 баллов</b></div>';
include_once '../sys/inc/tfoot.php';
break;
}
$pod = (isset($_GET['pod'])) ? htmlspecialchars($_GET['pod']) : null;
$set['title']='Подарки';
include_once '../sys/inc/thead.php';
title();
aut();
echo '<div class="dop_menu">';
switch($pod) {
case '1':
echo "<img src='/gifts/1.png' < width='45' height='45' alt=''> <a href=\"gifts.php?p=send_gifts&id=$ank[id]&pid=1\">Смартфон</a><br />";
echo "<img src='/gifts/2.png' < width='45' height='45' alt=''> <a href=\"gifts.php?p=send_gifts&id=$ank[id]&pid=2\">X-Box</a><br />";
echo "<img src='/gifts/3.png' < width='45' height='45' alt=''> <a href=\"gifts.php?p=send_gifts&id=$ank[id]&pid=3\">Скунс</a><br />";
echo "<img src='/gifts/4.png' < width='45' height='45' alt=''> <a href=\"gifts.php?p=send_gifts&id=$ank[id]&pid=4\">Туалетная бумага</a><br />";
echo "<img src='/gifts/5.png' < width='45' height='45' alt=''> <a href=\"gifts.php?p=send_gifts&id=$ank[id]&pid=5\">Банан</a><br />";
echo "<img src='/gifts/6.png' < width='45' height='45' alt=''> <a href=\"gifts.php?p=send_gifts&id=$ank[id]&pid=6\">Вкусный тортик</a><br />";
echo "<img src='/gifts/7.png' < width='45' height='45' alt=''> <a href=\"gifts.php?p=send_gifts&id=$ank[id]&pid=7\">Деньги</a><br />";
echo "<img src='/gifts/8.png' < width='45' height='45' alt=''> <a href=\"gifts.php?p=send_gifts&id=$ank[id]&pid=8\">Стринги</a><br />";
echo "<img src='/gifts/9.png' < width='45' height='45' alt=''> <a href=\"gifts.php?p=send_gifts&id=$ank[id]&pid=9\">Малиновый коктейль</a><br />";
echo "<img src='/gifts/10.png' < width='45' height='45' alt=''> <a href=\"gifts.php?p=send_gifts&id=$ank[id]&pid=10\">Гусеница</a><br /><br />";
echo "<br />\n";
echo " .. ";
echo "<a href=\"gifts.php?id=$ank[id]&pod=2\"> 2</a>\n";
echo "<a href=\"gifts.php?id=$ank[id]&pod=3\"> 3</a>\n";
echo "<a href=\"gifts.php?id=$ank[id]&pod=4\"> 4</a>\n";
echo "<a href=\"gifts.php?id=$ank[id]&pod=5\"> 5</a>\n";
echo "<a href=\"gifts.php?id=$ank[id]&pod=6\"> 6</a>\n";
echo "<a href=\"gifts.php?id=$ank[id]&pod=7\"> 7</a>\n";
break;
case '2':

echo "<img src='/gifts/11.png' < width='45' height='45' alt=''> <a href=\"gifts.php?p=send_gifts&id=$ank[id]&pid=11\">Подсолнух в очках</a><br />";
echo "<img src='/gifts/12.png' < width='45' height='45' alt=''> <a href=\"gifts.php?p=send_gifts&id=$ank[id]&pid=12\">Бaбёр</a><br />";
echo "<img src='/gifts/13.png' < width='45' height='45' alt=''> <a href=\"gifts.php?p=send_gifts&id=$ank[id]&pid=13\">Цыплёнок</a><br />";
echo "<img src='/gifts/14.png' < width='45' height='45' alt=''> <a href=\"gifts.php?p=send_gifts&id=$ank[id]&pid=14\">Медвежонок</a><br />";
echo "<img src='/gifts/15.png' < width='45' height='45' alt=''> <a href=\"gifts.php?p=send_gifts&id=$ank[id]&pid=15\">Супер животное</a><br />";
echo "<img src='/gifts/16.png' < width='45' height='45' alt=''> <a href=\"gifts.php?p=send_gifts&id=$ank[id]&pid=16\">Жирафик</a><br />";
echo "<img src='/gifts/17.png' < width='45' height='45' alt=''> <a href=\"gifts.php?p=send_gifts&id=$ank[id]&pid=17\">Жёлтая Утка</a><br />";
echo "<img src='/gifts/18.png' < width='45' height='45' alt=''> <a href=\"gifts.php?p=send_gifts&id=$ank[id]&pid=18\">Соска</a><br />";
echo "<img src='/gifts/19.png' < width='45' height='45' alt=''> <a href=\"gifts.php?p=send_gifts&id=$ank[id]&pid=19\">Кольца</a><br />";
echo "<img src='/gifts/20.png' < width='45' height='45' alt=''> <a href=\"gifts.php?p=send_gifts&id=$ank[id]&pid=20\">Ландыши</a><br />";

echo "<br />\n";
echo "<a href=\"gifts.php?id=$ank[id]&pod=1\"> 1</a>\n";
echo " .. ";
echo "<a href=\"gifts.php?id=$ank[id]&pod=3\"> 3</a>\n";
echo "<a href=\"gifts.php?id=$ank[id]&pod=4\"> 4</a>\n";
echo "<a href=\"gifts.php?id=$ank[id]&pod=5\"> 5</a>\n";
echo "<a href=\"gifts.php?id=$ank[id]&pod=6\"> 6</a>\n";
echo "<a href=\"gifts.php?id=$ank[id]&pod=7\"> 7</a>\n";
break;
case '3':
echo "<img src='/gifts/21.png' < width='45' height='45' alt=''> <a href=\"gifts.php?p=send_gifts&id=$ank[id]&pid=21\">Бoкал пива</a><br />";
echo "<img src='/gifts/22.png' < width='45' height='45' alt=''> <a href=\"gifts.php?p=send_gifts&id=$ank[id]&pid=22\">Зелёная Шляпа</a><br />";
echo "<img src='/gifts/23.png' < width='45' height='45' alt=''> <a href=\"gifts.php?p=send_gifts&id=$ank[id]&pid=23\">Веселая корова</a><br />";
echo "<img src='/gifts/24.png' < width='45' height='45' alt=''> <a href=\"gifts.php?p=send_gifts&id=$ank[id]&pid=24\">Роза</a><br />";
echo "<img src='/gifts/25.png' < width='45' height='45' alt=''> <a href=\"gifts.php?p=send_gifts&id=$ank[id]&pid=25\">Букет цветов</a><br />";
echo "<img src='/gifts/26.png' < width='45' height='45' alt=''> <a href=\"gifts.php?p=send_gifts&id=$ank[id]&pid=26\">Клубничка</a><br />";
echo "<img src='/gifts/27.png' < width='45' height='45' alt=''> <a href=\"gifts.php?p=send_gifts&id=$ank[id]&pid=27\">Танк</a><br />";
echo "<img src='/gifts/28.png' < width='45' height='45' alt=''> <a href=\"gifts.php?p=send_gifts&id=$ank[id]&pid=28\">Клыки вампира</a><br />";
echo "<img src='/gifts/29.png' < width='45' height='45' alt=''> <a href=\"gifts.php?p=send_gifts&id=$ank[id]&pid=29\">Катер</a><br />";
echo "<img src='/gifts/30.png' < width='45' height='45' alt=''> <a href=\"gifts.php?p=send_gifts&id=$ank[id]&pid=30\">Букет цветов</a><br />";
echo "<br />\n";
echo "<a href=\"gifts.php?id=$ank[id]&pod=1\"> 1</a>\n";
echo "<a href=\"gifts.php?id=$ank[id]&pod=2\"> 2</a>\n";
echo " .. ";
echo "<a href=\"gifts.php?id=$ank[id]&pod=4\"> 4</a>\n";
echo "<a href=\"gifts.php?id=$ank[id]&pod=5\"> 5</a>\n";
echo "<a href=\"gifts.php?id=$ank[id]&pod=6\"> 6</a>\n";
echo "<a href=\"gifts.php?id=$ank[id]&pod=7\"> 7</a>\n";
break;
case '4':

echo "<img src='/gifts/31.png' < width='45' height='45' alt=''> <a href=\"gifts.php?p=send_gifts&id=$ank[id]&pid=31\">Сердце</a><br />";
echo "<img src='/gifts/32.png' < width='45' height='45' alt=''> <a href=\"gifts.php?p=send_gifts&id=$ank[id]&pid=32\">Коала</a><br />";
echo "<img src='/gifts/33.png' < width='45' height='45' alt=''> <a href=\"gifts.php?p=send_gifts&id=$ank[id]&pid=33\">Гитара</a><br />";
echo "<img src='/gifts/34.png' < width='45' height='45' alt=''> <a href=\"gifts.php?p=send_gifts&id=$ank[id]&pid=34\">Сейф</a><br />";
echo "<img src='/gifts/35.png' < width='45' height='45' alt=''> <a href=\"gifts.php?p=send_gifts&id=$ank[id]&pid=35\">Кубок</a><br />";
echo "<img src='/gifts/36.png' < width='45' height='45' alt=''> <a href=\"gifts.php?p=send_gifts&id=$ank[id]&pid=36\">Домашний кинотеатр</a><br />";
echo "<img src='/gifts/37.png' < width='45' height='45' alt=''> <a href=\"gifts.php?p=send_gifts&id=$ank[id]&pid=37\">Дартс</a><br />";
echo "<img src='/gifts/38.png' < width='45' height='45' alt=''> <a href=\"gifts.php?p=send_gifts&id=$ank[id]&pid=38\">Робот</a><br />";
echo "<img src='/gifts/39.png' < width='45' height='45' alt=''> <a href=\"gifts.php?p=send_gifts&id=$ank[id]&pid=39\">Пудель</a><br />";
echo "<img src='/gifts/40.png' < width='45' height='45' alt=''> <a href=\"gifts.php?p=send_gifts&id=$ank[id]&pid=40\">Скейтборд</a><br />";

echo "<br />\n";
echo "<a href=\"gifts.php?id=$ank[id]&pod=1\"> 1</a>\n";
echo "<a href=\"gifts.php?id=$ank[id]&pod=2\"> 2</a>\n";
echo "<a href=\"gifts.php?id=$ank[id]&pod=3\"> 3</a>\n";
echo " .. ";
echo "<a href=\"gifts.php?id=$ank[id]&pod=5\"> 5</a>\n";
echo "<a href=\"gifts.php?id=$ank[id]&pod=6\"> 6</a>\n";
echo "<a href=\"gifts.php?id=$ank[id]&pod=7\"> 7</a>\n";

break;
case '5':

echo "<img src='/gifts/41.png' < width='45' height='45' alt=''> <a href=\"gifts.php?p=send_gifts&id=$ank[id]&pid=41\">Торт</a><br />";
echo "<img src='/gifts/42.png' < width='45' height='45' alt=''> <a href=\"gifts.php?p=send_gifts&id=$ank[id]&pid=42\">Кулон</a><br />";
echo "<img src='/gifts/43.png' < width='45' height='45' alt=''> <a href=\"gifts.php?p=send_gifts&id=$ank[id]&pid=43\">Мамонтёнок</a><br />";
echo "<img src='/gifts/44.png' < width='45' height='45' alt=''> <a href=\"gifts.php?p=send_gifts&id=$ank[id]&pid=44\">Золотой бык</a><br />";
echo "<img src='/gifts/45.png' < width='45' height='45' alt=''> <a href=\"gifts.php?p=send_gifts&id=$ank[id]&pid=45\">Мяч</a><br />";
echo "<img src='/gifts/46.png' < width='45' height='45' alt=''> <a href=\"gifts.php?p=send_gifts&id=$ank[id]&pid=46\">Золотая рыбка</a><br />";
echo "<img src='/gifts/47.png' < width='45' height='45' alt=''> <a href=\"gifts.php?p=send_gifts&id=$ank[id]&pid=47\">Пушистый зайчик</a><br />";
echo "<img src='/gifts/48.png' < width='45' height='45' alt=''> <a href=\"gifts.php?p=send_gifts&id=$ank[id]&pid=48\">Автомобиль</a><br />";
echo "<img src='/gifts/49.png' < width='45' height='45' alt=''> <a href=\"gifts.php?p=send_gifts&id=$ank[id]&pid=49\">Синий кот</a><br />";
echo "<img src='/gifts/50.png' < width='45' height='45' alt=''> <a href=\"gifts.php?p=send_gifts&id=$ank[id]&pid=50\">Самолёт</a><br />";

echo "<br />\n";
echo "<a href=\"gifts.php?id=$ank[id]&pod=1\"> 1</a>\n";
echo "<a href=\"gifts.php?id=$ank[id]&pod=2\"> 2</a>\n";
echo "<a href=\"gifts.php?id=$ank[id]&pod=3\"> 3</a>\n";
echo "<a href=\"gifts.php?id=$ank[id]&pod=4\"> 4</a>\n";
echo " .. ";
echo "<a href=\"gifts.php?id=$ank[id]&pod=6\"> 6</a>\n";
echo "<a href=\"gifts.php?id=$ank[id]&pod=7\"> 7</a>\n";

break;
case '6':

echo "<img src='/gifts/51.png' < width='45' height='45' alt=''> <a href=\"gifts.php?p=send_gifts&id=$ank[id]&pid=51\">Скутер</a><br />";
echo "<img src='/gifts/52.png' < width='45' height='45' alt=''> <a href=\"gifts.php?p=send_gifts&id=$ank[id]&pid=52\">Жёлтые кеды</a><br />";
echo "<img src='/gifts/53.png' < width='45' height='45' alt=''> <a href=\"gifts.php?p=send_gifts&id=$ank[id]&pid=53\">Тигрёнок</a><br />";
echo "<img src='/gifts/54.png' < width='45' height='45' alt=''> <a href=\"gifts.php?p=send_gifts&id=$ank[id]&pid=54\">Ролики</a><br />";
echo "<img src='/gifts/55.png' < width='45' height='45' alt=''> <a href=\"gifts.php?p=send_gifts&id=$ank[id]&pid=55\">Паучок</a><br />";
echo "<img src='/gifts/56.png' < width='45' height='45' alt=''> <a href=\"gifts.php?p=send_gifts&id=$ank[id]&pid=56\">Фотоаппарат</a><br />";
echo "<img src='/gifts/57.png' < width='45' height='45' alt=''> <a href=\"gifts.php?p=send_gifts&id=$ank[id]&pid=57\">Sony PS</a><br />";
echo "<img src='/gifts/58.png' < width='45' height='45' alt=''> <a href=\"gifts.php?p=send_gifts&id=$ank[id]&pid=58\">Набор косметики</a><br />";
echo "<img src='/gifts/59.png' < width='45' height='45' alt=''> <a href=\"gifts.php?p=send_gifts&id=$ank[id]&pid=59\">Велосипед</a><br />";
echo "<img src='/gifts/60.png' < width='45' height='45' alt=''> <a href=\"gifts.php?p=send_gifts&id=$ank[id]&pid=60\">Скейтборд</a><br />";

echo "<br />\n";
echo "<a href=\"gifts.php?id=$ank[id]&pod=1\"> 1</a>\n";
echo "<a href=\"gifts.php?id=$ank[id]&pod=2\"> 2</a>\n";
echo "<a href=\"gifts.php?id=$ank[id]&pod=3\"> 3</a>\n";
echo "<a href=\"gifts.php?id=$ank[id]&pod=4\"> 4</a>\n";
echo "<a href=\"gifts.php?id=$ank[id]&pod=5\"> 5</a>\n";
echo " .. ";
echo "<a href=\"gifts.php?id=$ank[id]&pod=7\"> 7</a>\n";

break;
case '7':

echo "<img src='/gifts/61.png' < width='45' height='45' alt=''> <a href=\"gifts.php?p=send_gifts&id=$ank[id]&pid=61\">Стакан пива</a><br />";
echo "<img src='/gifts/62.png' < width='45' height='45' alt=''> <a href=\"gifts.php?p=send_gifts&id=$ank[id]&pid=62\">Кружка пива</a><br />";
echo "<img src='/gifts/63.png' < width='45' height='45' alt=''> <a href=\"gifts.php?p=send_gifts&id=$ank[id]&pid=63\">Водка Столичная</a><br />";
echo "<img src='/gifts/64.png' < width='45' height='45' alt=''> <a href=\"gifts.php?p=send_gifts&id=$ank[id]&pid=64\">Водка Абсолют</a><br />";
echo "<img src='/gifts/65.png' < width='45' height='45' alt=''> <a href=\"gifts.php?p=send_gifts&id=$ank[id]&pid=65\">Водка Абсолют 100</a><br />";
echo "<img src='/gifts/66.png' < width='45' height='45' alt=''> <a href=\"gifts.php?p=send_gifts&id=$ank[id]&pid=66\">Водка Абсолют Курант</a><br />";
echo "<img src='/gifts/67.png' < width='45' height='45' alt=''> <a href=\"gifts.php?p=send_gifts&id=$ank[id]&pid=67\">Коньяк Hennesy</a><br />";
echo "<img src='/gifts/68.png' < width='45' height='45' alt=''> <a href=\"gifts.php?p=send_gifts&id=$ank[id]&pid=68\">Набор коньяка</a><br />";
echo "<img src='/gifts/69.png' < width='45' height='45' alt=''> <a href=\"gifts.php?p=send_gifts&id=$ank[id]&pid=69\">Сигареты Camel</a><br />";
echo "<img src='/gifts/70.png' < width='45' height='45' alt=''> <a href=\"gifts.php?p=send_gifts&id=$ank[id]&pid=70\">Сигареты Rothmans</a><br />";

echo "<br />\n";
echo "<a href=\"gifts.php?id=$ank[id]&pod=1\"> 1</a>\n";
echo "<a href=\"gifts.php?id=$ank[id]&pod=2\"> 2</a>\n";
echo "<a href=\"gifts.php?id=$ank[id]&pod=3\"> 3</a>\n";
echo "<a href=\"gifts.php?id=$ank[id]&pod=4\"> 4</a>\n";
echo "<a href=\"gifts.php?id=$ank[id]&pod=5\"> 5</a>\n";
echo "<a href=\"gifts.php?id=$ank[id]&pod=6\"> 6</a>\n";
echo " .. ";



}
echo '</div>';
}
else
{
include_once '../sys/inc/thead.php';
$set['title']='Отправить подарок';
title();
aut();
echo'А тебе это и не нужно :) Зарегайся для начала!';
}
include_once '../sys/inc/tfoot.php';
?>