-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstatus.php
More file actions
52 lines (51 loc) · 1.74 KB
/
status.php
File metadata and controls
52 lines (51 loc) · 1.74 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
<?php
require_once "db_connect.php";
function generate_connection_params_html(): string
{
return sprintf(
"<pre>Host: %s\nDatabase: %s\nUser: %s</pre>",
htmlspecialchars(DB_HOST),
htmlspecialchars(DB_NAME),
htmlspecialchars(DB_USER)
);
}
try {
$connection = getDbConnection();
$statusData = [
"taglineIcon" => "✅",
"taglineText" => "Database Connection Successful!",
"subtitleText" => "Successfully pinged the meme mainframe.",
"cardClass" => "db-card db-success-card",
"detailsHtml" => sprintf(
"<div class='details-container'><h4>Connection Details:</h4>%s<p>It looks like the database hamster is awake and running!</p></div>",
generate_connection_params_html()
),
];
} catch (\PDOException $e) {
$statusData = [
"taglineIcon" => "❌",
"taglineText" => "Database Connection Failed!",
"subtitleText" => "Error connecting to the meme mainframe.",
"cardClass" => "db-card db-error-card",
"detailsHtml" => sprintf(
"<div class='details-container'><h4>Connection Attempt Details:</h4>%s<p>Oops! The database hamster fell off its wheel. Please try again later, as we are genuinely sorry that we don't have any data and our database is probably nuked. Please try to survive without us while we're working on it.</p></div>",
generate_connection_params_html()
),
];
} catch (\Exception $e) {
$statusData = [
"taglineIcon" => "🔥",
"taglineText" => "Unexpected Error During Test!",
"subtitleText" =>
"Something went very wrong. Our production may be on fire. Our bad!",
"cardClass" => "db-card db-fire-card",
"detailsHtml" => sprintf(
"<div class='details-container'><h4>Error Details:</h4><pre>" .
htmlspecialchars($e->getMessage()) .
"</pre></div>"
),
];
}
extract($statusData);
require "status.html";
?>