Attack met leven
De bedoeling is om als je aangevallen wordt, er leven van 1 tot 5 eraf gaat.
dit is mijn code:
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
<?php /* ------------------------- */
include("_include-config.php");
if(! check_login()) {
header("Location: login.php");
exit;
}
mysql_query("UPDATE `[users]` SET `online`=NOW() WHERE `login`='{$data->login}'");
/* ------------------------- */ ?>
<html>
<head>
<title> Crimestate </title>
<link rel="stylesheet" type="text/css" href="<?php echo ($_COOKIE['v'] == 2) ? "css-v2.css" : "css-v1.css"; ?>">
</head>
<body style="background: #000000; margin: 0px;">
<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 minuten aan het werken</td></tr>";
}
else{
if(round($data->signup/3600-time()/3600) + 12 <= 0) {
$dbres = mysql_query("SELECT `login`,UNIX_TIMESTAMP(`signup`) AS `signup`,`attack`,`defence`,`land`,`clicks`,`attlosses`,`attwins`,`deflosses`,`defwins`,`cash`,`type`,`clan` FROM `[users]` WHERE `login`='{$_GET['x']}' AND `activated`=1");
if($def = mysql_fetch_object($dbres)) {
if($def->login == $data->login)
print " <tr><td class=\"mainTxt\">Je slaat jezelf tegen je hoofd en valt bewusteloos neer...</td></tr>\n";
else if($boksen1->huur + $boksen1->huur1 > time())
print "<tr><td class=\"mainTxt\" align=\"center\">Deze persoon heeft bescherming ingehuurd<br>Je kan hem niet aanvallen</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($def->land != $data->land)
print " <tr><td class=\"mainTxt\">Jij zit in $data->land en je tegenstander in $def->land dus kan je hem niet 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) <= 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("je hebt gewonnen!","gewonnen") : Array("je verliest.","verloren");
$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 " <tr><td class=\"mainTxt\">Je valt {$def->login} aan en... {$text[0]}<br>Je hebt \$$money {$text[1]}...</td></tr>\n";
mysql_query("SELECT RELEASE_LOCK('attack_{$def->login}')");
}
else {
$type = Array("","junkies","klonen","agenten");
$type = $type[$data->type];
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 vandaag...</td></tr>\n";
}
}
}
else
print " <tr><td class=\"mainTxt\">Je kunt niemand aanvallen wanneer je onder bescherm staat</td></tr>\n";
/* ------------------------- */ ?>
</table>
</body>
</html>
<?
}
?>
include("_include-config.php");
if(! check_login()) {
header("Location: login.php");
exit;
}
mysql_query("UPDATE `[users]` SET `online`=NOW() WHERE `login`='{$data->login}'");
/* ------------------------- */ ?>
<html>
<head>
<title> Crimestate </title>
<link rel="stylesheet" type="text/css" href="<?php echo ($_COOKIE['v'] == 2) ? "css-v2.css" : "css-v1.css"; ?>">
</head>
<body style="background: #000000; margin: 0px;">
<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 minuten aan het werken</td></tr>";
}
else{
if(round($data->signup/3600-time()/3600) + 12 <= 0) {
$dbres = mysql_query("SELECT `login`,UNIX_TIMESTAMP(`signup`) AS `signup`,`attack`,`defence`,`land`,`clicks`,`attlosses`,`attwins`,`deflosses`,`defwins`,`cash`,`type`,`clan` FROM `[users]` WHERE `login`='{$_GET['x']}' AND `activated`=1");
if($def = mysql_fetch_object($dbres)) {
if($def->login == $data->login)
print " <tr><td class=\"mainTxt\">Je slaat jezelf tegen je hoofd en valt bewusteloos neer...</td></tr>\n";
else if($boksen1->huur + $boksen1->huur1 > time())
print "<tr><td class=\"mainTxt\" align=\"center\">Deze persoon heeft bescherming ingehuurd<br>Je kan hem niet aanvallen</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($def->land != $data->land)
print " <tr><td class=\"mainTxt\">Jij zit in $data->land en je tegenstander in $def->land dus kan je hem niet 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) <= 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("je hebt gewonnen!","gewonnen") : Array("je verliest.","verloren");
$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 " <tr><td class=\"mainTxt\">Je valt {$def->login} aan en... {$text[0]}<br>Je hebt \$$money {$text[1]}...</td></tr>\n";
mysql_query("SELECT RELEASE_LOCK('attack_{$def->login}')");
}
else {
$type = Array("","junkies","klonen","agenten");
$type = $type[$data->type];
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 vandaag...</td></tr>\n";
}
}
}
else
print " <tr><td class=\"mainTxt\">Je kunt niemand aanvallen wanneer je onder bescherm staat</td></tr>\n";
/* ------------------------- */ ?>
</table>
</body>
</html>
<?
}
?>
Zulke vragen met betrekking tot criminals mogen hier niet gesteld worden...
....