-
Notifications
You must be signed in to change notification settings - Fork 2
/
main.php
146 lines (146 loc) · 5.8 KB
/
main.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
<?php
if(isset($_POST['page']) && isset($_POST['title'])){
$page = $_POST['page'];
$title = $_POST['title'];
}else{
if(isset($_POST['submit']) && isset($_POST['type']) && isset($_POST['value'])){
$submit = $_POST['submit'];
if($submit == "TRAIN"){ // TODO: Train stats based on type
$type = $_POST['type'];
$value = $_POST['value'];
$page = "gym";
$title = "Torn | Gym";
}
}else{
$page = 'home';
$title = "Torn | Home";
}
}
?>
<!DOCTYPE html>
<html>
<head>
<title><?php echo $title; ?></title>
<link rel="stylesheet" type="text/css" href="style1.css">
<script type="text/javascript">
function select(page){
document.querySelector("#Navigate_"+page).submit();
}
function setInfo(){
let [energy,nerve,happy,life] = [document.querySelector("#energy"),
document.querySelector("#nerve"),
document.querySelector("#happy"),
document.querySelector("#life")];
let [maxenergy,maxnerve,maxhappy,maxlife] = [document.querySelector("#maxenergy"),
document.querySelector("#maxnerve"),
document.querySelector("#maxhappy"),
document.querySelector("#maxlife")];
energy.innerText = "<?php echo $_SESSION['energy']; ?>";
maxenergy.innerText = "<?php echo $_SESSION['maxenergy']; ?>";
nerve.innerText = "<?php echo $_SESSION['nerve']; ?>";
maxnerve.innerText = "<?php echo $_SESSION['maxnerve']; ?>";
happy.innerText = "<?php echo $_SESSION['happy']; ?>";
maxhappy.innerText = "<?php echo $_SESSION['maxhappy']; ?>";
life.innerText = "<?php echo $_SESSION['life']; ?>";
maxlife.innerText = "<?php echo $_SESSION['maxlife']; ?>";
}
</script>
<script type="text/javascript" src="scripts/script1.js"></script>
</head>
<body>
<div class="wrapper">
<div id="grid_main">
<div id="header">
<ul class="header menu">
<li><a href="">Help</a></li>
<li><a href="">Forum</a></li>
<li><a href="">Staff</a></li>
<li><a href="">Credit</a></li>
<li><a href="logout.php">Logout</a></li> <!-- Temporary -->
</ul>
</div>
<div id="sidebar">
<div id="info">
<h3 class="title">Information</h3>
<div id="info-bar">
<ul id="status-icon">
<li class="status-icon gender male"><a></a></li>
<li class="status-icon bank investment"><a></a></li>
<li class="status-icon job employed"><a></a></li>
<li class="status-icon education"><a></a></li>
</ul>
</div>
<hr>
<ul class="info">
<li id="name">Name: <?php echo "<a href='#' id='name-link'>".$_SESSION['name']."</a>"; ?></li>
<li id="money">Money: <?php echo "<span id='money-value'>$".$_SESSION['money']."</span>"; ?></li>
<li id="level">Level: <?php echo $_SESSION['level']; ?></li>
<li id="points">Points: <?php echo $_SESSION['points']; ?></li>
<?php if($_SESSION['merits'] > 0) echo "<li id=\"merits\">Merits: ".$_SESSION['merits']."</li>"; ?>
</ul>
<hr>
<div id="stats-area">
<div>Energy: <span id="energy">0</span>/<span id="maxenergy">0</span><span id="timer-energy" class="time float right">00:00</span>
<div class="progressbar back">
<div class="progressbar middle"></div>
<div id="bar-energy" style="width: 0%;" class="progressbar front"></div>
</div>
</div>
<div>Nerve: <span id="nerve">0</span>/<span id="maxnerve">0</span><span id="timer-nerve" class="time float right">00:00</span>
<div class="progressbar back">
<div class="progressbar middle"></div>
<div id="bar-nerve" style="width: 0%;" class="progressbar front"></div>
</div>
</div>
<div>Happy: <span id="happy">0</span>/<span id="maxhappy">0</span><span id="timer-happy" class="time float right">00:00</span>
<div class="progressbar back">
<div class="progressbar middle"></div>
<div id="bar-happy" style="width: 0%;" class="progressbar front"></div>
</div>
</div>
<div>Life: <span id="life">0</span>/<span id="maxlife">0</span><span id="timer-life" class="time float right">00:00</span>
<div class="progressbar back">
<div class="progressbar middle"></div>
<div id="bar-life" style="width: 0%;" class="progressbar front"></div>
</div>
</div>
</div>
</div>
<div id="areas">
<h3 class="title">Areas</h3>
<ul class="areas">
<?php
$pages = ["home","items","city","job","gym","properties","education","crimes","missions","newspaper","jail","hospital","casino","forums","halloffame","factions","recruitcitizens","rules","elimination"];
$titles = ["Home","Items","City","Job","Gym","Properties","Education","Crimes","Missions","Newspaper","Jail","Hospital","Casino","Forums","Hall of Fame","Factions","Recruit Citizens","Rules","Elimination"];
for ($i=0;$i<sizeof($pages);$i++) {
$cpage = $pages[$i];
$title = $titles[$i];
echo "<li onclick=select(\"".$cpage."\") ".($page==$cpage ? "class=\"selected\"":"")."><form id=\"Navigate_".$cpage."\" action=\"index.php\" method=\"POST\">".
"<input type=\"hidden\" name=\"page\" value=\"".$cpage."\">".
"<input type=\"hidden\" name=\"title\" value=\"Torn | ".$title."\">".
"<div style=\"display: flex;\"><i class=\"areas icon ".$cpage."\"></i>".$title."</div></form></li>";
}
?>
</ul>
<hr>
</div>
</div>
<div id="main">
<?php
if($page == 'home') include "areas/home.php";
elseif ($page == 'items') include "areas/items.php";
elseif ($page == 'gym') include "areas/gym.php";
elseif ($page == 'crimes') include "areas/crimes.php";
else echo "Unknown page ".$page;
?>
</div>
</div>
</div>
<script type="text/javascript">
<?php
echo "UpdateFactory(".$_SESSION['userid'].")();";
echo "setInterval(UpdateFactory(".$_SESSION['userid']."),1000)";
?>
</script>
</body>
</html>