php-gallery/index.php

71 lines
2.3 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-07-25 15:13:26 +00:00
<title>Gallery</title>
2022-07-21 14:53:04 +00:00
<link rel="stylesheet" href="css/master.css">
2022-07-20 23:06:21 +00:00
<link href="https://fonts.googleapis.com/css2?family=Rubik" rel="stylesheet">
2022-07-22 00:21:48 +00:00
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Lexend+Deca:wght@600&amp;display=swap">
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Fira+Code:wght@500&amp;display=swap">
2022-07-20 23:06:21 +00:00
</head>
<body>
2022-07-21 18:42:03 +00:00
<?php
2022-07-24 09:43:54 +00:00
include("ui/header.php");
// Deletion toast
2022-07-21 18:42:03 +00:00
if ($_GET["del"] == "true") {
2022-07-22 00:21:48 +00:00
echo "<p class='alert alert-high space-bottom'>Successfully deleted image: ".$_GET['id']."</p>";
2022-07-21 18:42:03 +00:00
}
2022-07-25 15:13:26 +00:00
// Account toast
if ($_GET["login"] == "success") {
2022-07-28 13:04:44 +00:00
echo "<p class='alert alert-high space-bottom'>O hi ".$_SESSION['username']."</p>";
2022-07-25 15:13:26 +00:00
}
2022-07-21 18:42:03 +00:00
?>
<div class="info-text center">
2022-07-25 15:13:26 +00:00
<?php
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>Welcome ".$_SESSION['username']."!</h1>";
} else {
echo "<h1>Welcome!</h1>";
}
2022-07-25 17:28:55 +00:00
// Random welcome message
2022-07-26 17:16:17 +00:00
$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");
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
2022-07-24 09:43:54 +00:00
include_once("ui/conn.php");
2022-07-20 23:06:21 +00:00
// Reading images from table
2022-07-24 09:43:54 +00:00
$image_request = mysqli_query($conn, "SELECT * FROM swag_table");
while ($image = mysqli_fetch_array($image_request)) {
// Getting thumbnail
2022-07-24 09:43:54 +00:00
if (file_exists("images/thumbnails/".$image['imagename'])) {
$image_path = "images/thumbnails/".$image['imagename'];
2022-07-23 07:44:43 +00:00
} else {
2022-07-24 09:43:54 +00:00
$image_path = "images/".$image['imagename'];
}
2022-07-24 12:20:12 +00:00
2022-07-20 23:06:21 +00:00
// Image loading
echo "<div class='gallery-item'>";
2022-07-24 09:43:54 +00:00
echo "<a href='https://superdupersecteteuploadtest.fluffybean.gay/image.php?id=".$image['id']."'><img class='gallery-image' loading='lazy' src='".$image_path."' id='".$image['id']."'></a>";
2022-07-20 23:06:21 +00:00
echo "</div>";
}
?>
</div>
2022-07-26 12:34:48 +00:00
<?php
include("ui/top.html");
include("ui/footer.php");
2022-07-26 12:34:48 +00:00
?>
2022-07-20 23:06:21 +00:00
</body>
</html>