-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.html
195 lines (175 loc) · 7.17 KB
/
index.html
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
188
189
190
191
192
193
194
195
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Localhost Directory Listing</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css">
<link rel="stylesheet" type="text/css" href="styles.css">
<style>
</style>
</head>
<body>
<h1>localhost</h1>
<!-- Server Status -->
<div class="server-status">
<a href="server-status.php" target="_blank" id="serverStatus">
<h2 style="margin-bottom: 30px;">Server Status</h2>
</a>
</div>
<!-- XAMPP Links -->
<h2>XAMPP Links</h2>
<ul>
<!-- Dashboard -->
<li>
<a href="dashboard" target="_blank" class="special-link">
<div class="site-title">
<i class="fas fa-desktop"></i>XAMPP Dashboard
</div>
<div class="site-description">XAMPP Control Panel</div>
</a>
</li>
<!-- phpMyAdmin -->
<li>
<a href="phpmyadmin" target="_blank" class="special-link">
<div class="site-title">
<i class="fas fa-database"></i>phpMyAdmin
</div>
<div class="site-description">MariaDB Database Management</div>
</a>
</li>
<!-- phpinfo() -->
<li>
<a href="dashboard/phpinfo.php" target="_blank" class="special-link">
<div class="site-title">
<i class="fas fa-info-circle"></i>phpinfo()
</div>
<div class="site-description">PHP Configuration Information</div>
</a>
</li>
<!-- Applications -->
<li>
<a href="applications.html" target="_blank" class="special-link">
<div class="site-title">
<i class="fas fa-cogs"></i>Applications
</div>
<div class="site-description">Bitnami Open Source Applications Available on XAMPP</div>
</a>
</li>
<!-- FAQs -->
<li>
<a href="dashboard/faq.html" target="_blank" class="special-link">
<div class="site-title">
<i class="fas fa-question-circle"></i>FAQs
</div>
<div class="site-description">OS X Frequently Asked Questions</div>
</a>
</li>
<!-- How-To-Guides -->
<li>
<a href="dashboard/howto.html" target="_blank" class="special-link">
<div class="site-title">
<i class="fas fa-book"></i>How-To-Guides
</div>
<div class="site-description">OS X HOW-TO Guides</div>
</a>
</li>
</ul>
<!-- List of Sites -->
<!-- Add your sites here -->
<!-- Each site should have a title, description, and favicon -->
<!-- The favicon should be placed in the same directory as the site -->
<!-- The site should be accessible via a relative path -->
<h2>My Sites</h2>
<ul>
<li>
<a href="path/to/your-site-folder" target="_blank">
<div class="site-title">
<img src="path/to/favicon.ico" alt="Site Icon">Your Site Title
</div>
<div class="site-description">A brief description of your site.</div>
</a>
</li>
<li>
<a href="path/to/your-site-folder" target="_blank">
<div class="site-title">
<img src="path/to/favicon.ico" alt="Site Icon">Your Site Title
</div>
<div class="site-description">A brief description of your site.</div>
</a>
</li>
<li>
<a href="path/to/your-site-folder" target="_blank">
<div class="site-title">
<img src="path/to/favicon.ico" alt="Site Icon">Your Site Title
</div>
<div class="site-description">A brief description of your site.</div>
</a>
</li>
</ul>
<div class="footer">
Powered by
<a href="https://www.apachefriends.org/" target="_blank" style="margin-top: 10px;">XAMPP</a>
</div>
<script>
// Function to fetch server-status information and update the content
function fetchServerStatus() {
fetch("get_server_status.php")
.then(response => response.text())
.then(data => {
// Extract relevant information from the server-status page
var regex = /Total accesses: ([0-9]+) - Total Traffic: ([0-9]+(?:\.[0-9]+)?) (kB|MB|GB) - Total Duration: ([0-9]+)/;
const [, totalAccesses, totalTraffic, totalTrafficUnit, totalDuration] = data.match(regex);
// Extract server uptime
regex = /Server uptime:\s*(?:([0-9]+) day(?:s?))?\s*(?:([0-9]+) hour(?:s?))?\s*(?:([0-9]+) minute(?:s?))?\s*(?:([0-9]+) second(?:s?))?/
const [, uptimeDays, uptimeHours, uptimeMinutes, uptimeSeconds] = data.match(regex);
// Format the information and update the content
const serverStatusElement = document.getElementById("serverStatus");
serverStatusElement.innerHTML = `
<h2 style="margin-bottom: 30px;">Server Status</h2>
<table id="serverStatusTable">
<tr>
<th>Uptime:</th>
<td>${formatTime(uptimeDays, uptimeHours, uptimeMinutes, uptimeSeconds)}</td>
</tr>
<tr>
<th>Total Accesses:</th>
<td>${totalAccesses}</td>
</tr>
<tr>
<th>Total Traffic:</th>
<td>${totalTraffic} ${totalTrafficUnit}</td>
</tr>
<tr>
<th>Total Duration:</th>
<td>${totalDuration}</td>
</tr>
</table>
`;
})
.catch(error => {
console.error("Error fetching server-status:", error);
});
}
// Function to format time as "HHh MMm SSs" excluding missing parts
function formatTime(days, hours, minutes, seconds) {
let formattedTime = '';
if (days) {
formattedTime += days + 'd ';
}
if (hours) {
formattedTime += hours + 'h ';
}
if (minutes) {
formattedTime += minutes + 'm ';
}
if (seconds) {
formattedTime += seconds + 's';
}
return formattedTime.trim();
}
// Call the fetchServerStatus function when the page loads
document.addEventListener("DOMContentLoaded", fetchServerStatus);
</script>
</body>
</html>