Hallo CP'ers,
Bij ons krijgen de spelers steeds, als ze bijvoorbeeld 20.000.000.000 contant hebben staan, en ze worden aangevallen, geld erbij. En bij de aanvaller gaat het geld in de -. We hebben van cash al een unsigned bigint(255) gemaakt maar het werkt nog steeds niet helaas. Weten jullie een oplossing?
Groeten,
Wotfnl.
Oja, het script:
PHP
<?php /* ------------------------- */
include("_include-config.php"); if(! check_login()) {
header("Location: login.php");
exit;
}
$dbres = mysql_query("SELECT *,UNIX_TIMESTAMP(`signup`) AS `signup`,UNIX_TIMESTAMP(`online`) AS `online` FROM `[users]` WHERE `login`='{$_SESSION['login']}'");
$data = mysql_fetch_object($dbres);
if($data->health > 0 )
{
print <<<ENDHTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base target="mainFrame" />
<link rel="stylesheet" type="text/css" href="css-v1.css">
</head>
<table align="center" width=100%>
<tr><td class="mainTxt">
<center>
<b><font color=red>Onderhoud!</font></b>
</td></tr>
</table>
</body>
</html>
ENDHTML;
exit;
}
/* ------------------------- */ ?>
<html>
<head>
<title></title>
</head>
<link rel="stylesheet" type="text/css" href="css-v1.css">
<table width=100%>
<tr><td class="subTitle"><b>Attack</b></td></tr>
<?php /* ------------------------- */
$boksen1 = mysql_query("SELECT *,UNIX_TIMESTAMP(`werken`) AS `werken`,0 FROM `[users]` WHERE `login`='$data->login'");
$boksen = mysql_fetch_object($boksen1);
$tijdverschil1 = $boksen->werken-time() - 12500;
$tijdverschil = date("i:s", "$tijdverschil1");
if($boksen->werken + $boksen->werken1 > time()){
print "<tr><td class=\"mainTxt\" align=\"center\">Je kan nog niet aanvallen want je bent nog voor $tijdverschil seconden aan het werken</td></tr>";
}
elseif(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`,`clan`,`avaurl` FROM `[users]` WHERE `login`='{$_GET['x']}'");
if($def = mysql_fetch_object($dbres)) {
if($def->login == $data->login)
print " <tr><td class=\"mainTxt\">Je staat klaar om aantevallen. En dan schiet je jezelf in je voet. Je hebt gelijkgespeelt tegen jezelf.</td></tr>\n";
else if($def->maffiamode ==1)
print " <tr><td class=\"mainTxt\"><center></center><br><font color=red><b>$def->login staat momenteel onder bescherming van de maffia!!</b></font> </td></tr>\n";
else if($def->type == 3 && $data->type == 3)
print " <tr><td class=\"mainTxt\">Agenten mogen elkaar niet aanvallen</td></tr>\n";
else if($def->clan == $data->clan && $def->clan != "")
print " <tr><td class=\"mainTxt\">Je mag niet mede-clan members aanvallen</td></tr>\n";
else if(round($def->signup/3600-time()/3600) + 12 > 0)
print " <tr><td class=\"mainTxt\">{$def->login} staat nog onder bescherming</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) <= 99999999999999999999999999999999999) {
$dbres = mysql_query("SELECT * FROM `[logs]` WHERE UNIX_TIMESTAMP(NOW())-UNIX_TIMESTAMP(`time`) < -1 AND `login`='{$data->login}' AND `area`='attack'");
if(mysql_num_rows($dbres) == 0) {
mysql_query("SELECT GET_LOCK('attack_{$def->login}',25)");
$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("je hebt gewonnen!","gewonnen") : Array("je verliest.","verloren");
print <<<ENDHTML
<table align=center width=100%>
<tr>
<td class="subTitle">{$data->login}</td>
<td class="subTitle">vs</td>
<td class="subTitle">{$def->login}</td>
</tr>
<tr>
<td class="mainTxt"><center><img border="0" src="/images/att1.png" width="231" height="221"></center></td>
<td class="mainTxt"></td>
<td class="mainTxt"><center><img border="0" src="/images/att2.png" width="231" height="221"></center></td>
</tr>
</table>
ENDHTML;
$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}'");
}
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}'");
}
print <<<ENDHTML
<html>
<head>
<title></title>
</head>
<table width=100%>
<tr><td class="mainTxt">
<center>Je valt {$def->login} aan en... {$text[0]}<br>Je hebt €$money {$text[1]}...</td></tr>\n
</center>
</td></tr>
</table>
</body>
</html>
ENDHTML;
mysql_query("SELECT RELEASE_LOCK('attack_{$def->login}')");
}
else {
$type = Array("","junkies","klonen","agenten","Terroristen","Gangsters");
$type = $type[$data->type];
$avatar = $avatar[$data->avatar];
print " <tr><td class=\"mainTxt\">Je $type zijn nog moe van de vorige aanval...</td></tr>\n";
}
}
else
print " <tr><td class=\"mainTxt\">Je hebt {$def->login} al 5x aangevallen dit uur...</td></tr>\n";
}
}
}
else
print " <tr><td class=\"mainTxt\">Je kunt niemand aanvallen wanneer je onder bescherming staat</td></tr>\n";
/* ------------------------- */ ?>
</table>
</body>
</html><table width=100%>
<tr><td class=Maintxt>
<a href="javascript:history.go(-1)">« Terug</a>
</tr></td>
Toon Meer