mirror of
https://github.com/Fluffy-Bean/image-gallery.git
synced 2025-01-01 12:26:00 +00:00
Give an error when connection dies
This commit is contained in:
parent
cb838ad53b
commit
dec15d7b63
|
@ -4,18 +4,15 @@
|
||||||
|
|
||||||
Dunno what else to put here lol
|
Dunno what else to put here lol
|
||||||
*/
|
*/
|
||||||
$conn_ip = "192.168.0.79:3306";
|
try {
|
||||||
$conn_username = "uwu";
|
$conn_ip = "192.168.0.79:3306";
|
||||||
$conn_password = "fennec621";
|
$conn_username = "uwu";
|
||||||
$conn_database = "gallery";
|
$conn_password = "fennec621";
|
||||||
|
$conn_database = "gallery";
|
||||||
|
|
||||||
$conn = mysqli_connect($conn_ip, $conn_username, $conn_password , $conn_database);
|
$conn = @mysqli_connect($conn_ip, $conn_username, $conn_password , $conn_database);
|
||||||
if ($conn->connect_error) {
|
} catch (Exception $e) {
|
||||||
?>
|
header("location: error.php?e=conn");
|
||||||
<script>
|
|
||||||
sniffleAdd('Error','Could not make a connection to the server, please try again later','var(--red)','assets/icons/warning.svg');
|
|
||||||
</script>
|
|
||||||
<?php
|
|
||||||
}
|
}
|
||||||
|
|
||||||
session_start();
|
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;
|
margin-bottom: 1rem;
|
||||||
padding: 0.5rem 0.5rem 0 0.5rem;
|
padding: 0.5rem 0.5rem 0 0.5rem;
|
||||||
width: calc(100% - 1.4rem);
|
width: calc(100% - 1.4rem);
|
||||||
|
@ -774,21 +774,21 @@ nav .btn {
|
||||||
border: 0.2rem solid #8C977D;
|
border: 0.2rem solid #8C977D;
|
||||||
box-shadow: 6px 6px 2px rgba(21, 21, 21, 0.5333333333);
|
box-shadow: 6px 6px 2px rgba(21, 21, 21, 0.5333333333);
|
||||||
}
|
}
|
||||||
.search-root > * {
|
.error-root > * {
|
||||||
margin-top: 0;
|
margin-top: 0;
|
||||||
margin-bottom: 0.5rem;
|
margin-bottom: 0.5rem;
|
||||||
}
|
}
|
||||||
.search-root h1,
|
.error-root h1,
|
||||||
.search-root h2,
|
.error-root h2,
|
||||||
.search-root h3,
|
.error-root h3,
|
||||||
.search-root h4,
|
.error-root h4,
|
||||||
.search-root h5 {
|
.error-root h5 {
|
||||||
font-family: "Lexend Deca", sans-serif;
|
font-family: "Lexend Deca", sans-serif;
|
||||||
}
|
}
|
||||||
.search-root p,
|
.error-root p,
|
||||||
.search-root a,
|
.error-root a,
|
||||||
.search-root button,
|
.error-root button,
|
||||||
.search-root input {
|
.error-root input {
|
||||||
font-family: "Secular One", sans-serif;
|
font-family: "Secular One", sans-serif;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -416,10 +416,10 @@
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|-------------------------------------------------------------
|
|-------------------------------------------------------------
|
||||||
| SEARCH
|
| ERROR PAGE
|
||||||
|-------------------------------------------------------------
|
|-------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
.search-root {
|
.error-root {
|
||||||
@include defaultDecoration($page-accent);
|
@include defaultDecoration($page-accent);
|
||||||
@include defaultFont();
|
@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