Файл: prod_zver.php
Строк: 71
<?php
require'../config.php';
$align='left';
$title='Дикая охота-Продажа';
aut();
head();
who_add(0,'enter');
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 "Хмм...";
break;
######
case '1':
if($arr['zver_a']<=49)
{
header ("Location: ?action=error&");
exit;
}else{
mysql_query("UPDATE `users` SET `rating` = `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 `oxota` SET `zver_a` = '".($arr['zver_a']-50)."' WHERE `ids` = '$user[id]'");
echo "<div class='msg'>Успешно!</div>";
}
break;
######
case '2':
if($arr['zver_b']<=39)
{
header ("Location: ?action=error&");
exit;
}else{
mysql_query("UPDATE `users` SET `rating` = `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 `oxota` SET `zver_b` = '".($arr['zver_b']-40)."' WHERE `ids` = '$user[id]'");
echo "<div class='msg'>Успешно!<br /></div>n";
}
break;
######
case '3':
if($arr['zver_c']<=9)
{
header ("Location: ?action=error&");
exit;
}else{
mysql_query("UPDATE `users` SET `rating` = `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 `oxota` SET `zver_c` = '".($arr['zver_c']-10)."' WHERE `ids` = '$user[id]'");
echo "<div class='msg'>Успешно!</div>n";
}
break;
######
case '4':
if($arr['zver_d']<=5)
{
header ("Location: ?action=error&");
exit;
}else{
mysql_query("UPDATE `users` SET `rating` = `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 `oxota` SET `zver_d` = '".($arr['zver_d']-6)."' WHERE `ids` = '$user[id]'");
echo "<div class='msg'>Успешно!</div>n";
}
break;
######
case '5':
if($arr['zver_e']<=2)
{
header ("Location: ?action=error&");
exit;
}else{
mysql_query("UPDATE `users` SET `rating` = `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 `oxota` SET `zver_e` = '".($arr['zver_e']-3)."' WHERE `ids` = '$user[id]'");
echo "<div class='msg'>Успешно!</div>n";
}
break;
###########
case '6':
if($arr['zver_f']<=2)
{
header ("Location: ?action=error&");
exit;
}else{
mysql_query("UPDATE `users` SET `rating` = `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 `oxota` SET `zver_f` = '".($arr['zver_f']-3)."' WHERE `ids` = '$user[id]'");
echo "<div class='msg'>Успешно!</div>n";
}
break;
###########
case '7':
if($arr['zver_h']<=2)
{
header ("Location: ?action=error&");
exit;
}else{
mysql_query("UPDATE `users` SET `rating` = `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 `oxota` SET `zver_h` = '".($arr['zver_h']-3)."' WHERE `ids` = '$user[id]'");
echo "<div class='msg'>Успешно!</div>n";
}
break;
###########
case '8':
if($arr['zver_i']<=2)
{
header ("Location: ?action=error&");
exit;
}else{
mysql_query("UPDATE `users` SET `rating` = `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 `oxota` SET `zver_i` = '".($arr['zver_i']-3)."' WHERE `ids` = '$user[id]'");
echo "<div class='msg'>Успешно!</div>n";
}
break;
case '9':
if($arr['zver_j']<=2)
{
header ("Location: ?action=error&");
exit;
}else{
mysql_query("UPDATE `users` SET `rating` = `rating` + '25' WHERE `id` = '$user[id]' LIMIT 1");
mysql_query("INSERT INTO `user_voice2` (`rating`, `id_user`, `id_kont`) VALUES ('25','0','$user[id]')");
mysql_query("UPDATE `oxota` SET `zver_j` = '".($arr['zver_j']-3)."' WHERE `ids` = '$user[id]'");
echo "<div class='msg'>Успешно!</div>n";
}
break;
#######
case'error':
echo "<div class='err'>У вас не хватает зверей!</div>";
break;
}
#####
echo "<div class='gb'><a href='xran.php'>Назад</a></div>";
#####
foot();
?>