-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdatabase.php
More file actions
281 lines (230 loc) · 11 KB
/
database.php
File metadata and controls
281 lines (230 loc) · 11 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
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
<?php
require 'db_connect.php';
session_start();
ob_start();
require 'check_ban.php';
?>
<DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="">
<meta name="author" content="">
<title>LEYECO V HELIOS</title>
<!-- Custom fonts for this template-->
<link href="vendor/fontawesome-free/css/all.min.css" rel="stylesheet" type="text/css">
<!-- Page level plugin CSS-->
<link href="vendor/datatables/dataTables.bootstrap4.css" rel="stylesheet">
<!-- Custom styles for this template-->
<link href="css/sb-admin.css" rel="stylesheet">
<!-- Font Awesome -->
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.6.1/css/all.css" integrity="sha384-gfdkjb5BdAXd+lj+gudLWI+BXq4IuLW5IT+brZEZsLFm++aCMlF1V92rMkPaX4PP" crossorigin="anonymous">
<script defer src="https://use.fontawesome.com/releases/v5.0.13/js/solid.js" integrity="sha384-tzzSw1/Vo+0N5UhStP3bvwWPq+uvzCMfrN1fEFe+xBmv1C/AtVX5K0uZtmcHitFZ" crossorigin="anonymous"></script>
<script defer src="https://use.fontawesome.com/releases/v5.0.13/js/fontawesome.js" integrity="sha384-6OIrr52G08NpOFSZdxxz1xdNSndlD4vdcf/q2myIUVO0VsqaGHJsB0RaBE01VTOY" crossorigin="anonymous"></script>
<!-- Bootstrap -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<title>SB Admin - Tables</title>
<!-- Custom fonts for this template-->
<link href="vendor/fontawesome-free/css/all.min.css" rel="stylesheet" type="text/css">
<!-- Page level plugin CSS-->
<link href="vendor/datatables/dataTables.bootstrap4.css" rel="stylesheet">
<!-- Custom styles for this template-->
<link href="css/sb-admin.css" rel="stylesheet">
</head>
<body id="page-top">
<?php
require 'header.php';
$session_username = $_SESSION["username"];
$status_convert = "SELECT * from tbl_account INNER JOIN tbl_status ON tbl_account.status_id = tbl_status.status_id WHERE username = '$session_username'";
$status_query = $conn->query($status_convert);
$updatePrivilege = "SELECT * from tbl_account WHERE BINARY username = BINARY '$session_username'";
$updatePrivilege_Query = $conn->query($updatePrivilege);
?>
<div id="content-wrapper">
<div class="container-fluid">
<!-- Breadcrumbs-->
<ol class="breadcrumb">
<li class="breadcrumb-item">
<a href="#">Dashboard</a>
</li>
<li class="breadcrumb-item active">Tables</li>
</ol>
<!-- DataTables Example -->
<div class="card mb-3">
<div class="card-header">
<i class="fas fa-table"></i>
Data Table Example</div>
<div class="card-body">
<div class="table-responsive">
<table class="table table-bordered" id="dataTable" width="100%" cellspacing="0">
<thead>
<tbody>
<form action="process.php" method="POST">
<?php
$admin_database = "SELECT * from tbl_account INNER JOIN tbl_world ON tbl_account.account_id = tbl_world.account_id";
$admin_databaseResult = $conn->query($admin_database);
$account_database = "SELECT * from tbl_account INNER JOIN tbl_world ON tbl_account.account_id = tbl_world.account_id WHERE BINARY username = BINARY '$session_username'";
$account_databaseResult = $conn->query($account_database);
while ($status_row = $status_query->fetch_assoc()){
if ($status_row["status"] == 'Administrator'){
echo '<tr>
<th>ID</th>
<th>Name</th>
<th>Inserted By</th>
<th>Latitude</th>
<th>Longitude</th>
<th>Date Created</th>
<th>Date Updated</th>
<!--<th>Type</th>
<th>Layer</th>-->
<th>Action</th>
</tr>
</thead>
<tfoot>
<tr>
<th>ID</th>
<th>Name</th>
<th>Inserted By</th>
<th>Latitude</th>
<th>Longitude</th>
<th>Date Created</th>
<th>Date Updated</th>
<!--<th>Type</th>
<th>Layer</th>-->
<th>Action</th>
</tr>
</tfoot>';
while ($row = $admin_databaseResult->fetch_assoc()){
echo " <td>".$row["world_id"]."</td>
<td name='name'>".$row["name"]."</td>
<td name='account'>".$row["username"]."</td>
<td name='latitude'>".$row["latitude"]."</td>
<td name='longitude'>".$row["longitude"]."</td>
<td name='date_created'>".$row["date_created"]."</td>
<td name='date_updated'>".$row["date_updated"]."</td>
";
echo " <td><a href='edit.php?edit=".$row["world_id"]."' name='saveRow' class='btn btn-success btn-xs remove'>Update</a></td>
</tr>
</form>";
}
}
else {
echo '<tr>
<th>ID</th>
<th>Name</th>
<th>Latitude</th>
<th>Longitude</th>
<th>Date Created</th>
<th>Date Updated</th>
<!--<th>Type</th>
<th>Layer</th>-->
<th>Action</th>
</tr>
</thead>
<tfoot>
<tr>
<th>ID</th>
<th>Name</th>
<th>Latitude</th>
<th>Longitude</th>
<th>Date Created</th>
<th>Date Updated</th>
<!--<th>Type</th>
<th>Layer</th>-->
<th>Action</th>
</tr>
</tfoot>';
while ($row = $account_databaseResult->fetch_assoc()){
$world_ID = $row["world_id"];
echo " <td>".$world_ID."</td>
<td name='name'>".$row["name"]."</td>
<td name='latitude'>".$row["latitude"]."</td>
<td name='longitude'>".$row["longitude"]."</td>
<td name='date_created'>".$row["date_created"]."</td>
<td name='date_updated'>".$row["date_updated"]."</td>
<td>
";
if ($row["update_privilege"] == 1){
echo " <a data-toggle='modal' data-target='#update_database' href='#' name='saveRow' class='btn btn-success btn-xs remove'>Update</a>";
}
if ($row["delete_privilege"] == 1){
echo " <a href='process.php?delete=".$row["world_id"]."' name='saveRow' class='btn btn-success btn-xs remove'>Delete</a>";
}
else{
}
echo " </td></tr></form>";
}
}
}
?>
</form>
</tbody>
</table>
</div>
</div>
<div class="card-footer small text-muted">Updated yesterday at 11:59 PM</div>
</div>
<p class="small text-center text-muted my-5">
<em>More table examples coming soon...</em>
</p>
<!-- Update Modal-->
<form method="POST">
<div class="modal fade" id="update_database" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Update</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<div class="form-group">
<label for="usr">Name:</label>
<?php
while ($account_db = $account_databaseResult->fetch_assoc()){
echo $account_db["account_id"];
}
echo "HERE!".$world_ID;
?>
<input type="text" class="form-control" name="input_LayerName">
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
<button class="btn btn-primary" type="submit" name="addLayer_btn">Add</button>
</div>
</div>
</div>
</div>
</form>
</div>
<!-- /.content-wrapper -->
</div>
<!-- /#wrapper -->
<!-- Scroll to Top Button-->
<a class="scroll-to-top rounded" href="#page-top">
<i class="fas fa-angle-up"></i>
</a>
<!-- Pure Javascript -->
<script type="text/javascript">
$(function() {
$('#sidebarToggle').click();
});
</script>
<!-- Bootstrap core JavaScript-->
<script src="vendor/jquery/jquery.min.js"></script>
<script src="vendor/bootstrap/js/bootstrap.bundle.min.js"></script>
<!-- Core plugin JavaScript-->
<script src="vendor/jquery-easing/jquery.easing.min.js"></script>
<!-- Page level plugin JavaScript-->
<script src="vendor/datatables/jquery.dataTables.js"></script>
<script src="vendor/datatables/dataTables.bootstrap4.js"></script>
<!-- Custom scripts for all pages-->
<script src="js/sb-admin.min.js"></script>
<!-- Demo scripts for this page-->
<script src="js/demo/datatables-demo.js"></script>
</body>
</html>