Просмотр файла city2/supermarket.php

Размер файла: 12.07Kb
<?php
include "./../ini3.php";
include "./../includes/header2.php";


$id=cyr(htmlspecialchars(stripslashes(trim($id))));
$pass=cyr(htmlspecialchars(stripslashes(trim($pass))));

if(!empty($id)) 
{
$q = mysql_query("select * from users where id='".$id."';"); 
}
else
{
die ($lang['empty_login']."</body></html>");
}

$data = mysql_fetch_array($q);

$id=$data['id'];
$login=$data['login'];
$money=$data['money'];
$level=$data['level'];
$police=$data['police'];
$stage=$data['stage'];
$health=$data['health'];
$cars=$data['cars'];
$guns=$data['guns'];
$nums=$data['nums'];
$band=$data['band'];
$energy=$data['energy'];
$secur=$data['secur'];
$lox=$data['lox'];
$zav=$data['zav'];
$zav2=$data['zav2'];
$maska=$data['maska'];

if(md5($pass)!=$data['pass'])
{
die ($lang['empty_login']."</body></html>");
}

mysql_query("update users set last='".time()."',city='1' where id='".$id."';");

include "./../includes/inc_secur.php";
include "./../includes/inc_energy.php";
include "./../includes/inc_hospital.php";
include "./../includes/inc_police.php";
include "./../includes/inc_die.php";
include "./../includes/inc_voodoo.php";
include "./../includes/inc_attack.php";
include "./../includes/inc_mes.php";
print "<b>".$lang['game_city2']."</b><br/>";
print "<u>[".$lang['supermarket']."]</u><br/>";

$db=mysql_fetch_array(mysql_query("select * from krisha where city='2' and house='supermarket';"));
$bcity=$db['city'];
$bband=$db['band'];
$secur=$db['secur'];
$bmoney=$db['money'];
$btime=$db['time'];
$date=date("H:i d.m.Y");
$bank_band=mysql_fetch_array(mysql_query("select boss,euro from bands where name='".$bband."';"));
$boss=$bank_band['boss'];
$beuro=$bank_band['euro'];


if(empty($bmoney))
{
$bank_money=rand(100,12000);
mysql_query("update krisha set money='".$bank_money."' where city='2' and house='supermarket';");
}

