⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 attack.php

📁 还是WEB游戏源码 Darkstep 还是WEB游戏源码 Darkstep
💻 PHP
字号:
<?php /* ------------------------- */

  include("_include-jail.php");

/* ------------------------- */ ?>
<html>

<head>
<title>[( Elite Avengers )]</title>
<link rel="stylesheet" type="text/css" href="css-v1.css">

</head>


<body>
<table width=100%>
  <tr><td class="subTitle"><b>Attack</b></td></tr>
<?php /* ------------------------- */

  if(round($data->signup/3600-time()/3600) + 12 <= 0) {
    $dbres				= mysql_query("SELECT `login`,UNIX_TIMESTAMP(`signup`) AS `signup`,`attack`,`defence`,`clicks`,`attlosses`,`attwins`,`deflosses`,`defwins`,`cash`,`type`,`health`,`clan`,`City`,`avatar`,`level` FROM `[users]` WHERE `login`='{$_GET['x']}' AND `activated`=1");
    if($def = mysql_fetch_object($dbres)) {
      if($data->bullets < 10)
        print "  <tr><td class=\"mainTxt\">You need to buy bullets!</td></tr>\n";
      else if($def->level <= 0)
        print "  <tr><td class=\"mainTxt\">You can't attack banned people!</td></tr>\n";
      else if(round(($def->vacationstart-time())+($def->vacation*3600*24)) >= 0)
        print "  <tr><td class=\"mainTxt\">This person is in vacation mode!</td></tr>\n";
      else if($def->health == 0)
        print "  <tr><td class=\"mainTxt\">You can't attack dead people!</td></tr>\n";
      else if($data->cash < 0)
        print "  <tr><td class=\"mainTxt\">You can't attack if your money is under 0!</td></tr>\n";
      else if($def->login == $data->login)
        print "  <tr><td class=\"mainTxt\">You hit your own head and you come out of consience...</td></tr>\n";
      else if($def->type == 3 && $data->type == 3)
        print "  <tr><td class=\"mainTxt\">Agents may not attack other agents!</td></tr>\n";
      else if($def->level > 50 OR $data->level > 50)
        print "  <tr><td class=\"mainTxt\">You may not attack Admins like the admins may not attack you!</td></tr>\n";
      else if($def->clan == $data->clan && $def->clan != "")
        print "  <tr><td class=\"mainTxt\">You may not attack crew mates!</td></tr>\n";
      else if(round($def->signup/3600-time()/3600) + 12 > 0)
        print "  <tr><td class=\"mainTxt\">{$def->login} is still under protection!!</td></tr>\n";
      else if($data->City != $def->City)
        print "  <tr><td class=\"mainTxt\">You need to be in the same state!<br> Search him with a <a href=\"detective.php\">Detective!</a></td></tr>\n";
      else {
        $dbres				= mysql_query("SELECT * FROM `[logs]` WHERE `login`='{$data->login}' AND `person`='{$def->login}' AND FLOOR(UNIX_TIMESTAMP(`time`)/(60*60*24))=FLOOR(UNIX_TIMESTAMP(NOW())/(60*60*24)) AND `area`='attack'");
        if(($numattacks = mysql_num_rows($dbres)+1) <= 5) {
          $dbres			= mysql_query("SELECT * FROM `[logs]` WHERE UNIX_TIMESTAMP(NOW())-UNIX_TIMESTAMP(`time`) < 10 AND `login`='{$data->login}' AND `area`='attack'");
          if(mysql_num_rows($dbres) == 0) {
            mysql_query("SELECT GET_LOCK('attack_{$def->login}',5)");
            $result			= (($data->attack+$data->clicks*5)*rand(90,115) >= ($def->defence+$def->clicks*5)*rand(90,115)) ? 1 : 0;
            $money			= ($result == 1) ? (int)($def->cash*rand(40,75)/100) : (int)($data->cash*rand(25,40)/100);
            $text			= ($result == 1) ? Array("you win!","won") : Array("you lose.","lost");
            $randbullets = rand(1,10);
            $bullets                             = round($data->bullets-$randbullets);

            $forwardedFor		= ($_SERVER['HTTP_X_FORWARDED_FOR'] != "") ? $_SERVER['HTTP_X_FORWARDED_FOR'] : $_SERVER['HTTP_CLIENT_IP'];
            $forwardedFor		= preg_replace('/, .+/','',$forwardedFor);
            mysql_query("INSERT INTO `[logs]`(`time`,`IP`,`forwardedFor`,`login`,`person`,`code`,`area`) values(NOW(),'{$_SERVER['REMOTE_ADDR']}','$forwardedFor','{$data->login}','{$def->login}',($money << 1) | $result,'attack')");
            if($result == 1) {
              mysql_query("UPDATE `[users]` SET `cash`=". ($def->cash-$money) .",`deflosses`=". ($def->deflosses+1) ." WHERE `login`='{$def->login}'");
              $data->cash		+= $money;
              $data->attwins++;
              mysql_query("UPDATE `[users]` SET `cash`={$data->cash},`attwins`={$data->attwins} WHERE `login`='{$data->login}'");
              mysql_query("UPDATE `[users]` SET `bullets`=`bullets`-$randbullets WHERE `login`='{$data->login}'");
            }
            else {
              $data->cash		-= $money;
              $data->attlosses++;
              mysql_query("UPDATE `[users]` SET `cash`={$data->cash},`attlosses`={$data->attlosses} WHERE `login`='{$data->login}'");
              mysql_query("UPDATE `[users]` SET `cash`=". ($def->cash+$money) .",`defwins`=". ($def->defwins+1) ." WHERE `login`='{$def->login}'");
              mysql_query("UPDATE `[users]` SET `bullets`=`bullets`-$randbullets WHERE `login`='{$data->login}'");
            }

           print "
             <table width=100% align=center>
   </tr>    <tr>
    <td align=\"center\"><img border=\"0\" src=\"".$data->avatar."\" width=\"150\" height=\"150\"><br>{$data->login}</td>
    <td class=\"mainTxt\"><center><b>VS</b><p>You attack {$def->login} and {$text[0]}<br>You have {$text[1]} \$$money...<br>You have $bullets bullets left.</center></td>
    <td align=\"center\"><img border=\"0\" src=\"".$def->avatar."\" width=\"150\" height=\"150\"><br>{$def->login}</td>
  </tr>
  </table>
  <tr><td class=\"mainTxt\">
	<center><br></td></tr>


            \n";

            mysql_query("SELECT RELEASE_LOCK('attack_{$def->login}')");
          }
          else {
            $type			= Array("ERROR","cadets","gangsters","agents");
            $type			= $type[$data->type];
            print "  <tr><td class=\"mainTxt\">Your $type are still tired of the last attack...</td></tr>\n";
          }
        }
        else
          print "  <tr><td class=\"mainTxt\">You already attacked {$def->login} 5x today...</td></tr>\n";
      }
    }
  }
  else
    print "  <tr><td class=\"mainTxt\">You can't attack someone if you're under protection!</td></tr>\n";

/* ------------------------- */ ?>
</table>

</body>

</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -