Просмотр файла gta/fight.php

Размер файла: 7.36Kb
  1. <?php
  2. #####################################################
  3. # mod by -=LesNIK=- #
  4. # icq 366244181 #
  5. # Официальный сайт мода http://wenz.net.ru #
  6. # все ответы на вопросы и помощь по скрипту #
  7. # вы можете получить только там! #
  8. # #
  9. # Вы не имеете право вносить #
  10. # свои изменения в данный мод!#
  11. # #
  12. # Уважайте труд автора! #
  13. #####################################################
  14.  
  15.  
  16. include "ini3.php";
  17. include "includes/header2.php";
  18. include "includes/inc_online.php";
  19. print "<p>";
  20.  
  21. $id=cyr(htmlspecialchars(stripslashes(trim($id))));
  22. $pass=cyr(htmlspecialchars(stripslashes(trim($pass))));
  23. $dbid=cyr(htmlspecialchars(stripslashes(trim($_GET[dbid]))));
  24.  
  25. if(!empty($id))
  26. {
  27. $q = mysql_query("select secur,id,login,pass,health,police,guns,money from users where id='".$id."';");
  28. }
  29. else
  30. {
  31. die ($lang['empty_login']."</small></p></card></wml>");
  32. }
  33.  
  34. if(!empty($dbid))
  35. {
  36. $qdb = mysql_query("select secur,id,login,pass,health,police,guns,money from users where id='".$dbid."';");
  37. }
  38. else
  39. {
  40. die ($lang['select_user_false']."</small></p></card></wml>");
  41. }
  42.  
  43. $data = mysql_fetch_array($q);
  44. $id=$data['id'];
  45. $login=$data['login'];
  46. $health=$data['health'];
  47. $police=$data['police'];
  48. $guns=$data['guns'];
  49. $money=$data['money'];
  50. $secur=$data['secur'];
  51.  
  52. $dbdata = mysql_fetch_array($qdb);
  53. $dblogin=$dbdata['login'];
  54. $dbpass=$dbdata['pass'];
  55. $dbhealth=$dbdata['health'];
  56. $dbpolice=$dbdata['police'];
  57. $dbguns=$dbdata['guns'];
  58. $dbmoney=$dbdata['money'];
  59. $dbsecur=$dbdata['secur'];
  60.  
  61. if($pass!=$data['pass'])
  62. {
  63. die ($lang['empty_login']."</small></p></card></wml>");
  64. }
  65.  
  66.  
  67.  
  68. mysql_query("update users set last='".time()."',city='0' where id='".$id."';");
  69.  
  70. if(!empty($dbsecur) && $dbsecur!=0) die ($lang['secur_oblom']."<br/><anchor>".$lang['back']."<prev/></anchor><br/>");
  71.  
  72.  
  73. $db=mysql_fetch_array(mysql_query("select userid,last from fights where userid='".$dbid."';"));
  74. $dbf=$db['userid'];
  75. if(empty($dbf))
  76. {
  77. mysql_query("insert into fights values(0,'$dbid','".time().".".$id."');");
  78. $db=mysql_fetch_array(mysql_query("select userid,last from fights where userid='".$dbid."';"));
  79. }
  80. else
  81. {
  82. $f_data = explode(".", $db['last']);
  83. $f_last = 300+intval($f_data[0]);
  84. $f_id= intval($f_data[1]);
  85.  
  86. if(time()>$f_last) mysql_query("delete from fights where userid='".$dbid."';");
  87.  
  88.  
  89. if($id!=$f_id || $id==$f_id) die ($lang['fi_already_fight']."<br/><anchor>".$lang['back']."<prev/></anchor><br/>");
  90.  
  91.  
  92. }
  93.  
  94. $user_power=rand(1,100);
  95. $db_user_power=rand(1,100);
  96.  
  97.  
  98. if($user_power>$db_user_power)
  99. {
  100. if(($dbhealth-$user_power)>0)
  101. {
  102. print $user_power." ".$lang['fi_mes_health']." ".$dblogin."<br/>";
  103. $dbhealth=$dbhealth-$user_power;
  104. mysql_query("update users set health='".$dbhealth."' where id='".$dbid."';");
  105. }
  106. else
  107. {
  108. print $lang['fi_chuvak_slab'];
  109. }
  110. if(($dbmoney-$user_power)>0)
  111. {
  112. print $db_user_power." ".$lang['fi_mes_money']." ".$dblogin."<br/>";
  113. $dbmoney=$dbmoney-$user_power;
  114. mysql_query("update users set money='".$dbmoney."' where id='".$dbid."';");
  115. $money=$money+$user_power;
  116. mysql_query("update users set money='".$money."' where id='".$id."';");
  117. }
  118. $dbguns_ar=explode(".",$dbguns);
  119. if(!empty($dbguns) && count($dbguns_ar)>1)
  120. {
  121. srand((double)microtime() *1000000);
  122. $rand_key = array_rand($dbguns_ar,2);
  123. $puwka=$dbguns_ar[$rand_key[0]];
  124.  
  125. $guns_count = explode(".", $dbguns);
  126. $count_guns=count($guns_count);
  127. if(!in_array($puwka,$guns_count)) die($lang['error']."<br/><anchor>".$lang['back']."<prev/></anchor><br/>");
  128.  
  129. if(empty($guns)) mysql_query("update users set guns='$puwka' where id='".$id."';");
  130. else mysql_query("update users set guns='$guns.$puwka' where id='".$id."';");
  131.  
  132. if($count_guns<=1)
  133. {
  134. $dbguns=str_replace("$puwka","","$dbguns");
  135. mysql_query("update users set guns='$dbguns' where id='".$dbid."';");
  136. }
  137. elseif($count_guns>1 && $guns_count[0]!=$puwka)
  138. {
  139. $dbguns=str_replace(".$puwka","","$dbguns");
  140. mysql_query("update users set guns='$dbguns' where id='".$dbid."';");
  141. }
  142. elseif($count_guns>1 && $guns_count[0]==$puwka)
  143. {
  144. $dbguns=str_replace("$puwka.","","$dbguns");
  145. mysql_query("update users set guns='$dbguns' where id='".$dbid."';");
  146. }
  147. print "<b>$puwka</b> ".$lang['uh_now_at_you']."<br/>";
  148. }
  149. ++$police;
  150. mysql_query("update users set police='".$police."' where id='".$id."';");
  151.  
  152. mysql_query("DELETE FROM messagi WHERE kto='".$id."' and komu='".$dbid."' limit 1;");
  153. $messaga="<b>".$lang['fi_fight_with_you']." <a href=\"./../userview.php?id=$dbid&amp;pass=$dbpass&amp;dbid=$id\">".$login."</a>!</b><br/>[<a href=\"./../mes.php?pass=$dbpass&amp;id=$dbid&amp;dbid=$id&amp;mode=del\">".$lang['mes_del']."</a>]";
  154. mysql_query("insert into messagi values(0,'$id','$dbid','$messaga');");
  155.  
  156. }
  157. else
  158. {
  159. if(($health-$user_power)>0)
  160. {
  161. print $lang['fi_false']." ".$user_power." ".$lang['fi_health']."<br/>";
  162. $health=$health-$user_power;
  163. mysql_query("update users set health='".$health."' where id='".$id."';");
  164. }
  165. else
  166. {
  167. print $lang['fi_you_looser'];
  168. }
  169. if(($money-$user_power)>0)
  170. {
  171. print $lang['fi_false']." ".$db_user_power."$$<br/>";
  172. $money=$money-$user_power;
  173. mysql_query("update users set money='".$money."' where id='".$id."';");
  174. $dbmoney=$dbmoney+$user_power;
  175. mysql_query("update users set money='".$dbmoney."' where id='".$dbid."';");
  176. }
  177. $guns_ar=explode(".",$guns);
  178. if(!empty($guns) && count($guns_ar)>1)
  179. {
  180. srand((double)microtime() *1000000);
  181. $rand_key = array_rand($guns_ar,2);
  182. $puwka=$guns_ar[$rand_key[0]];
  183.  
  184. $guns_count = explode(".", $guns);
  185. $count_guns=count($guns_count);
  186. if(!in_array($puwka,$guns_count)) die($lang['error']."<br/><anchor>".$lang['back']."<prev/></anchor><br/>");
  187.  
  188. if(empty($dbguns)) mysql_query("update users set guns='$puwka' where id='".$dbid."';");
  189. else mysql_query("update users set guns='$guns.$puwka' where id='".$dbid."';");
  190.  
  191. if($count_guns<=1)
  192. {
  193. $guns=str_replace("$puwka","","$guns");
  194. mysql_query("update users set guns='$guns' where id='".$id."';");
  195. }
  196. elseif($count_guns>1 && $guns_count[0]!=$puwka)
  197. {
  198. $guns=str_replace(".$puwka","","$guns");
  199. mysql_query("update users set guns='$guns' where id='".$id."';");
  200. }
  201. elseif($count_guns>1 && $guns_count[0]==$puwka)
  202. {
  203. $guns=str_replace("$puwka.","","$guns");
  204. mysql_query("update users set guns='$guns' where id='".$id."';");
  205. }
  206. print $dblogin." ".$lang['fi_otbilsya']."<b>".$puwka."</b> ".$lang['fi_now_u_nego']."<br/>";
  207. }
  208.  
  209.  
  210. mysql_query("DELETE FROM messagi WHERE kto='".$id."' and komu='".$dbid."' limit 1;");
  211. $messaga="<b>".$lang['fi_fight_with_you']." <a href=\"./../userview.php?id=$dbid&amp;pass=$dbpass&amp;dbid=$id\">".$login."</a>!</b><br/>[<a href=\"./../mes.php?pass=$dbpass&amp;id=$dbid&amp;dbid=$id&amp;mode=del\">".$lang['mes_del']."</a>]";
  212. mysql_query("insert into messagi values(0,'$id','$dbid','$messaga');");
  213.  
  214. }
  215.  
  216. $ref=mysql_fetch_array(mysql_query("select refer from refers where userid='".$id."';"));
  217. $link=$ref['refer'];
  218. if(empty($link))
  219. print "---<br/>&gt;<anchor>".$lang['back']."<prev/></anchor><br/>";
  220. else
  221. {
  222. $link=preg_replace ("'&'", "&amp;", $link);
  223. print "---<br/>&gt;<anchor>".$lang['back']."<prev/></anchor><br/>";
  224. }
  225.  
  226. print "&gt;&gt;<a href=\"game.php?id=$id&amp;pass=$pass\">".$lang['menu']."</a><br/>";
  227.  
  228. mysql_close();
  229. print "</body>
  230. </html>";
  231. ?>