move folder
This commit is contained in:
101
www/admin/index.php
Normal file
101
www/admin/index.php
Normal file
@@ -0,0 +1,101 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Admin Page</title>
|
||||
<link rel="icon" href="../logo.png" type="image/x-icon">
|
||||
<link rel="stylesheet" type="text/css" href="styles.css">
|
||||
<link rel="stylesheet" href="https://use.typekit.net/rvs8lhv.css">
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<div class="content">
|
||||
<div class="center-container">
|
||||
<div class="header">
|
||||
<img src="../logo.png" class="logo">
|
||||
<div class="header-content">
|
||||
<h1>IP Pheasant</h1>
|
||||
<p>Where the Pheasant shows all the IP!</p>
|
||||
<h2>Admin Panel</h2>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Table for displaying visit count -->
|
||||
<table>
|
||||
<tr>
|
||||
<th>Total Visit Count</th>
|
||||
<td id="visitCount"></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<!-- Table for displaying last 50 lines of the gist -->
|
||||
<br>
|
||||
<table id="last50Table">
|
||||
<!-- Table headers -->
|
||||
|
||||
</table>
|
||||
<script>
|
||||
|
||||
const apiKey = "<?php echo getenv('apiKey'); ?>";
|
||||
const accessToken = "<?php echo getenv('accessToken'); ?>";
|
||||
const gistId = "<?php echo getenv('gistId'); ?>" ;
|
||||
const gistId2 = "<?php echo getenv('gistId2'); ?>" ;
|
||||
|
||||
fetch(`https://api.github.com/gists/${gistId2}`, {
|
||||
headers: {
|
||||
'Authorization': `token ${accessToken}`,
|
||||
}
|
||||
})
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
// Extract content of the first file in the Gist
|
||||
const filename = Object.keys(data.files)[0];
|
||||
const content = data.files[filename].content;
|
||||
const visitCount = parseInt(content) || 0; // Parse existing visit count from Gist, or default to 0
|
||||
|
||||
// Display visit count in the table
|
||||
|
||||
// Extract last 50 lines of the content
|
||||
const lines = content.trim().split('\n');
|
||||
const last50Lines = lines.slice(-50);
|
||||
|
||||
// Parse each line and add it to the last 50 lines table
|
||||
const last50Table = document.getElementById('last50Table');
|
||||
last50Lines.forEach(line => {
|
||||
const [address, time] = line.split(',');
|
||||
const row = last50Table.insertRow();
|
||||
row.insertCell(0).innerText = address;
|
||||
row.insertCell(1).innerText = time;
|
||||
});
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('Error fetching Gist:', error);
|
||||
});
|
||||
</script>
|
||||
|
||||
<script>
|
||||
|
||||
|
||||
fetch(`https://api.github.com/gists/${gistId}`, {
|
||||
headers: {
|
||||
'Authorization': `token ${accessToken}`,
|
||||
}
|
||||
})
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
// Extract content of the first file in the Gist
|
||||
const filename = Object.keys(data.files)[0];
|
||||
const content = data.files[filename].content;
|
||||
const visitCount = parseInt(content) || 0; // Parse existing visit count from Gist, or default to 0
|
||||
// Display visit count in the table
|
||||
document.getElementById('visitCount').innerText = visitCount;
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('Error fetching Gist:', error);
|
||||
});
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user