mirror of
https://github.com/Fluffy-Bean/image-gallery.git
synced 2024-12-28 18:36:22 +00:00
Give an error when connection dies
This commit is contained in:
parent
cb838ad53b
commit
dec15d7b63
|
@ -1,21 +1,18 @@
|
|||
<?php
|
||||
/*
|
||||
Connect to database
|
||||
Connect to database
|
||||
|
||||
Dunno what else to put here lol
|
||||
Dunno what else to put here lol
|
||||
*/
|
||||
$conn_ip = "192.168.0.79:3306";
|
||||
$conn_username = "uwu";
|
||||
$conn_password = "fennec621";
|
||||
$conn_database = "gallery";
|
||||
try {
|
||||
$conn_ip = "192.168.0.79:3306";
|
||||
$conn_username = "uwu";
|
||||
$conn_password = "fennec621";
|
||||
$conn_database = "gallery";
|
||||
|
||||
$conn = mysqli_connect($conn_ip, $conn_username, $conn_password , $conn_database);
|
||||
if ($conn->connect_error) {
|
||||
?>
|
||||
<script>
|
||||
sniffleAdd('Error','Could not make a connection to the server, please try again later','var(--red)','assets/icons/warning.svg');
|
||||
</script>
|
||||
<?php
|
||||
$conn = @mysqli_connect($conn_ip, $conn_username, $conn_password , $conn_database);
|
||||
} catch (Exception $e) {
|
||||
header("location: error.php?e=conn");
|
||||
}
|
||||
|
||||
session_start();
|
||||
|
|
24
css/main.css
24
css/main.css
|
@ -761,10 +761,10 @@ nav .btn {
|
|||
|
||||
/*
|
||||
|-------------------------------------------------------------
|
||||
| SEARCH
|
||||
| ERROR PAGE
|
||||
|-------------------------------------------------------------
|
||||
*/
|
||||
.search-root {
|
||||
.error-root {
|
||||
margin-bottom: 1rem;
|
||||
padding: 0.5rem 0.5rem 0 0.5rem;
|
||||
width: calc(100% - 1.4rem);
|
||||
|
@ -774,21 +774,21 @@ nav .btn {
|
|||
border: 0.2rem solid #8C977D;
|
||||
box-shadow: 6px 6px 2px rgba(21, 21, 21, 0.5333333333);
|
||||
}
|
||||
.search-root > * {
|
||||
.error-root > * {
|
||||
margin-top: 0;
|
||||
margin-bottom: 0.5rem;
|
||||
}
|
||||
.search-root h1,
|
||||
.search-root h2,
|
||||
.search-root h3,
|
||||
.search-root h4,
|
||||
.search-root h5 {
|
||||
.error-root h1,
|
||||
.error-root h2,
|
||||
.error-root h3,
|
||||
.error-root h4,
|
||||
.error-root h5 {
|
||||
font-family: "Lexend Deca", sans-serif;
|
||||
}
|
||||
.search-root p,
|
||||
.search-root a,
|
||||
.search-root button,
|
||||
.search-root input {
|
||||
.error-root p,
|
||||
.error-root a,
|
||||
.error-root button,
|
||||
.error-root input {
|
||||
font-family: "Secular One", sans-serif;
|
||||
}
|
||||
|
||||
|
|
|
@ -416,10 +416,10 @@
|
|||
|
||||
/*
|
||||
|-------------------------------------------------------------
|
||||
| SEARCH
|
||||
| ERROR PAGE
|
||||
|-------------------------------------------------------------
|
||||
*/
|
||||
.search-root {
|
||||
.error-root {
|
||||
@include defaultDecoration($page-accent);
|
||||
@include defaultFont();
|
||||
}
|
26
error.php
Normal file
26
error.php
Normal file
|
@ -0,0 +1,26 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<?php require_once __DIR__."/ui/header.php"; ?>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<div></div>
|
||||
|
||||
<div class="error-root">
|
||||
<h2>Woops...</h2>
|
||||
<?php
|
||||
if ($_GET["e"] == "conn") {
|
||||
echo "<p>An error occured while connecting to the server. If you're an admin, check the database configuration and/or make sure the database is alive</p>";
|
||||
} else {
|
||||
echo "<p>An error occured! But no description was provided.</p>";
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
|
||||
<?php require_once __DIR__."/ui/footer.php"; ?>
|
||||
</body>
|
||||
|
||||
</html>
|
Loading…
Reference in a new issue