-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathaccounts.php
105 lines (104 loc) · 3.42 KB
/
accounts.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
<?php
if(!file_exists("mysql.php")){
header("Location: setup/index.php");
exit;
}
session_start();
require("datamanager.php");
require('assets/languages/lang_'.getSetting("lang").'.php');
if(!isset($_SESSION["username"])){
?>
<meta http-equiv="refresh" content="0; URL=login.php">
<?php
exit;
} else if(!getAccountRank($_SESSION["username"]) > 1){
?>
<meta http-equiv="refresh" content="0; URL=mytickets.php">
<?php
exit;
}
?>
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<title>Accounts</title>
<link rel="stylesheet" href="assets/css/main.css">
<link href="https://fonts.googleapis.com/css?family=Quicksand&display=swap" rel="stylesheet">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.8.2/css/all.css" integrity="sha384-oS3vJWv+0UjzBfQzYUhtDYW+Pj2yciDJxpsK1OYPAYjqT085Qq/1cq5FLXAZQ7Ay" crossorigin="anonymous">
<script
src="https://code.jquery.com/jquery-3.4.1.min.js"
integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo="
crossorigin="anonymous"></script>
<link rel="stylesheet" href="assets/css/jquery.sweet-modal.min.css" />
<script src="assets/js/jquery.sweet-modal.min.js"></script>
</head>
<body>
<div class="flex">
<div class="flex-item">
<script type="text/javascript">
function openConfirm(name){
$.sweetModal.confirm('Do you want to delete <strong>'+name+'</strong>?', function() {
var request = new XMLHttpRequest();
request.open('post', 'ajax.php?del', true);
request.send("name="+name);
$.sweetModal({
content: '<strong>'+name+'</strong> was successfully deleted!',
icon: $.sweetModal.ICON_SUCCESS
});
});
}
</script>
<h1>Accounts</h1>
<?php
require("mysql.php");
$stmt = $mysql->prepare("SELECT * FROM accounts");
$stmt->execute();
?>
<table>
<tr>
<th>Username</th>
<th>Email</th>
<th>Last login</th>
<th>First login</th>
<th>Rank</th>
<th>Action</th>
</tr>
<?php
while ($row = $stmt->fetch()) {
?>
<tr>
<td><?php echo $row["USERNAME"]; ?></td>
<td><?php echo $row["EMAIL"]; ?></td>
<td><?php echo displayTimestamp($row["LASTLOGIN"]); ?></td>
<td><?php echo displayTimestamp($row["FIRSTLOGIN"]); ?></td>
<td><?php
if(getAccountRank($row["USERNAME"]) == 0){
echo "User";
} if(getAccountRank($row["USERNAME"]) == 1){
echo "Team";
} else {
echo "Admin";
}
?></td>
<td><?php
if(!getAccountRank($row["USERNAME"]) == 3){
?>
<button onclick="openConfirm('<?php echo $row["USERNAME"]; ?>');" class="btn"><i class="fas fa-trash"></i></button>
<?php
}
?>
<button onclick="openConfirm('<?php echo $row["USERNAME"]; ?>');" class="btn"><i class="fas fa-trash"></i></button>
</td>
</tr>
<?php
}
?>
</table>
</div>
<div class="flex-item sidebar">
<?php require('assets/inc/sidebar.inc.php'); ?>
</div>
</div>
</body>
</html>