Файл: titwar.ru/func/funczdan/7_zavod_fabrika/zavod/weapon.php
Строк: 136
<?php
/////////////////////////////////////////////////////////////////////////////////////Обмундирование
$weapon = mysql_fetch_array(mysql_query("SELECT * FROM weapon WHERE id='$id'"));
if($_GET['a'] == weapon)
{
$levels = 1;
$weapon = addslashes($_POST['par']);
if ($weapon == 'speed' ) {$weapon2 = 'маневренность';}
if ($weapon == 'force' ) {$weapon2 = 'мощность';}
$weaponsss = mysql_fetch_array(mysql_query("SELECT * FROM weapon WHERE id='$id'"));
$tip = intval($_POST['tip']);
if ($tip == '0' and $weapon == 'speed' and $weaponsss[8] < 9 ) {$tip2 = 'пушек'; $cost=(($weaponsss[8]+$levels)*$levels)*160; $cost2=$cost*0.2; $cost3=$cost*0.5; $cost4=$cost*0.1; $who='sambr';}
if ($tip == '0' and $weapon == 'force' and $weaponsss[7] < 8 ) {$tip2 = 'пушек'; $cost=(($weaponsss[7]+$levels)*$levels)*180; $cost2=$cost*0.2; $cost3=$cost*0.5; $cost4=$cost*0.1; $who='samor';;}
if ($tip == '1' and $weapon == 'speed' and $weaponsss[10] < 9 ) {$tip2 = 'подрывников'; $cost=(($weaponsss[10]+$levels)*$levels)*40; $cost2=$cost*0.2; $cost3=$cost*0.5; $cost4=$cost*0.1; $who='tanbr';}
if ($tip == '1' and $weapon == 'force' and $weaponsss[9] < 8 ) {$tip2 = 'подрывников'; $cost=(($weaponsss[9]+$levels)*$levels)*60; $cost2=$cost*0.2; $cost3=$cost*0.5; $cost4=$cost*0.1; $who='tanor';}
if ($tip == '2' and $weapon == 'speed' and $weaponsss[12] < 9 ) {$tip2 = 'самолетов'; $cost=(($weaponsss[12]+$levels)*$levels)*210; $cost2=$cost*0.2; $cost3=$cost*0.5; $cost4=$cost*0.1; $who='zenbr';}
if ($tip == '2' and $weapon == 'force' and $weaponsss[11] < 8 ) {$tip2 = 'самолетов'; $cost=(($weaponsss[11]+$levels)*$levels)*220; $cost2=$cost*0.2; $cost3=$cost*0.5; $cost4=$cost*0.1; $who='zenor';}
if ($tip == '0' and $weapon == 'speed' and $weaponsss[8] == 9 ) {$tip2 = 'пушек'; $cost=2080; $cost2=416; $cost3=1040; $cost4=208; $who='sambr';}
if ($tip == '0' and $weapon == 'force' and $weaponsss[7] == 8 ) {$tip2 = 'пушек'; $cost=2140; $cost2=428; $cost3=1070; $cost4=214; $who='samor';;}
if ($tip == '1' and $weapon == 'speed' and $weaponsss[10] == 9 ) {$tip2 = 'подрывников'; $cost=520; $cost2=104; $cost3=260; $cost4=52; $who='tanbr';}
if ($tip == '1' and $weapon == 'force' and $weaponsss[9] == 8 ) {$tip2 = 'подрывников'; $cost=560; $cost2=112; $cost3=280; $cost4=56; $who='tanor';}
if ($tip == '2' and $weapon == 'speed' and $weaponsss[12] == 9 ) {$tip2 = 'самолетов'; $cost=2220; $cost2=444; $cost3=1110; $cost4=222; $who='zenbr';}
if ($tip == '2' and $weapon == 'force' and $weaponsss[11] == 8 ) {$tip2 = 'самолетов'; $cost=2380; $cost2=476; $cost3=1190; $cost4=238; $who='zenor';}
if ($tip == '0' and $weapon == 'speed' and $weaponsss[8] > 9 ) {$tip2 = 'пушек'; $cost=2260; $cost2=452; $cost3=1130; $cost4=226; $who='sambr';}
if ($tip == '0' and $weapon == 'force' and $weaponsss[7] > 8 ) {$tip2 = 'пушек'; $cost=2320; $cost2=464; $cost3=1160; $cost4=232; $who='samor';;}
if ($tip == '1' and $weapon == 'speed' and $weaponsss[10] > 9 ) {$tip2 = 'подрывников'; $cost=780; $cost2=156; $cost3=390; $cost4=78; $who='tanbr';}
if ($tip == '1' and $weapon == 'force' and $weaponsss[9] > 8 ) {$tip2 = 'подрывников'; $cost=860; $cost2=172; $cost3=430; $cost4=86; $who='tanor';}
if ($tip == '2' and $weapon == 'speed' and $weaponsss[12] > 9 ) {$tip2 = 'самолетов'; $cost=2480; $cost2=496; $cost3=1240; $cost4=248; $who='zenbr';}
if ($tip == '2' and $weapon == 'force' and $weaponsss[11] > 8 ) {$tip2 = 'самолетов'; $cost=2560; $cost2=512; $cost3=1280; $cost4=256; $who='zenor';}
if ($levels >0 and $levels <2)
{
if ($tip == '0' or $tip == '1' or $tip == '2')
{
if ($user[money] >= $cost and $user[stone] >= $cost2 and $user[lumber] >= $cost3 and $user[oil] >= $cost4)
{
echo 'Вы повысили <b>'.$weapon2.'</b> '.$tip2.' на <b>'.$levels.'</b> за <b>'.$cost.'</b> денег, <b>'.$cost2.'</b> камня, <b>'.$cost3.'</b> дерева, <b>'.$cost4.'</b> нефти!<br>';
mysql_query("UPDATE `weapon` SET `$who`=$who+'$levels' WHERE `id`='$user[id]'");///// оружие
mysql_query("UPDATE `users` SET `money`=money-'$cost' WHERE `id`='$user[id]'");///// оружие
mysql_query("UPDATE `users` SET `stone`=stone-'$cost2' WHERE `id`='$user[id]'");
mysql_query("UPDATE `users` SET `lumber`=lumber-'$cost3' WHERE `id`='$user[id]'");
mysql_query("UPDATE `users` SET `oil`=oil-'$cost4' WHERE `id`='$user[id]'");
}
else
{
echo '<br>Недостаточно ресурсов, необходимо: <b>'.$cost.'</b> денег, <b>'.$cost2.'</b> камня, <b>'.$cost3.'</b> дерева, <b>'.$cost4.'</b> нефти!<br>';
}
}
else
{
echo 'Ошибка!!!<br>';
}
}
else
{
echo 'Ошибка!!!<br>';
}
}
else
{
echo "<u>Параметры техники:</u><br>
Пушки:<br/>
<u>маневренность</u> [".$weapon[8]."]<br/>
<u>мощность</u> [".$weapon[7]."]<br/>
Подрывники:<br/>
<u>маневренность</u> [".$weapon[10]."]<br/>
<u>мощность</u> [".$weapon[9]."]<br/>
Самолеты:<br/>
<u>маневренность</u> [".$weapon[12]."]<br/>
<u>мощность</u> [".$weapon[11]."]<br/><br/>";
echo '
<form action="zavod.php?mod=weapon&a=weapon'.$ssilki2.'" method="post">
Увеличить параметры:<br/>
Тип войск:<br/>
<select name="tip">
<option value="0" selected="selected">Пушки</option>
<option value="1" >Подрывники</option><option value="2" >Самолеты</option>
</select><br/>
Параметр:<br/>
<select name="par">
<option value="speed" selected="selected">Маневренность</option>
<option value="force" >Мощность</option>
</select><br/>
<input type="submit" value="Увеличить">
</form>';
}
?>