Просмотр файла city1/sklad.php

Размер файла: 9.37Kb
  1. <?php
  2. include "./../ini.php";
  3. include "./../includes/header.php";
  4. include "./../includes/inc_online.php";
  5. print "<p><small>";
  6.  
  7. $id=cyr(htmlspecialchars(stripslashes(trim($id))));
  8. $pass=cyr(htmlspecialchars(stripslashes(trim($pass))));
  9.  
  10. if(!empty($id))
  11. {
  12. $q = mysql_query("select secur,golod,voodoo,nums,guns,cars,id,login,pass,money,level,police,health,zav,lsd,ban from users where id='".$id."';");
  13. }
  14. else
  15. {
  16. die ($lang['empty_login']."</small></p></card></wml>");
  17. }
  18.  
  19. $data = mysql_fetch_array($q);
  20.  
  21. $id=$data['id'];
  22. $login=$data['login'];
  23. $money=$data['money'];
  24. $level=$data['level'];
  25. $police=$data['police'];
  26. $stage=$data['stage'];
  27. $health=$data['health'];
  28. $cars=$data['cars'];
  29. $guns=$data['guns'];
  30. $nums=$data['nums'];
  31. $voo_por=$data['voodoo'];
  32. $golod=$data['golod'];
  33. $secur=$data['secur'];
  34. $zav=$data['zav'];
  35. $lsd=$data['lsd'];
  36. $ban=$data['ban'];
  37.  
  38. if($pass!=$data['pass'])
  39. {
  40. die ($lang['empty_login']."</small></p></card></wml>");
  41. }
  42.  
  43. mysql_query("update users set last='".time()."',city='1' where id='".$id."';");
  44. if($ban==0)
  45. {
  46.  
  47. include "./../includes/inc_secur.php";
  48. include "./../includes/inc_golod.php";
  49. include "./../includes/inc_hospital.php";
  50. include "./../includes/inc_police.php";
  51. include "./../includes/inc_die.php";
  52. include "./../includes/inc_voodoo.php";
  53. include "./../includes/inc_attack.php";
  54. include "./../includes/inc_mes.php";
  55.  
  56. print "<b>[Зд: $health %][Сыт: $golod %][Зщ: $secur %]</b><br/>";
  57. print "<b>".$lang['game_city1']."</b><br/>";
  58. print "<u>[".$lang['skl_naz']."]</u><br/>";
  59.  
  60. switch ($mode)
  61. {
  62. case "1":
  63.  
  64. if(empty($select))
  65. {
  66. print $lang['skl_you_want'];
  67. print '<a href="sklad.php?id='.$id.'&amp;pass='.$pass.'&amp;select=t&amp;mode=1">'.$lang['uv_cars'].'</a><br/>';
  68. print '<a href="sklad.php?id='.$id.'&amp;pass='.$pass.'&amp;select=o&amp;mode=1">'.$lang['uv_guns'].'</a><br/>';
  69. print '<a href="sklad.php?id='.$id.'&amp;pass='.$pass.'&amp;select=b&amp;mode=1">'.$lang['uv_money'].'</a><br/>';
  70. }
  71. elseif($select=='t')
  72. {
  73.  
  74. if(empty($tachka) || empty($komu))
  75. {
  76. if(!empty($cars))
  77. {
  78. $cars_count = explode(".", $cars);
  79. $count_cars=count($cars_count);
  80. print $lang['uv_cars']." <b>($count_cars)</b>:</small><br/>";
  81. print "<select name=\"tachka\">";
  82. for($i=0;$i<$count_cars;$i++)
  83. {
  84. print "<option value=\"".$cars_count[$i]."\">".$cars_count[$i]."</option>";
  85. }
  86. print "</select><br/>
  87. <small>".$lang['uh_mes_whom']."</small><br/>
  88. <input name=\"komu\"/><br/><small>
  89. <anchor>".$lang['bands_add']."
  90. <go href=\"sklad.php?id=$id&amp;pass=$pass&amp;select=t&amp;mode=1\" method=\"post\">
  91. <postfield name=\"tachka\" value=\"$(tachka)\"/>
  92. <postfield name=\"komu\" value=\"$(komu)\"/>
  93. </go>
  94. </anchor><br/>";
  95. }
  96. else
  97. {
  98. print $lang['bands_user_without_cars']."<br/>";
  99. }
  100. }
  101. else
  102. {
  103. $cars_count = explode(".", $cars);
  104.  
  105. if(!in_array($tachka,$cars_count)) die($lang['fa_car_false']."<br/><anchor>".$lang['back']."<prev/></anchor></small></p></card></wml>");
  106.  
  107. $komu_arr=mysql_fetch_array(mysql_query("select id from users where login='".$komu."';"));
  108.  
  109. $dbid=$komu_arr['id'];
  110. if(empty($dbid)) die($lang['voo_sel_us_err'].'<br/><anchor>'.$lang['back'].'<prev/></anchor></small></p></card></wml>');
  111.  
  112. mysql_query("insert into sklad values(0,'".$id."','".$dbid."','".$tachka."','1');");
  113.  
  114. $count_cars=count($cars_count);
  115. if($count_cars<=1)
  116. {
  117. $cars=str_replace("$tachka","","$cars");
  118. mysql_query("update users set cars='$cars' where id='".$id."';");
  119. }
  120. elseif($count_cars>1 && $cars_count[0]!=$tachka)
  121. {
  122. $cars=str_replace(".$tachka","","$cars");
  123. mysql_query("update users set cars='$cars' where id='".$id."';");
  124. }
  125. elseif($count_cars>1 && $cars_count[0]==$tachka)
  126. {
  127. $cars=str_replace("$tachka.","","$cars");
  128. mysql_query("update users set cars='$cars' where id='".$id."';");
  129. }
  130. print "<b>".$tachka."</b> ".$lang['skl_now_at_skl']."<br/>";
  131. }
  132.  
  133.  
  134. }
  135. elseif($select=='o')
  136. {
  137. if(empty($puwka) || empty($komu))
  138. {
  139. if(!empty($guns))
  140. {
  141. $guns_count = explode(".", $guns);
  142. $count_guns=count($guns_count);
  143. print $lang['uv_guns']." <b>($count_guns)</b>:</small><br/>";
  144. print "<select name=\"puwka\">";
  145. for($i=0;$i<$count_guns;$i++)
  146. {
  147. print "<option value=\"".$guns_count[$i]."\">".$guns_count[$i]."</option>";
  148. }
  149. print "</select><br/>
  150. <small>".$lang['uh_mes_whom']."</small><br/>
  151. <input name=\"komu\"/><br/><small>
  152. <anchor>".$lang['bands_add']."
  153. <go href=\"sklad.php?id=$id&amp;pass=$pass&amp;select=o&amp;mode=1\" method=\"post\">
  154. <postfield name=\"puwka\" value=\"$(puwka)\"/>
  155. <postfield name=\"komu\" value=\"$(komu)\"/>
  156. </go>
  157. </anchor><br/>";
  158. }
  159. else
  160. {
  161. print $lang['bands_user_without_guns']."<br/>";
  162. }
  163. }
  164. else
  165. {
  166. $guns_count = explode(".", $guns);
  167.  
  168. if(!in_array($puwka,$guns_count)) die($lang['error']."<br/><anchor>".$lang['back']."<prev/></anchor></small></p></card></wml>");
  169.  
  170. $komu_arr=mysql_fetch_array(mysql_query("select id from users where login='".$komu."';"));
  171.  
  172. $dbid=$komu_arr['id'];
  173. if(empty($dbid)) die($lang['voo_sel_us_err'].'<br/><anchor>'.$lang['back'].'<prev/></anchor></small></p></card></wml>');
  174.  
  175. mysql_query("insert into sklad values(0,'".$id."','".$dbid."','".$puwka."','2');");
  176.  
  177. $count_guns=count($guns_count);
  178. if($count_guns<=1)
  179. {
  180. $guns=str_replace("$puwka","","$guns");
  181. mysql_query("update users set guns='$guns' where id='".$id."';");
  182. }
  183. elseif($count_guns>1 && $guns_count[0]!=$puwka)
  184. {
  185. $guns=str_replace(".$puwka","","$guns");
  186. mysql_query("update users set guns='$guns' where id='".$id."';");
  187. }
  188. elseif($count_guns>1 && $guns_count[0]==$puwka)
  189. {
  190. $guns=str_replace("$puwka.","","$guns");
  191. mysql_query("update users set guns='$guns' where id='".$id."';");
  192. }
  193. print "<b>".$puwka."</b> ".$lang['skl_now_at_skl']."<br/>";
  194. }
  195.  
  196. }
  197. elseif($select=='b')
  198. {
  199.  
  200. if(empty($bablo) || empty($komu))
  201. {
  202. if(!empty($money))
  203. {
  204. print $lang['city1_at_you'].' '.$money.'$$.<br/>'.$lang['skl_ostav'].':</small><br/>';
  205. print "<input name=\"bablo\" format=\"*N\" size=\"5\"/>$$<br/>
  206. <small>".$lang['uh_mes_whom']."</small><br/>
  207. <input name=\"komu\"/><br/><small>
  208. <anchor>".$lang['bands_add']."
  209. <go href=\"sklad.php?id=$id&amp;pass=$pass&amp;select=b&amp;mode=1\" method=\"post\">
  210. <postfield name=\"bablo\" value=\"$(bablo)\"/>
  211. <postfield name=\"komu\" value=\"$(komu)\"/>
  212. </go>
  213. </anchor><br/>";
  214. }
  215. else
  216. {
  217. print $lang['voo_no_money'];
  218. }
  219. }
  220. else
  221. {
  222.  
  223. if(!intval($bablo) || empty($bablo) || ($money-$bablo)<0) die($lang['voo_no_money']."<anchor>".$lang['back']."<prev/></anchor></small></p></card></wml>");
  224.  
  225. $komu_arr=mysql_fetch_array(mysql_query("select id from users where login='".$komu."';"));
  226.  
  227. $dbid=$komu_arr['id'];
  228. if(empty($dbid)) die($lang['voo_sel_us_err'].'<br/><anchor>'.$lang['back'].'<prev/></anchor></small></p></card></wml>');
  229.  
  230. mysql_query("insert into sklad values(0,'".$id."','".$dbid."','".$bablo."','3');");
  231. mysql_query("update users set money='".$money."'-'".$bablo."' where id='".$id."';");
  232.  
  233. print "<b>".$bablo."</b>$$ ".$lang['skl_now_at_skl']."<br/>";
  234. }
  235.  
  236.  
  237. }
  238. else
  239. {
  240. print $lang['error'].'!<br/>';
  241. }
  242.  
  243. print "&gt;<a href=\"sklad.php?id=$id&amp;pass=$pass\">".$lang['skl_naz']."</a><br/>";
  244. break;
  245. case "2":
  246.  
  247.  
  248. if(!empty($_GET[chto]) && !empty($_GET[t]))
  249. {
  250.  
  251. $t=base64_decode($_GET[t]);
  252. $chto=urldecode($_GET[chto]);
  253.  
  254. if(mysql_num_rows(mysql_query("select id from sklad where (komu='".$id."' or kto='".$id."') and chto='".$chto."' and type='".$t."';"))<1) die($lang['error'].'<br/><anchor>'.$lang['back'].'<prev/></anchor></small></p></card></wml>');
  255.  
  256. if($t==1) mysql_query("update users set cars='".$cars.".".$chto."' where id='".$id."';");
  257. elseif($t==2) mysql_query("update users set guns='".$guns.".".$chto."' where id='".$id."';");
  258. elseif($t==3) mysql_query("update users set money='".$money."'+'".$chto."' where id='".$id."';");
  259.  
  260. mysql_query("delete from sklad where (komu='".$id."' or kto='".$id."') and chto='".$chto."' and type='".$t."' limit 1;");
  261.  
  262. if($t==3) print $chto.'$$ '.$lang['uh_now_at_you'].'!<br/>';
  263. else print $chto.' '.$lang['uh_now_at_you'].'!<br/>';
  264. }
  265.  
  266. $th_q = mysql_query("select * from sklad where komu='".$id."' or kto='".$id."' order by id desc limit 5;");
  267. if(mysql_num_rows($th_q)<1) print $lang['skl_no_th'];
  268. while($arrth=mysql_fetch_array($th_q))
  269. {
  270. $nick=mysql_fetch_array(mysql_query("select login from users where id='".$arrth['kto']."';"));
  271. if($login!=$nick['login'])
  272. {
  273. if($arrth[type]==3)
  274. print $arrth['chto']."$$ ".$lang['skl_ot']." ".$nick['login']."<br/>";
  275. else
  276. print $arrth['chto']." ".$lang['skl_ot']." ".$nick['login']."<br/>";
  277. }
  278. else
  279. {
  280. if($arrth[type]==3)
  281. print $arrth['chto']."$$ (".$lang['skl_your_th'].")<br/>";
  282. else
  283. print $arrth['chto']." (".$lang['skl_your_th'].")<br/>";
  284. }
  285. print '<a href="sklad.php?id='.$id.'&amp;pass='.$pass.'&amp;mode=2&amp;chto='.urlencode($arrth['chto']).'&amp;t='.base64_encode($arrth['type']).'">'.$lang['skl_zabr'].'</a><br/>';
  286. }
  287.  
  288. print "&gt;<a href=\"sklad.php?id=$id&amp;pass=$pass\">".$lang['skl_naz']."</a><br/>";
  289. break;
  290. default:
  291. print $lang['skl_enter'];
  292. print "<a href=\"sklad.php?id=$id&amp;pass=$pass&amp;mode=2\">".$lang['skl_zabr']."</a><br/>";
  293. print "<a href=\"sklad.php?id=$id&amp;pass=$pass&amp;mode=1\">".$lang['skl_put']."</a><br/>";
  294. break;
  295. }
  296.  
  297.  
  298. print "---<br/>&gt;<a href=\"index.php?id=$id&amp;pass=$pass\">".$lang['in_city']."</a>";
  299. print "<br/>&gt;&gt;<a href=\"./../game.php?id=$id&amp;pass=$pass\">".$lang['menu']."</a>";
  300. print "<br/>---";
  301.  
  302. mysql_close();
  303. include "./../includes/footer.php";
  304. }
  305.  
  306. elseif($ban==1)
  307. {
  308. die ($lang['empty_login']."</small></p></card></wml>");
  309.  
  310. }
  311. ?>