-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathadmin.php
More file actions
119 lines (98 loc) · 3.18 KB
/
admin.php
File metadata and controls
119 lines (98 loc) · 3.18 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
<?php
require_once "dbconfig.php";
if(!$user->is_loggedin()){
$user->redirect("index.php");
}
if(!$user->hasRole($_SESSION["User"], "Admin")){
$user->redirect("index.php");
}
if(isset($_GET["error"])){
$error = true;
}
include "templates/header.php";
include "templates/navbar.php";
$string = $user->returnTable();
?>
<script>
document.getElementById('navAdmin').classList.add("active");
</script>
<div class="container">
<div class="col-md-12">
<?php
if(isset($_GET["editsuccess"])){
echo '<div class="alert alert-success" role="alert">
<a href="#" class="alert-link">Daten erfolgreich bearbeitet!</a>
</div>';
}
?>
</div>
<div style="margin-top: 25px;">
<form class="form-inline">
<label class="sr-only" for="inlineFormInput">Search</label>
<input type="search" id="myInput" onkeyup="searchTable()" class="form-control mb-2 mr-sm-2 mb-sm-0" placeholder="Search" style="margin-right: 15px; margin-bottom: 10px;">
</form>
</div>
<div class="col-md-12">
<table class="table sortable" id="AdminUserTable">
<thead>
<tr>
<th>ID</th>
<th>Name</th>
<th>Rolle</th>
<th>Last Login (Y-M-D H:M:S)</th>
<th>Discord</th>
<th>Gültigkeit</th>
<th>Edit</th>
<tr>
<thead>
<tbody id="tbody">
<?php
echo $string;
?>
</tbody>
</table>
</div>
</div>
<script>
</script>
<script>
$(document).ready(function()
{
$("#AdminUserTable").tablesorter();
}
);
</script>
<script>
function searchTable(){
var searchText = document.getElementById('myInput').value;
var targetTable = document.getElementById('tbody');
var targetTableColCount;
//Loop through table rows
for (var rowIndex = 0; rowIndex < targetTable.rows.length; rowIndex++) {
var rowData = '';
//Get column count from header row
if (rowIndex == 0) {
targetTableColCount = targetTable.rows.item(rowIndex).cells.length;
}
//Process data rows. (rowIndex >= 1)
for (var colIndex = 0; colIndex < targetTableColCount; colIndex++) {
var cellText = '';
if (navigator.appName == 'Microsoft Internet Explorer')
cellText = targetTable.rows.item(rowIndex).cells.item(colIndex).innerText;
else
cellText = targetTable.rows.item(rowIndex).cells.item(colIndex).textContent;
rowData += cellText;
}
// Make search case insensitive.
rowData = rowData.toLowerCase();
searchText = searchText.toLowerCase();
//If search term is not found in row data
//then hide the row, else show
if (rowData.indexOf(searchText) == -1)
targetTable.rows.item(rowIndex).style.display = 'none';
else
targetTable.rows.item(rowIndex).style.display = 'table-row';
}
}
</script>
<?php include 'templates/footer.php'; ?>