This repository has been archived by the owner on Mar 10, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 71
/
dashboard.php
173 lines (154 loc) · 5.23 KB
/
dashboard.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
<?php
/**
Open source CAD system for RolePlaying Communities.
Copyright (C) 2017 Shane Gill
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program comes with ABSOLUTELY NO WARRANTY; Use at your own risk.
**/
session_start();
include("./oc-config.php");
require("./actions/generalActions.php");
if (empty($_SESSION['logged_in']))
{
header('Location: ./index.php');
die("Not logged in");
}
setDispatcher("1");
$link = mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME);
if (!$link) {
die('Could not connect: ' .mysql_error());
}
$id = $_SESSION['id'];
$sql = "SELECT * from ".DB_PREFIX."user_departments WHERE user_id = \"$id\"";
$getAdminPriv = "SELECT `admin_privilege` from ".DB_PREFIX."users WHERE id = \"$id\"";
$result=mysqli_query($link, $sql);
$adminPriv=mysqli_query($link, $getAdminPriv);
$adminButton = "";
$dispatchButton = "";
$highwayButton = "";
$stateButton = "";
$fireButton = "";
$emsButton = "";
$sheriffButton = "";
$policeButton = "";
$civilianButton = "";
$roadsideAssistButton = "";
$num_rows = $result->num_rows;
while($row = mysqli_fetch_array($result, MYSQLI_BOTH))
{
if ($row[1] == "1")
{
$_SESSION['dispatch'] = 'YES';
$dispatchButton = "<a href=\"".BASE_URL."/cad.php\" class=\"btn btn-lg cusbtn animate fadeInLeft delay1\">Dispatch</a>";
}
else if ($row[1] == "7")
{
$_SESSION['ems'] = 'YES';
$emsButton = "<a href=\"".BASE_URL."/mdt.php?dep=ems\" class=\"btn btn-lg cusbtn animate fadeInLeft delay1\">EMS</a>";
}
else if ($row[1] == "6")
{
$_SESSION['fire'] = 'YES';
$fireButton = "<a href=\"".BASE_URL."/mdt.php?dep=fire\" class=\"btn btn-lg cusbtn animate fadeInLeft delay1\">Fire</a>";
}
else if ($row[1] == "3")
{
$_SESSION['highway'] = 'YES';
$highwayButton = "<a href=\"".BASE_URL."/mdt.php?dep=highway\" class=\"btn btn-lg cusbtn animate fadeInLeft delay1\">Highway Patrol</a>";
}
else if ($row[1] == "5")
{
$_SESSION['police'] = 'YES';
$policeButton = "<a href=\"".BASE_URL."/mdt.php?dep=police\" class=\"btn btn-lg cusbtn animate fadeInLeft delay1\">Police Department</a>";
}
else if ($row[1] == "4")
{
$_SESSION['sheriff'] = 'YES';
$sheriffButton = "<a href=\"".BASE_URL."/mdt.php?dep=sheriff\" class=\"btn btn-lg cusbtn animate fadeInLeft delay1\">Sheriff's Office</a>";
}
else if ($row[1] == "2")
{
$_SESSION['state'] = 'YES';
$stateButton = "<a href=\"".BASE_URL."/mdt.php?dep=state\" class=\"btn btn-lg cusbtn animate fadeInLeft delay1\">State Police</a>";
}
else if ($row[1] == "8")
{
$_SESSION['civillian'] = 'YES';
$civilianButton = "<a href=\"".BASE_URL."/civilian.php\" class=\"btn btn-lg cusbtn animate fadeInLeft delay1\">Civilian</a>";
}
else if ($row[1] == "9")
{
$_SESSION['roadsideAssist'] = 'YES';
$roadsideAssistButton = "<a href=\"".BASE_URL."/mdt.php?dep=roadsideAssist\" class=\"btn btn-lg cusbtn animate fadeInLeft delay1\">Roadside Assistance</a>";
}
}
$adminRows = $adminPriv->num_rows;
if($adminRows < 2)
{
while($adminRow = mysqli_fetch_array($adminPriv, MYSQLI_BOTH))
{
if ($adminRow[0] == "3")
{
$adminButton = "<a href=\"".BASE_URL."/oc-admin/admin.php\" class=\"btn btn-lg cusbtn animate fadeInLeft delay1\">Admin</a>";
}
if ($adminRow[0] == "2")
{
$adminButton = "<a href=\"".BASE_URL."/oc-admin/admin.php\" class=\"btn btn-lg cusbtn animate fadeInLeft delay1\">Moderator</a>";
}
}
}
mysqli_close($link);
?>
<html lang="en">
<!DOCTYPE html>
<?php include "./oc-includes/header.inc.php"; ?>
<body id="body">
<div id="page-wrapper">
<div class="container-fluid">
<div class="row">
<div class="col-lg-12">
<h1 class="page-header animate fadeInLeft delay2" style="text-align:center;">Hello! What would you like to do today?</h1>
</div>
<!-- ./ col-lg-12 -->
</div>
<!-- ./ row -->
</div class="row">
<div class="col-lg-12">
<div id="buttongroup">
<?php echo $adminButton;?>
</div>
<div id="buttongroup">
<?php echo $dispatchButton;?>
</div>
<div id="buttongroup">
<?php echo $civilianButton; ?>
<?php echo $roadsideAssistButton; ?>
</div>
<div id="buttongroup">
<?php echo $fireButton;?>
<?php echo $emsButton;?>
</div>
<div id="buttongroup">
<?php echo $sheriffButton;?>
<?php echo $highwayButton;?>
<?php echo $stateButton;?>
<?php echo $policeButton;?>
</div>
</div>
<!-- ./ col-lg-12 -->
</div>
<!-- ./ row -->
</div>
<!-- ./ container-fluid -->
</div>
<!-- ./ page-wrapper -->
</body>
</html>