-
Notifications
You must be signed in to change notification settings - Fork 4
/
logs.php
187 lines (172 loc) · 8.06 KB
/
logs.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
174
175
176
177
178
179
180
181
182
183
184
185
186
187
<?php
session_start();
require "config/config.php";
if (!isset($_SESSION["loggedin"]) || $_SESSION["loggedin"] !== true || $_SESSION['founder'] == 0) {
header("location: login.php?redirect_link=logs.php");
exit;
}
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height">
<title>Logs</title>
<link rel="shortcut icon" href="logos/logo.png" type="image/x-icon">
<link rel="stylesheet" href="css/logs.css?v=<?php echo time(); ?>">
</head>
<body>
<?php require_once("header.php"); ?>
<div style="margin: 20px;">
<h1>Logs</h1>
<div>
<table>
<tr>
<th><b>CHAT (last 100 messages)</b></th>
<th><b>USERS (last 100 users)</b></th>
<th><b>TICKETS (last 100 tickets)</b></th>
<th><b>NOTIFICATIONS (last 100 notifications)</b></th>
<th><b>COMMENTS (last 100 comments)</b></th>
</tr>
<tr>
<th>
<?php
$sql = "SELECT * FROM chat ORDER BY id DESC";
$result = mysqli_query($link, $sql);
$initial = 1;
if (mysqli_num_rows($result) > 0) {
while ($row = mysqli_fetch_assoc($result)) {
if ($initial <= 100) {
$message = $row['message'];
$created_at = $row['created_at'];
$user_id = $row['userid'];
$action = $row['action'];
$actiontext = $row['actiontext'];
if ($action == 0) {
$sql1 = "SELECT * FROM users WHERE id=$user_id";
$result1 = mysqli_query($link, $sql1);
$row1 = mysqli_fetch_assoc($result1);
$username = $row1['username'];
echo "
$username - $message - $created_at<br>
";
} else {
echo "
$actiontext<br>
";
}
$initial++;
}
}
} else {
echo "There are no messages.";
}
?>
</th>
<th>
<?php
$sql = "SELECT * FROM users ORDER BY id DESC";
$result = mysqli_query($link, $sql);
$initial = 1;
if (mysqli_num_rows($result) > 0) {
while ($row = mysqli_fetch_assoc($result)) {
if ($initial <= 100) {
$created_at = $row['created_at'];
$username = $row['username'];
echo "
$username - $created_at<br>
";
$initial++;
}
}
} else {
echo "There are no users.";
}
?>
</th>
<th>
<?php
$sql = "SELECT * FROM tickets ORDER BY id DESC";
$result = mysqli_query($link, $sql);
$initial = 1;
if (mysqli_num_rows($result) > 0) {
while ($row = mysqli_fetch_assoc($result)) {
if ($initial <= 100) {
$text = $row['text'];
$created_at = $row['created_at'];
$userid = $row['userid'];
$sql1 = "SELECT * FROM users WHERE id=$userid";
$result1 = mysqli_query($link, $sql1);
$row1 = mysqli_fetch_assoc($result1);
$username = $row1['username'];
echo "
$username - $text - $created_at<br>
";
$initial++;
}
}
} else {
echo "There are no tickets.";
}
?>
</th>
<th>
<?php
$sql = "SELECT * FROM notifications ORDER BY id DESC";
$result = mysqli_query($link, $sql);
$initial = 1;
if (mysqli_num_rows($result) > 0) {
while ($row = mysqli_fetch_assoc($result)) {
if ($initial <= 100) {
$text = $row['text'];
$created_at = $row['created_at'];
$userid = $row['userid'];
$sql1 = "SELECT * FROM users WHERE id=$userid";
$result1 = mysqli_query($link, $sql1);
$row1 = mysqli_fetch_assoc($result1);
$username = $row1['username'];
echo "
$username - $text - $created_at<br>
";
$initial++;
}
}
} else {
echo "There are no tickets.";
}
?>
</th>
<th>
<?php
$sql = "SELECT * FROM comments ORDER BY id DESC";
$result = mysqli_query($link, $sql);
$initial = 1;
if (mysqli_num_rows($result) > 0) {
while ($row = mysqli_fetch_assoc($result)) {
if ($initial <= 100) {
$text = $row['text'];
$created_at = $row['created_at'];
$userid = $row['userid'];
$ticketid = $row['forTicket'];
$sql1 = "SELECT * FROM users WHERE id=$userid";
$result1 = mysqli_query($link, $sql1);
$row1 = mysqli_fetch_assoc($result1);
$username = $row1['username'];
echo "
$username - ticket #$ticketid - $text - $created_at<br>
";
$initial++;
}
}
} else {
echo "There are no comments.";
}
?>
</th>
</tr>
</table>
</div>
</div>
</body>
</html>