<?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/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 `zona` WHERE `ids`='$user[id]'"));
$action=htmlspecialchars(trim($_GET['action']));
switch ($action){
default:
echo "Хмм...";
break;
######
case '1':
if($arr['zona_d1']<=39)
{
header ("Location: ?action=error&");
exit;
}else{
mysql_query("UPDATE `user` SET `rating` = '".($user['rating']+1)."' WHERE `id` = '$user[id]' LIMIT 1");
mysql_query("INSERT INTO `user_voice2` (`rating`, `id_user`, `id_kont`) VALUES ('1','0','$user[id]')");
mysql_query("UPDATE `zona` SET `zona_d1` = '".($arr['zona_d1']-40)."' WHERE `ids` = '$user[id]'");
echo "<div class='msg'>Успешно!</div>";
}
break;
######
case '2':
if($arr['zona_d2']<=9)
{
header ("Location: ?action=error&");
exit;
}else{
mysql_query("UPDATE `user` SET `rating` = '".($user['rating']+1)."' WHERE `id` = '$user[id]' LIMIT 1");
mysql_query("INSERT INTO `user_voice2` (`rating`, `id_user`, `id_kont`) VALUES ('1','0','$user[id]')");
mysql_query("UPDATE `zona` SET `zona_d2` = '".($arr['zona_d2']-10)."' WHERE `ids` = '$user[id]'");
echo "<div class='msg'>Успешно!<br /></div>\n";
}
break;
######
case '3':
if($arr['zona_d3']<=49)
{
header ("Location: ?action=error&");
exit;
}else{
mysql_query("UPDATE `user` SET `rating` = '".($user['rating']+1)."' WHERE `id` = '$user[id]' LIMIT 1");
mysql_query("INSERT INTO `user_voice2` (`rating`, `id_user`, `id_kont`) VALUES ('1','0','$user[id]')");
mysql_query("UPDATE `zona` SET `zona_d3` = '".($arr['zona_d3']-50)."' WHERE `ids` = '$user[id]'");
echo "<div class='msg'>Успешно!</div>\n";
}
break;
######
case '4':
if($arr['zona_d4']<=2)
{
header ("Location: ?action=error&");
exit;
}else{
mysql_query("UPDATE `user` SET `rating` = '".($user['rating']+3)."' WHERE `id` = '$user[id]' LIMIT 1");
mysql_query("INSERT INTO `user_voice2` (`rating`, `id_user`, `id_kont`) VALUES ('3','0','$user[id]')");
mysql_query("UPDATE `zona` SET `zona_d4` = '".($arr['zona_d4']-3)."' WHERE `ids` = '$user[id]'");
echo "<div class='msg'>Успешно!</div>\n";
}
break;
######
case '5':
if($arr['zona_d5']<=4)
{
header ("Location: ?action=error&");
exit;
}else{
mysql_query("UPDATE `user` SET `rating` = '".($user['rating']+1)."' WHERE `id` = '$user[id]' LIMIT 1");
mysql_query("INSERT INTO `user_voice2` (`rating`, `id_user`, `id_kont`) VALUES ('1','0','$user[id]')");
mysql_query("UPDATE `zona` SET `zona_d5` = '".($arr['zona_d5']-5)."' WHERE `ids` = '$user[id]'");
echo "<div class='msg'>Успешно!</div>\n";
}
break;
###########
case '6':
if($arr['zona_d6']<=2)
{
header ("Location: ?action=error&");
exit;
}else{
mysql_query("UPDATE `user` SET `rating` = '".($user['rating']+8)."' WHERE `id` = '$user[id]' LIMIT 1");
mysql_query("INSERT INTO `user_voice2` (`rating`, `id_user`, `id_kont`) VALUES ('8','0','$user[id]')");
mysql_query("UPDATE `zona` SET `zona_d6` = '".($arr['zona_d6']-3)."' WHERE `ids` = '$user[id]'");
echo "<div class='msg'>Успешно!</div>\n";
}
break;
###########
case '7':
if($arr['zona_d7']<=4)
{
header ("Location: ?action=error&");
exit;
}else{
mysql_query("UPDATE `user` SET `rating` = '".($user['rating']+15)."' WHERE `id` = '$user[id]' LIMIT 1");
mysql_query("INSERT INTO `user_voice2` (`rating`, `id_user`, `id_kont`) VALUES ('15','0','$user[id]')");
mysql_query("UPDATE `zona` SET `zona_d7` = '".($arr['zona_d7']-5)."' WHERE `ids` = '$user[id]'");
echo "<div class='msg'>Успешно!</div>\n";
}
break;
###########
case '8':
if($arr['zona_d8']<=2)
{
header ("Location: ?action=error&");
exit;
}else{
mysql_query("UPDATE `user` SET `rating` = '".($user['rating']+20)."' WHERE `id` = '$user[id]' LIMIT 1");
mysql_query("INSERT INTO `user_voice2` (`rating`, `id_user`, `id_kont`) VALUES ('20','0','$user[id]')");
mysql_query("UPDATE `zona` SET `zona_d8` = '".($arr['zona_d8']-3)."' WHERE `ids` = '$user[id]'");
echo "<div class='msg'>Успешно!</div>\n";
}
break;
case '9':
if($arr['zona_d9']<=2)
{
header ("Location: ?action=error&");
exit;
}else{
mysql_query("UPDATE `user` SET `rating` = '".($user['rating']+35)."' WHERE `id` = '$user[id]' LIMIT 1");
mysql_query("INSERT INTO `user_voice2` (`rating`, `id_user`, `id_kont`) VALUES ('35','0','$user[id]')");
mysql_query("UPDATE `zona` SET `zona_d9` = '".($arr['zona_d9']-3)."' WHERE `ids` = '$user[id]'");
echo "<div class='msg'>Успешно!</div>\n";
}
break;
#######
case'error':
echo "<div class='err'>Иди нахуй хаккер хуев!</div>";
break;
}
#####
echo "<div class='aut'><a href='toomb.php'>Назад</a></div>";
#####
include_once '../../sys/inc/tfoot.php';
?>