php-gallery/index.php

122 lines
3.8 KiB
PHP
Raw Normal View History

2022-07-20 23:06:21 +00:00
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
2022-08-03 16:46:50 +00:00
<title>Lynx Gallery</title>
2022-08-09 20:09:20 +00:00
<!-- Stylesheets -->
2022-07-21 14:53:04 +00:00
<link rel="stylesheet" href="css/master.css">
2022-08-09 20:09:20 +00:00
<link rel="stylesheet" href="css/normalise.css">
<!-- Google Fonts -->
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Lexend+Deca:wght@600">
2022-08-09 13:11:32 +00:00
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Secular+One&display=swap">
2022-08-03 16:46:50 +00:00
<!-- JQuery -->
<script
src="https://code.jquery.com/jquery-3.6.0.min.js"
integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4="
crossorigin="anonymous">
</script>
2022-08-06 09:52:40 +00:00
<!-- Sniffle script! -->
<script src="Sniffle/sniffle.js"></script>
<link rel='stylesheet' href='Sniffle/sniffle.css'>
<!-- Flyout script! -->
<script src="Flyout/flyout.js"></script>
<link rel='stylesheet' href='Flyout/flyout.css'>
2022-08-09 20:09:20 +00:00
<?php include "ui/required.php"; ?>
2022-07-20 23:06:21 +00:00
</head>
<body>
2022-08-02 13:13:35 +00:00
<?php
2022-08-03 16:46:50 +00:00
include "ui/nav.php";
2022-08-02 13:13:35 +00:00
?>
2022-07-25 15:13:26 +00:00
2022-08-06 09:52:40 +00:00
<script>
sniffleAdd("Warning", "The website is currently being worked on, some functionality has been restored, but tread carefully as errors may occur", "var(--red)", "<?php echo $root_dir ?>assets/icons/warning.svg");
2022-08-06 21:14:05 +00:00
2022-08-06 09:52:40 +00:00
if (params.del == "true") {
2022-08-06 21:14:05 +00:00
sniffleAdd("Image Deleted", "Successfully deleted image: <?php echo $_GET['id']; ?>", "var(--green)", "<?php echo $root_dir ?>assets/icons/trash.svg");
2022-08-01 13:09:53 +00:00
}
2022-08-06 09:52:40 +00:00
if (params.login == "success") {
2022-08-06 21:14:05 +00:00
sniffleAdd("Logged in", "O hi <?php echo $_SESSION['username']; ?>", "var(--green)", "<?php echo $root_dir ?>assets/icons/hand-waving.svg");
2022-08-01 13:09:53 +00:00
}
2022-08-06 09:52:40 +00:00
</script>
2022-07-31 11:50:52 +00:00
2022-07-21 18:42:03 +00:00
<div class="info-text center">
2022-07-25 15:13:26 +00:00
<?php
// Set time for message
$time = date("H");
$timezone = date("e");
if ($time < "12") {
$time_welc = "Good morning";
} else if ($time >= "12" && $time < "17") {
$time_welc = "Good afternoon";
} else if ($time >= "17" && $time < "19") {
$time_welc = "Good evening";
} else if ($time >= "19") {
$time_welc = "Good night";
}
2022-07-25 17:28:55 +00:00
// Welcome depending on if user is logged in or not
2022-07-25 15:13:26 +00:00
if (isset($_SESSION["username"])) {
echo "<h1>".$time_welc." ".$_SESSION['username']."!</h1>";
2022-07-25 15:13:26 +00:00
} else {
2022-08-09 13:11:32 +00:00
echo "<h1>".$time_welc."!</h1>";
2022-07-25 15:13:26 +00:00
}
2022-07-25 17:28:55 +00:00
// Random welcome message
$welcome_message = array("*internal screaming*",
"Sussy Wussy",
"What is this world?",
"Don't forget to drink water!",
"Bruh",
"This is so poorly programmed",
"Sorry",
"Fluffy made this!",
"maybe",
"I'm gay",
"I wish we were better strangers.",
"<span style='color:#ffff00;'>Just like Minecraft!</span>",
2022-08-09 13:11:32 +00:00
"If I were you, I'd run now",
"This is the part where I kill you",
"SILICA GEL \"DO NOT EAT\".",
"This was supposed to be a simple project",
"AAAAAAAAAAAAAAAAAAAA",
"Let me out",
"nice",
2022-08-09 20:09:20 +00:00
"Thank you that you're here",
"The weather is dry",
"Need me a man 👀");
2022-07-25 17:28:55 +00:00
echo "<p>".$welcome_message[array_rand($welcome_message, 1)]."</p>";
2022-07-25 15:13:26 +00:00
?>
2022-07-21 18:42:03 +00:00
</div>
2022-07-20 23:06:21 +00:00
2022-07-21 14:53:04 +00:00
<div class="gallery-root flex-left">
2022-07-20 23:06:21 +00:00
<?php
// Reading images from table
2022-08-01 18:20:51 +00:00
$image_request = mysqli_query($conn, "SELECT * FROM swag_table ORDER BY id DESC");
2022-07-24 09:43:54 +00:00
while ($image = mysqli_fetch_array($image_request)) {
2022-07-31 11:50:52 +00:00
// Getting thumbnail
if (file_exists("images/thumbnails/".$image['imagename'])) {
$image_path = "images/thumbnails/".$image['imagename'];
} else {
$image_path = "images/".$image['imagename'];
}
2022-07-24 12:20:12 +00:00
2022-07-31 11:50:52 +00:00
// Image loading
echo "<div class='gallery-item'>";
2022-08-03 16:46:50 +00:00
echo "<a href='image.php?id=".$image['id']."'><img class='gallery-image' loading='lazy' src='".$image_path."' id='".$image['id']."'></a>";
2022-07-31 11:50:52 +00:00
echo "</div>";
2022-07-20 23:06:21 +00:00
}
?>
</div>
<?php include "ui/footer.php"; ?>
2022-07-20 23:06:21 +00:00
</body>
</html>