switch ($mode) 
{  
  case "grab":

if(empty($guns) || ($bband==$band && $band!=''))
{
print $lang['uv_without_guns']."<br/>";
}
else
{
if(empty($a))
{
$guns_array = explode(".", $guns);
$count_guns=count($guns_array);
echo "<form action=\"supermarket.php?id=$id&amp;pass=$pass&amp;mode=grab\" method=\"post\">
";
echo $lang['cops_select_gun']."";
echo "<p><select name=\"at_gun\">";
for($i=0;$i<$count_guns;$i++)
{
echo "<option value=\"".$guns_array[$i]."\">".$guns_array[$i]."</option>";
}
echo "</select></p><br/>
<input type=\"hidden\" name=\"a\" value=\"b\"/>
<postfield name=\"at_gun\" value=\"$(at_gun)\"/>
<input class=\"ibutton\" type=\"submit\" value=\"".$lang['ok']."\"/>
   </form>";
}
else
{
if($at_gun==$lang['gun1'])$at_gun=1;
elseif($at_gun==$lang['gun2'])$at_gun=2;
elseif($at_gun==$lang['gun3'])$at_gun=3;
elseif($at_gun==$lang['gun4'])$at_gun=4;
elseif($at_gun==$lang['gun5'])$at_gun=5;
elseif($at_gun==$lang['gun6'])$at_gun=6;
elseif($at_gun==$lang['gun7'])$at_gun=7;
elseif($at_gun==$lang['gun8'])$at_gun=8;
elseif($at_gun==$lang['gun9'])$at_gun=9;
elseif($at_gun==$lang['gun10'])$at_gun=10;
elseif($at_gun==$lang['gun11'])$at_gun=11;
elseif($at_gun==$lang['gun12'])$at_gun=12;
elseif($at_gun==$lang['gun13'])$at_gun=13;
elseif($at_gun==$lang['gun14'])$at_gun=14;
elseif($at_gun==$lang['gun15'])$at_gun=15;
elseif($at_gun==$lang['gun16'])$at_gun=16;
elseif($at_gun==$lang['gun17'])$at_gun=17;
elseif($at_gun==$lang['gun18'])$at_gun=18;
elseif($at_gun==$lang['gun19'])$at_gun=19;
elseif($at_gun==$lang['gun20'])$at_gun=20;
elseif($at_gun==$lang['gun21'])$at_gun=21;

$gun_cop=rand(1,11);

if($gun_cop==1)$cop_gun=$lang['gun1'];
elseif($gun_cop==2)$cop_gun=$lang['gun2'];
elseif($gun_cop==3)$cop_gun=$lang['gun3'];
elseif($gun_cop==4)$cop_gun=$lang['gun4'];
elseif($gun_cop==5)$cop_gun=$lang['gun5'];
elseif($gun_cop==6)$cop_gun=$lang['gun6'];
elseif($gun_cop==7)$cop_gun=$lang['gun7'];
elseif($gun_cop==8)$cop_gun=$lang['gun8'];
elseif($gun_cop==9)$cop_gun=$lang['gun9'];
elseif($gun_cop==10)$cop_gun=$lang['gun10'];
elseif($gun_cop==11)$cop_gun=$lang['gun11'];


if($maska<time())$police=$police+3;
if($zav>time())$at_gun=$at_gun+1;
if($zav2>time())$at_gun=$at_gun+2;
if($gun_cop>$at_gun)
{
--$level;
if($level<0)$level=0;
$health=$health-90;
if($health<0) $health=0;
mysql_query("update users set health='".$health."',police='".$police."',level='".$level."' where id='".$id."';");
print $lang['bank_grab_fuck']." ".$cop_gun."!<br/>".$lang['bank_grab_health']." ".$health."%<br/>";
}
else
{
++$level;
$nagrab=rand(0,3000);
$grab_money=$money+$nagrab;
mysql_query("update users set money='".$grab_money."',police='".$police."',level='".$level."' where id='".$id."';");
print $lang['bank_grab_yeah']." ".$nagrab."$$<br/>";
}
}
}
 case "kr":

if(empty($bband) && !empty($band)) 
{


$bank_band=mysql_fetch_array(mysql_query("select boss,control from bands where name='".$band."';"));
$boss=$bank_band['boss'];
$control=$bank_band['control'];
if($control<15)$wit=$control*100;
elseif($cotrol>=15 && $control<30) $wit=$control*300;
elseif($control==30)$wit=25000;
mysql_query("insert into krisha values(0,'2','supermarket','500000','".$band."','$wit','');");
print "Теперь супермаркет крышует банда $band<br/>";
$db_boss=mysql_fetch_array(mysql_query("select id,pass from users where login='".$boss."';"));
$dbid=$db_boss['id'];
$dbpass=$db_boss['pass'];
$messaga="Теперь ваШа банда крыШует супермаркет. Вы можете снимать проценты каждый час";
mysql_query("insert into messagi values(0,'$band','$dbid','$messaga','1','$date');");
}
else
{
print $lang['error']."<br/>";
}
print "&gt;<a href=\"supermarket.php?id=$id&amp;pass=$pass\">Супермаркет</a><br/>";
    break;
 
 case "at_kr":
if(!empty($band) && $band!=$bband)
{
$band_array_att=mysql_fetch_array(mysql_query("select * from bands where name='".$band."';"));
$band_array_kr=mysql_fetch_array(mysql_query("select boss,blvl,secur from bands where name='".$bband."';"));

$blvl_att=$band_array_att['blvl'];
$sila=$band_array_att['sila'];
$control=$band_array_att['control'];
$guns_array = explode(".", $guns);
$count_guns=count($guns_array);
if($count_guns>15)$count_guns=15;
$uron=($blvl_att*rand(1,4))+($count_guns*rand(1,5))*$sila;
$uron2=$uron*2;
$boss_kr=$band_array_kr['boss'];
$blvl_kr=$band_array_kr['blvl'];
$secur_kr=$band_array_kr['secur'];

print "Урон вашей банды: <b>$uron2</b><br/>";
print "Урон охраны: <b>$secur</b><br/>";
if($uron2>=$secur && $secur_kr<time())
{
$bmoney=$bmoney+250000;
if($control<15)$wit=$control*100;
elseif($cotrol>=15 && $control<30) $wit=$control*300;
elseif($control==30)$wit=25000;
mysql_query("update krisha set band='".$band."',money='".$bmoney."',secur='$wit' where city='2' and house='supermarket';");
print "Теперь супермаркет крышует банда $band!<br/>";




}
elseif($uron2<$secur)
{
print "Вы не смогли победить охрану крышующей банды<br/>";
}
elseif($secur_kr>time())print "У этой банды есть крыша.Подожди,пока она закончится<br/>";

}
else
{
print $lang['error']."<br/>";
}


print "&gt;<a href=\"supermarket.php?id=$id&amp;pass=$pass\">Супермаркет</a><br/>";
    break;
 
  
  case "gp":
if(($btime+3600)<time() && $bmoney>=0)
{
$band_array=mysql_fetch_array(mysql_query("select boss,money from bands where name='".$bband."';"));
$percents=rand(500,12000);
$bmoney=$bmoney-$percents;
$band_money=$band_array['money'];
$band_boss=$band_array['boss'];
$band_money=$band_money+$percents;
mysql_query("update krisha set money='".$bmoney."',time='".time()."' where city='2' and house='supermarket';");
mysql_query("update bands set money='".$band_money."' where name='".$bband."';");
print $percents."$$ ".$lang['bank_now_at_obwak']."<br/>";
$db_boss=mysql_fetch_array(mysql_query("select id,pass from users where login='".$band_boss."';"));
$dbid=$db_boss['id'];
$dbpass=$db_boss['pass'];
$messaga="".$lang['bank_has_percents']."  ".$band_money."$$";
mysql_query("insert into mail values(0,'0','$bband','$messaga','1','$date');");
}
else{
if($btime+3600>time())print $lang['bank_kto-to']." ".$bband." ".$lang['bank_uje']."<br/>";
elseif($bmoney<=0) print 'В супермаркете больше нет денег<br/>';
}

print "&gt;<a href=\"supermarket.php?id=$id&amp;pass=$pass\">".$lang['supermarket']."</a><br/>";

    break;
case "secur":
if($boss==$login && $bband==$band){
	if($p==1 && $beuro>=300){
	$secur=$secur+300;
	$beuro=$beuro-300;
	mysql_query("update bands set euro='$beuro' where name='".$bband."';");
    mysql_query("update krisha set secur='$secur' where city='2' and house='supermarket';");
	print "Банда купила +300 к охране<br/>";
	}
	elseif($p==2 && $beuro>=900){
	$secur=$secur+1000;
	$beuro=$beuro-900;
	mysql_query("update bands set euro='$beuro' where name='".$bband."';");
    mysql_query("update krisha set secur='$secur' where city='1' and house='supermarket';");
	print "Банда купила +1000 к охране<br/>";
	}
	elseif($p==3 && $day>=1000 && $day<=100000 && $beuro>=800){
	$cena=ceil($day/100)*80;
	$secur=$secur+$day;
	$beuro=$beuro-$cena;
	mysql_query("update bands set euro='$beuro' where name='".$bband."';");
    mysql_query("update krisha set secur='$secur' where city='1' and house='supermarket';");
	print "Банда купила +$day к охране<br/>";
	}	
	else{
	print "Чтобы у вашей банды не отобрали крышу, ты можешь нанять охрану. Выбери нужный вариант:<br/>";
	print "<b>Двое вышибал</b><br/>";
	print "+300 к урону охраны<br/>";
	print "Стоимость: 300 <img src='a href=\./../../pic/euro.gif' title='Евро'/><br/>";
	print "<a href=\"supermarket.php?id=$id&amp;pass=$pass&amp;mode=secur&amp;p=1\">Нанять</a><br/>---<br/>";
	print "<b>Вооруженная группировка</b><br/>";
	print "+1000 к урону охраны<br/>";
	print "Стоимость: 900 <img src='a href=\./../../pic/euro.gif' title='Евро'/><br/>";
	print "<a href=\"supermarket.php?id=$id&amp;pass=$pass&amp;mode=secur&amp;p=2\">Нанять</a><br/>---<br/>";
	print "<b>Охранное бюро</b><br/>";
    print "<form action=\"supermarket.php?id=$id&amp;pass=$pass&amp;mode=secur&amp;p=3\" method=\"post\">
    <postfield name=\"day\" value=\"day\"/>";
    print "Какой бонус к охране нужен вашей банде?(Число от 1000 до 100000 должно быть кратно 100)<br/>";
	print "Стоимость: 80 <img src='a href=\./../../pic/euro.gif' title='Евро'/> за каждые 100 бонуса<br/>";
    print "<input name=\"day\" type=\"*N\"/>";
    print "<input class=\"button\" type=\"submit\" value=\"Нанять\"/></form>";


	}
	}
	break;
	
	
  default:
print $lang['supermarket_mes'];
if(!empty($bband)) print $lang['bank_krishuet'].": <b><a href=\"./../bands/viewband.php?id=$id&amp;pass=$pass&amp;band=".urlencode($bband)."\">".$bband."</a></b><br/>Охрана: $secur<br/>";
if($bband!=$band || $bband=='') print "<a href=\"supermarket.php?id=$id&amp;pass=$pass&amp;mode=grab\">".$lang['bank_grab']."</a><br/>";
if(empty($bband) && $band!='') print "<a href=\"supermarket.php?id=$id&amp;pass=$pass&amp;mode=kr\">".$lang['bank_krisha']."</a><br/>";
elseif(!empty($bband) && $bband!=$band && $band!='')
{
print "<a href=\"supermarket.php?id=$id&amp;pass=$pass&amp;mode=at_kr\">".$lang['bank_att_krisha']."</a><br/>";
}
if($band==$bband && $band!='')
{
print "В кассе: <b>$bmoney$$</b><br/>";
print "<a href=\"supermarket.php?id=$id&amp;pass=$pass&amp;mode=gp\">".$lang['bank_get_percent']."</a><br/>";
print "<a href=\"supermarket.php?id=$id&amp;pass=$pass&amp;mode=secur\">Нанять охрану</a><br/>";
}
  break;
}


print "---<br/>&gt;<a href=\"index.php?id=$id&amp;pass=$pass\">".$lang['in_city']."</a>";
print "<br/>&gt;&gt;<a href=\"./../game.php?id=$id&amp;pass=$pass\">".$lang['menu']."</a>";
print "<br/>---</body></html>";

mysql_close();
?>