-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathadmin.php
More file actions
executable file
·89 lines (84 loc) · 2.63 KB
/
admin.php
File metadata and controls
executable file
·89 lines (84 loc) · 2.63 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
<?php
session_start();
if (!isset($_SESSION['status']) || $_SESSION['status'] !== "admin") {
header("Location: login.php");
exit;
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Ziki Admin</title>
<style>
<?php include "css/reset.css";
include "css/admin.css";
include "pageheader.php";
?>
</style>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
</head>
<body>
<div class="wrapper">
<?php include "sidebarAdmin.php" ?>
</div>
<div class="main">
<div class="overview-box">
<div class="title-box">
<h3>User Registration Stats</h3>
<iframe id="plotFrame" src="plot.html" title="description"></iframe>
</div>
</div>
<div class="overview-box">
<div class="title-box">
<h3>Total Users</h3>
<h3 id="results">
<?php echo $users ?>
</h3>
</div>
</div>
<div class="overview-box">
<div class="title-box">
<h3>Total Posts</h3>
<h3 id="results_p">
<?php echo $posts ?>
</h3>
</div>
</div>
</div>
<script>
$(document).ready(function () {
$('.logo').mouseenter(function () {
$('.main').css('marginLeft', '300px');
});
$('.logo').mouseleave(function () {
$('.main').css('marginLeft', '100px');
});
// Make AJAX request to fetch data
function fetchData() {
$.ajax({
url: 'ajax/adminAjax.php',
type: 'GET',
dataType: 'json',
success: function (data) {
updateUI(data);
},
error: function (xhr, status, error) {
console.error('Request failed: ' + error);
}
});
}
// Update UI with fetched data
function updateUI(data) {
$('#results').html(data.totalUser);
$('#results_p').html(data.totalPost);
$('#plotFrame').attr('src', $('#plotFrame').attr('src'));
}
// Fetch data initially and set interval to update periodically
fetchData();
setInterval(fetchData, 60000); // Update every minute (adjust as needed)
});
</script>
</body>
</html>