panel.php
8.54 KB
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
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
<?php
session_start();
require_once '../classes/realops.php';
$get = new Get();
$admin = new Admin();
date_default_timezone_set('Australia/Sydney');
if(!$admin->checkStatus($_SESSION['vatsimID']))
{
echo "Not authorised.";
die();
}
if(isset($_GET['approve']))
{
$db = db::connect();
$getRow = $db->getRow("SELECT approved FROM tbl_vas WHERE id = ?", array($_GET['approve']));
switch ($getRow['approved'])
{
case 0:
$db->updateRow("UPDATE tbl_vas SET approved = 1 WHERE id = ?", array($_GET['approve']));
break;
case 1:
$db->updateRow("UPDATE tbl_vas SET approved = 0 WHERE id = ?", array($_GET['approve']));
}
}
if(isset($_GET['makeAdmin']))
{
$db = db::connect();
$getRow = $db->getRow("SELECT admin FROM tbl_pilots WHERE vatsimID = ?", array($_GET['makeAdmin']));
switch ($getRow['admin'])
{
case 0:
$db->updateRow("UPDATE tbl_pilots SET admin = 1 WHERE vatsimID = ?", array($_GET['makeAdmin']));
break;
case 1:
$db->updateRow("UPDATE tbl_pilots SET admin = 0 WHERE vatsimID = ?", array($_GET['makeAdmin']));
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<?php include '../sections/header.php'; ?>
</head>
<body>
<div class="wrapper"><br /><br />
<div class="container" id="realops-container">
<div class="row">
<article class="col-sm-12 panel panel-default" id="realops-body">
<h2 class="sub-header">VA's Awaiting Approval</h2>
<div class="table-responsive col-lg-12">
<table class="table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Description</th>
<th>URL</th>
<th>Logo</th>
<th>Approved</th>
<th>Registrant Name</th>
<th>Registrant Email</th>
</tr>
</thead>
<tbody>
<?php
$vas = $admin->vas();
if(!empty($vas)) {
foreach($vas as $row)
{
?>
<tr>
<td style=""><?php echo $row['name'] ?></td>
<td><?php echo $row['description'] ?></td>
<td><?php echo $row['url'] ?></td>
<td><img src="/logos/vas/<?php echo $row['logo'] ?>" /></td>
<td><?php echo $row['approved'] ?></td>
<td><?php echo $row['regName'] ?></td>
<td><?php echo $row['regEmail'] ?></td>
<td><a href="?approve=<?php echo $row['id'] ?>" class="btn btn-primary">Approve/Deny</a></td>
</tr>
<?php } }
else {
echo "<br /><div class=\"alert alert-danger\" role=\"alert\"><strong>No VA's Found.</strong> Please adjust your search and try again.</div>";
}
?>
</tbody>
</table>
</div>
</article>
<article class="col-sm-12 panel panel-default" id="realops-body">
<h2 class="sub-header">ATC Applications</h2>
<div class="table-responsive col-lg-12">
<table class="table table-striped">
<thead>
<tr>
<th>VATSIM ID:</th>
<th>Name:</th>
<th>Email:</th>
<th>Rating:</th>
<th>Preffered Positions:</th>
<th>Shifts:</th>
</tr>
</thead>
<tbody>
<?php
$atc = $admin->atc();
if(!empty($atc)) {
foreach($atc as $row)
{
$shifts = unserialize($row['shifts'])
?>
<tr>
<td style=""><?php echo $row['vatsimID'] ?></td>
<td><?php echo $row['firstName'] . " " . $row['lastName']; ?></td>
<td><?php echo $row['email'] ?></td>
<td><?php echo $row['rating'] ?></td>
<td><strong>1: </strong><?php echo $row['position1'] ?>, <strong>2: </strong><?php echo $row['position2'] ?>, <strong>3: </strong><?php echo $row['position3'] ?></td>
<td><?php
foreach($shifts as $x)
{
switch($x)
{
case "04":
echo "0400z-0600z <br />";
break;
case "06":
echo "0600z-0800z <br />";
break;
case "08":
echo "0800z-1000z <br />";
break;
case "10":
echo "1000z-1200z";
break;
}
}?></td>
</tr>
<?php } }
else {
echo "<br /><div class=\"alert alert-danger\" role=\"alert\"><strong>No VA's Found.</strong> Please adjust your search and try again.</div>";
}
?>
</tbody>
</table>
</div>
</article>
<article class="col-sm-12 panel panel-default" id="realops-body">
<h2 class="sub-header">Registered Pilots</h2>
<div class="table-responsive col-lg-12">
<table class="table table-striped">
<thead>
<tr>
<th>VATSIM ID:</th>
<th>First Name:</th>
<th>Last Name:</th>
<th>Email:</th>
<th>Admin:</th>
<th>Make Admin:</th>
</tr>
</thead>
<tbody>
<?php
$pilots = $admin->pilots();
if(!empty($pilots)) {
foreach($pilots as $row)
{
?>
<tr>
<td style=""><?php echo $row['vatsimID'] ?></td>
<td><?php echo $row['firstName']; ?></td>
<td><?php echo $row['lastName']; ?></td>
<td><?php echo $row['email'] ?></td>
<td><?php echo $row['admin'] ?></td>
<td><a href="?makeAdmin=<?php echo $row['vatsimID'] ?>" class="btn btn-info">Make/Revoke Admin</a></td>
</tr>
<?php } }
else {
echo "<br /><div class=\"alert alert-danger\" role=\"alert\"><strong>No VA's Found.</strong> Please adjust your search and try again.</div>";
}
?>
</tbody>
</table>
</div>
</article>
</div><!-- /.row -->
</div><!-- /.container -->
</div><!-- /.wrapper -->
<?php include '../sections/footer.php'; ?>