This repository has been archived by the owner on Dec 7, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 39
/
war.php
executable file
·191 lines (118 loc) · 6.88 KB
/
war.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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
<?php
require '/var/www/classes/Player.class.php';
require 'config.php';
require '/var/www/classes/Session.class.php';
require '/var/www/classes/PC.class.php';
require '/var/www/classes/System.class.php';
require '/var/www/classes/Process.class.php';
$session = new Session();
$system = new System();
require 'template/contentStart.php';
die("TODO");
$hardware = new HardwareVPC();
$process = new Process();
require 'template/templateTop.php';
require_once 'gameInfo.php';
if($session->issetLogin()){
require_once '/var/www/classes/Storyline.class.php';
$storyline = new Storyline();
$storylineProgress = $storyline->returnStorylineProgress();
$progress = explode(";", $storylineProgress);
if($progress['2'] == 1){
if($system->issetGet('action')){
$actionInfo = $system->switchGet('action', 'list', 'launch');
if($actionInfo['ISSET_GET'] == '1'){
switch($actionInfo['GET_VALUE']){
case 'list':
break;
case 'launch':
if($storyline->isUserLaunching($_SESSION['id']) == FALSE){
$launcherInfo = $storyline->launcherInfo($_SESSION['id']);
if($launcherInfo['ISSET'] == '1'){
$ramInfo = $hardware->calculateRamUsage($_SESSION['id'], 'VPC');
if($ramInfo['AVAILABLE'] >= $launcherInfo['RAM']){
if($system->issetGet('region')){
$regionInfo = $system->verifyNumericGet('region');
if($regionInfo['IS_NUMERIC'] == 1){
if($regionInfo['GET_VALUE'] > 0 || $regionInfo['GET_VALUE'] < 9){
$regions = explode("/", $_SESSION['CORP']['REGIONS']);
if($regionInfo['GET_VALUE'] != $regions['0'] && $regionInfo['GET_VALUE'] != $regions['1']){
$session->newQuery();
$sqlQuery = "INSERT INTO software_running (id, softID, userID, ramUsage, isNPC) VALUES ('', ?, ?, ?, '0')";
$sqlReg = $pdo->prepare($sqlQuery);
$sqlReg->execute(array($launcherInfo['ID'], $_SESSION['id'], $launcherInfo['RAM']));
$timeNow = $process->currentTimeToSec('', '');
$endTime = $timeNow + $launchDuration;
$session->newQuery();
$sql = "INSERT INTO storyline_launches (id, userID, status, startTime, endTime, region) VALUES
('', '".$_SESSION['id']."', '1', '".$timeNow."', '".$endTime."', '".$regionInfo['GET_VALUE']."')";
$pdo->query($sql);
$storyline->updateLauncherProgress('new');
echo 'EMP LAUNCHED against '.$storyline->returnRegionByID($regionInfo['GET_VALUE']).'!';
} else {
echo 'You cant attack your own region!';
}
} else {
die("Invalid region");
}
} else {
die("Invalid region!");
}
} else {
?>
<form action="" method="GET">
<input type="hidden" name="action" value="launch">
Choose a region to attack: <?php $storyline->regionForm(); ?><br/>
<input type="submit" value="Launch">
</form>
<?php
}
} else {
die("not enough ram to run launcher");
}
} else {
die("You dont have a launcher");
}
} else {
echo 'You already launched the EMPs.';
}
break;
}
} else {
die("Invalid get");
}
} elseif($system->issetGet('id')){
$idInfo = $system->verifyStringGet('id');
if($idInfo['IS_NUMERIC'] == '1'){
echo 'id';
} else {
die("Invalid ID");
}
} else {
$storyline->listLaunches();
}
} else {
if($progress['1'] == 1){
$step = 2;
} elseif($progress['0'] == 1){
$step = 1;
} else {
$step = 0;
}
switch($step){
case 0:
echo 'No big war news';
break;
case 1:
echo 'NASA vulnerable?';
break;
case 2:
echo 'NASA vulnerable!';
break;
}
}
require 'template/templateBot.php';
} else {
header("Location:logout.php");
}
?>