Aanvallen |
werken-time() - 12500;
$tijdverschil = date("i:s", "$tijdverschil1");
if($boksen->werken + $boksen->werken1 > time()){
print "Je kan nog niet aanvallen want je bent nog voor $tijdverschil seconden aan het werken |
";
}
else{
$dbres = mysql_query("SELECT `login`,UNIX_TIMESTAMP(`signup`) AS `signup`,`attack`,`defence`,`clicks`,`attlosses`,`attwins`,`deflosses`,`defwins`,`cash`,`type`,`clan`,`url`,`level` FROM `[users]` WHERE `login`='".$_GET['x']."'");
$def = mysql_fetch_object($dbres);
$boksen11 = mysql_query("SELECT *,UNIX_TIMESTAMP(`huur`) AS `huur`,0 FROM `[users]` WHERE `login`='{$def->login}'");
$boksen1 = mysql_fetch_object($boksen11);
$queryBescherming = mysql_query("SELECT *,UNIX_TIMESTAMP(`bescherming`) AS `bescherming`,0 FROM `[users]` WHERE `login`='{$def->login}'");
$aBescherming = mysql_fetch_assoc($queryBescherming);
if($def->level < 0 && $def->cash > 9999999999999999)
{
echo 'hij is verbannen en heeft veeeel cash!';
exit;
}
$dbres = mysql_query("SELECT `login`,UNIX_TIMESTAMP(`signup`) AS `signup`,`attack`,`defence`,`clicks`,`attlosses`,`attwins`,`deflosses`,`defwins`,`cash`,`land`,`type`,`clan`,`url` FROM `[users]` WHERE `login`='{$_GET['x']}'");
if($def = mysql_fetch_object($dbres)) {
if($def->login == $data['login'])
print " Je slaat jezelf tegen je hoofd en valt bewusteloos neer... |
\n";
else if($aBescherming['bescherming'] + $aBescherming['beschermingtijd'] > time())
print "Deze persoon heeft bescherming ingehuurd Je kan hem niet aanvallen.. |
\n";
else if($def->type == 3 && $data['type'] == 3)
print " FBI Agents mogen elkaar niet aanvallen |
\n";
else if($def->clan == $data['clan'] && $def->clan != "")
print " Je mag niet mede-clan members aanvallen |
\n";
else if(round($def->signup/3600-time()/3600) + 12 > 0)
print " {$def->login} staat nog onder bescherming |
\n";
else {
$dbres = mysql_query("SELECT * FROM `allies` WHERE `login`='{$data['login']}' AND `person`='{$def->login}'");
if(mysql_num_rows($dbres) == 0) {
$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)+2) <= 10) {
$dbres = mysql_query("SELECT * FROM `[logs]` WHERE UNIX_TIMESTAMP(NOW())-UNIX_TIMESTAMP(`time`) < 2 AND `login`='{$data['login']}' AND `area`='attack'");
if(mysql_num_rows($dbres) == 0) {
mysql_query("SELECT GET_LOCK('attack_{$def->login}',2)");
$result = (($data['attack']+$data['clicks']*2)*rand(90,115) >= ($def->defence+$def->clicks*5)*rand(90,115)) ? 1 : 0;
$money = ($result == 1) ? ($def->cash*rand(40,75)/100) : ($data['cash']*rand(25,40)/100);
$text = ($result == 1) ? Array("je hebt gewonnen!","gewonnen") : Array("je verliest.","verloren");
$minhealth = rand(1,10);
$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) {
$result = (($def->cash-$money) > '-1') ? $def->cash-$money : '0';
mysql_query("UPDATE `[users]` SET `cash`=". $result .",`deflosses`=". ($def->deflosses+1) ." WHERE `login`='{$def->login}'");
$data['cash'] = (($data['cash']+$money) > '-1') ? $data['cash']+$money : '0';
$data['attwins']++;
mysql_query("UPDATE `[users]` SET `cash`={$data['cash']},`attwins`={$data['attwins']} WHERE `login`='{$data['login']}'");
}
else {
$result = (($def->cash+$money) > '-1') ? $def->cash+$money : '0';
$data['cash'] = (($data['cash']-$money) > '-1') ? $data['cash']-$money : '0';
$data['attlosses']++;
mysql_query("UPDATE `[users]` SET `cash`={$data['cash']},`attlosses`={$data['attlosses']} WHERE `login`='{$data['login']}'");
mysql_query("UPDATE `[users]` SET `cash`=". ($result) .",`defwins`=". ($def->defwins+1) ." WHERE `login`='{$def->login}'");
}
if($money < '0'){ $money = '0'; }
?>
Je valt =$def->login;?> aan en... =$text[0];?> Je hebt €=$money;?> =$text[1];?>... |
login}')");
}
else {
$type = Array("","junkies","gangsters","agenten");
$type = $type[$data['type']];
print " Je $type zijn nog moe van de vorige aanval. Je moet 2 seconden wachten tot je een nieuwe aanval kunt plegen! |
\n";
}
}
else
print " Je hebt {$def->login} al 10x aangevallen vandaag... |
\n";
}
else
print " Je kan {$def->login} niet aanvallen omdat {$def->login} een allie van je is. |
\n";
}
}
?>
} ?>