<?php
#Made By: ENK
#URL: http://wap-mast.su
#ICQ: net
#Mail: dcms7@spaces.ru
#Скрипт запрещено продавать, раздавать, менять, выкладывать, переписывать!
#Все права на скрипт принадлежат мне!
#Приду и снесу сайт
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';
$set['title']='Купить патроны';
include_once '../../sys/inc/thead.php';
title();
aut();

if(!isset($user)){
header("Location:/aut.php");
break;
}
$arr=mysql_fetch_array(mysql_query("SELECT * FROM `oxota` WHERE `ids`='$user[id]'"));
$action=htmlspecialchars(trim($_GET['action']));




switch ($action){
default:
echo "1) <a href='?action=1'>500 баллов - 10 патронов</a><br />\n";
echo "2) <a href='?action=2'>1000 баллов - 20 патронов</a><br />\n";
echo "3) <a href='?action=3'>1500 баллов - 30 патронов</a><br />\n";
echo "5) <a href='?action=4'>2000 баллов - 40 патронов</a><br />\n";
echo "6) <a href='?action=5'>2500 баллов - 50 патронов</a><br />\n";
echo "7) <a href='?action=6'>3000 баллов - 60 патронов</a><br />\n";
echo "8) <a href='?action=7'>3500 баллов - 70 патронов</a><br />\n";
echo "9) <a href='?action=8'>4000 баллов - 80 патронов</a><br />\n";
echo "10) <a href='?action=9'>4500 баллов - 90 патронов</a><br />\n";
echo "11) <a href='?action=10'>5000 баллов - 100 патронов</a><br />\n";
break;
######
case '1':
if($user['balls']<=499)
{
header ("Location: ?action=error&");
exit;
}else{
mysql_query("UPDATE `user` SET `balls` = '".($user['balls']-500)."' WHERE `id` = '$user[id]'");
mysql_query("UPDATE `oxota` SET `patron` = '".($arr['patron']+10)."' WHERE `ids` = '$user[id]'");
echo "<div class='msg'>Успешно!</div>";
}
break;
######
case '2':
if($user['balls']<=999)
{
header ("Location: ?action=error&");
exit;
}else{
mysql_query("UPDATE `user` SET `balls` = '".($user['balls']-1000)."' WHERE `id` = '$user[id]'");
mysql_query("UPDATE `oxota` SET `patron` = '".($arr['patron']+20)."' WHERE `ids` = '$user[id]'");
echo "<div class='msg'>Успешно!</div>";
}
break;
######
case '3':
if($user['balls']<=1499)
{
header ("Location: ?action=error&");
exit;
}else{
mysql_query("UPDATE `user` SET `balls` = '".($user['balls']-1500)."' WHERE `id` = '$user[id]'");
mysql_query("UPDATE `oxota` SET `patron` = '".($arr['patron']+30)."' WHERE `ids` = '$user[id]'");
echo "<div class='msg'>Успешно!</div>";
}
break;
######
case '4':
if($user['balls']<=1999)
{
header ("Location: ?action=error&");
exit;
}else{
mysql_query("UPDATE `user` SET `balls` = '".($user['balls']-2000)."' WHERE `id` = '$user[id]'");
mysql_query("UPDATE `oxota` SET `patron` = '".($arr['patron']+40)."' WHERE `ids` = '$user[id]'");
echo "<div class='msg'>Успешно!</div>";
}
break;
######
case '5':
if($user['balls']<=2499)
{
header ("Location: ?action=error&");
exit;
}else{
mysql_query("UPDATE `user` SET `balls` = '".($user['balls']-2500)."' WHERE `id` = '$user[id]'");
mysql_query("UPDATE `oxota` SET `patron` = '".($arr['patron']+50)."' WHERE `ids` = '$user[id]'");
echo "<div class='msg'>Успешно!</div>";
}
break;
######
case '6':
if($user['balls']<=2999)
{
header ("Location: ?action=error&");
exit;
}else{
mysql_query("UPDATE `user` SET `balls` = '".($user['balls']-3000)."' WHERE `id` = '$user[id]'");
mysql_query("UPDATE `oxota` SET `patron` = '".($arr['patron']+60)."' WHERE `ids` = '$user[id]'");
echo "<div class='msg'>Успешно!</div>";
}
break;
######
case '7':
if($user['balls']<=3499)
{
header ("Location: ?action=error&");
exit;
}else{
mysql_query("UPDATE `user` SET `balls` = '".($user['balls']-3500)."' WHERE `id` = '$user[id]'");
mysql_query("UPDATE `oxota` SET `patron` = '".($arr['patron']+70)."' WHERE `ids` = '$user[id]'");
echo "<div class='msg'>Успешно!</div>";
}
break;
######
case '8':
if($user['balls']<=3999)
{
header ("Location: ?action=error&");
exit;
}else{
mysql_query("UPDATE `user` SET `balls` = '".($user['balls']-4000)."' WHERE `id` = '$user[id]'");
mysql_query("UPDATE `oxota` SET `patron` = '".($arr['patron']+80)."' WHERE `ids` = '$user[id]'");
echo "<div class='msg'>Успешно!</div>";
}
break;
######
case '9':
if($user['balls']<=4499)
{
header ("Location: ?action=error&");
exit;
}else{
mysql_query("UPDATE `user` SET `balls` = '".($user['balls']-4500)."' WHERE `id` = '$user[id]'");
mysql_query("UPDATE `oxota` SET `patron` = '".($arr['patron']+90)."' WHERE `ids` = '$user[id]'");
echo "<div class='msg'>Успешно!</div>";
}
break;
######
case '10':
if($user['balls']<=4999)
{
header ("Location: ?action=error&");
exit;
}else{
mysql_query("UPDATE `user` SET `balls` = '".($user['balls']-5000)."' WHERE `id` = '$user[id]'");
mysql_query("UPDATE `oxota` SET `patron` = '".($arr['patron']+100)."' WHERE `ids` = '$user[id]'");
echo "<div class='msg'>Успешно!</div>";
}
break;

case'error':
echo "<div class='err'>У вас не хватает баллов!</div>";
break;
}


#####
echo "<div class='aut'><a href='index.php?id=$user[id]'>Назад</a></div>";
#####
include_once '../../sys/inc/tfoot.php';
?>