forked from errorinn/netsim
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.php
114 lines (94 loc) · 3.07 KB
/
index.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
<?php
require_once 'login.inc.php';
if (LOGGEDIN && !isset($_GET['level'])) {
include 'listing.inc.php';
exit();
} else if (LOGGEDIN) {
$l = (int)$_GET['level'];
$q = $db->query("SELECT * FROM level WHERE id = ".$l);
$leveldata = $q->fetchArray();
if (!$leveldata) {
include 'header.inc.php';
?>
<div style="text-align:center; min-height:100%;">
<h3>Congratulations!</h3>
<p>You beat the last level in the game!</p>
<p><img src="./includes/fireworks.gif"></p>
<p>You may want to go <a href="./">look over the levels</a> to make sure you didn't miss any.</p>
<p>Otherwise, give yourself a pat on the back! You're a real hacker now!</p>
<div style="height:150px;"></div>
</div>
<?php
include 'footer.inc.php';
exit();
}
} else {
$leveldata = array('id' => -1, 'filename' => 'login/login', 'name' => 'CS4G Netsim');
}
?><!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>CS4G Network Simulator</title>
<script src="js/jquery-3.2.1.min.js"></script>
<script src="js/jquery-ui.min.js"></script>
<script src="js/phaser.min.js"></script>
<script src="js/ui.js"></script>
<script src="js/bindings.js"></script>
<script src="js/devicescripts.js"></script>
<link href="css/jquery-ui.min.css" rel="stylesheet">
<style type="text/css">
* { font-family:Arial, Helvetica, sans-serif; }
body { margin: 0; overflow:hidden; }
</style>
</head>
<body>
<script type="text/javascript">
<?php include 'phaser.inc.php'; ?>
</script>
<div id="game" style="float:left"></div>
<div id="pane" style="position:absolute;padding:20px;overflow:auto;">
<h1><?=$leveldata['name']?></h1>
<?php if (LOGGEDIN) { ?>
<input type="button" value="Level list" onclick="location.href='./'">
<?php } ?>
<div id="leveldescrip" style="overflow:auto;">
<?php include 'levels/'.$leveldata['filename'].'.html'; ?>
</div>
<input type="button" id="subpane_close" style="display:none" value="Level info" onclick="onSubpaneClose()">
<div id="subpane" style="display:none"></div>
</div>
<div id="editor" style="display:none;">
Sent from:
<select id="pktFrom">
<option>Alice</option>
<option>Bob</option>
<option>Carol</option>
</select><br>
<fieldset>
<legend>Network Layer</legend>
srcip: <input type="text" id="srcip"></input><br>
dstip: <input type="text" id="dstip"></input>
</fieldset>
<fieldset>
<legend>Transport Layer</legend>
payload: <input type="text" id="payload"></input><br>
proto: <input type="text" id="other"></input>
</fieldset>
</div>
<div id="winner" style="display:none;">
<p>You won the level! Congrats!</p>
</div>
<div id="footer" style="position:absolute;bottom:0.5em;right:0.5em;font-size:0.5em">
created by
<a href="https://erinn.io/">erinn atwater</a> and
<a href="https://cs.uwaterloo.ca/~cbocovic">cecylia bocovich</a> |
device images designed by
<a href="http://www.flaticon.com/authors/madebyoliver">madebyoliver</a> from Flaticon
</div>
<div id="loading" style="position:absolute;top:0;left:0;right:0;bottom:0;background-color:#DDD;color:#222;text-align:center">
<h2>Netsim</h3>
<p>Loading...<p>
</div>
</body>
</html>