testing displaying image tags

This commit is contained in:
Michał 2022-07-28 22:18:14 +01:00
parent 9ea25ff6d9
commit 0d9687e836
4 changed files with 56 additions and 12 deletions

View file

@ -21,20 +21,23 @@
if (isset($_SESSION["loggedin"]) && $_SESSION["loggedin"] === true) { if (isset($_SESSION["loggedin"]) && $_SESSION["loggedin"] === true) {
echo "<p>O hi ".$_SESSION["username"].".</p>"; echo "<p>O hi ".$_SESSION["username"].".</p>";
// Reset password
echo "<a class='btn alert-low space-top' href='https://superdupersecteteuploadtest.fluffybean.gay/account/password-reset.php'><img class='svg' src='../assets/icons/password.svg'>Reset Password</a>";
// Logout
echo "<a class='btn alert-low space-top' href='https://superdupersecteteuploadtest.fluffybean.gay/account/logout.php'><img class='svg' src='../assets/icons/sign-out.svg'>Logout</a>";
// Join code // Join code
if ($_SESSION["id"] == 1) { if ($_SESSION["id"] == 1) {
echo "<h2 class='space-top-large'>Invite Code</h2>"; echo "<h3 class='space-top'>Invite Codes</h3>";
$token_request = mysqli_query($conn, "SELECT * FROM tokens WHERE used = 0"); $token_request = mysqli_query($conn, "SELECT * FROM tokens WHERE used = 0");
while ($token = mysqli_fetch_array($token_request)) { while ($token = mysqli_fetch_array($token_request)) {
echo "<p class='text-box space-top center'>".$token['code']."</p>"; echo "<p class='text-box space-top center alert-default'>".$token['code']."</p>";
} }
} }
echo "<h3 class='space-top'>Danger ahead</h3>";
// Reset password
echo "<p class='text-box space-top-large center alert-default'>Resetting your password regularly is a good way of keeping your account safe</p>";
echo "<a class='btn alert-low space-top-small' href='https://superdupersecteteuploadtest.fluffybean.gay/account/password-reset.php'><img class='svg' src='../assets/icons/password.svg'>Reset Password</a>";
// Logout
echo "<p class='text-box space-top-large center alert-default'>Don't leave! I'm with the science team!</p>";
echo "<a class='btn alert-low space-top-small' href='https://superdupersecteteuploadtest.fluffybean.gay/account/logout.php'><img class='svg' src='../assets/icons/sign-out.svg'>Logout</a>";
} else { } else {
echo "<p class='space-bottom-large'>You must be logged in to change your account settings!</p>"; echo "<p class='space-bottom-large'>You must be logged in to change your account settings!</p>";
echo "<a class='btn alert-high space-top-large' href='https://superdupersecteteuploadtest.fluffybean.gay/account/login.php'>Login!</a>"; echo "<a class='btn alert-high space-top-large' href='https://superdupersecteteuploadtest.fluffybean.gay/account/login.php'>Login!</a>";

View file

@ -227,6 +227,19 @@ body {
border: 0.2rem solid var(--red); border: 0.2rem solid var(--red);
} }
.tags-root {
border: 0.2rem solid var(--green);
}
.tag {
margin: 0.25rem; padding: 0.5rem;
display: block;
border-radius: var(--rad);
}
.tag::before {
content: '#';
}
/* /*
-=-=-= UNIVERSAL =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- -=-=-= UNIVERSAL =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
*/ */
@ -250,6 +263,14 @@ body {
text-align: center; text-align: center;
} }
.space-bottom-small {
margin-bottom: 0.5rem;
margin-top: 0;
}
.space-top-small {
margin-top: 0.5rem;
margin-bottom: 0;
}
.space-bottom { .space-bottom {
margin-bottom: 1rem; margin-bottom: 1rem;
margin-top: 0; margin-top: 0;
@ -283,7 +304,6 @@ body {
text-decoration: none; text-decoration: none;
background-color: var(--black);
border: none; border: none;
border-radius: var(--rad); border-radius: var(--rad);
} }

View file

@ -68,7 +68,7 @@
<h2>Description</h2> <h2>Description</h2>
<?php <?php
// Image Description/Alt // Image Description/Alt
if (isset($image_alt)) { if (isset($image_alt) && !empty($image_alt)) {
echo "<p>".$image_alt."</p>"; echo "<p>".$image_alt."</p>";
} else { } else {
echo "<p>No description provided</p>"; echo "<p>No description provided</p>";
@ -108,6 +108,27 @@
?> ?>
</div> </div>
<div class="tags-root default-window">
<h2>Tags</h2>
<div class="tags flex-left around">
<?php
function clean($string) {
$string = str_replace('-', '_', $string);
$string = preg_replace('/[^A-Za-z0-9\_ ]/', '', $string);
return preg_replace('/ +/', ' ', $string);
}
$tags_string = "This is a test of ta.gs and their s//ystem_of_ignoring ran!!dom characters BUT THIS DOES$$$$$$.NT WORK YET!!!!";
$tags_string = strtolower($tags_string);
$tags_string = clean($tags_string);
$image_tags_array = explode(" ", $tags_string);
foreach ($image_tags_array as $tag) {
echo "<p class='tag alert-high'>".$tag."</p>";
}
?>
</div>
</div>
<?php <?php
// Check if user is admin or the owner of image, if yes, display the edit and delete div // Check if user is admin or the owner of image, if yes, display the edit and delete div
if (isset($_SESSION['id']) && $image['author'] == $_SESSION['id'] || $_SESSION['id'] == 1) { if (isset($_SESSION['id']) && $image['author'] == $_SESSION['id'] || $_SESSION['id'] == 1) {
@ -144,7 +165,7 @@
echo "</form>"; echo "</form>";
// Edit image button // Edit image button
echo "<a class='btn alert-low space-top' href='https://superdupersecteteuploadtest.fluffybean.gay/edit.php?id=".$image['id']."'><img class='svg' src='assets/icons/edit.svg'>Modify image content</a>"; echo "<a class='btn alert-low space-top-small' href='https://superdupersecteteuploadtest.fluffybean.gay/edit.php?id=".$image['id']."'><img class='svg' src='assets/icons/edit.svg'>Modify image content</a>";
echo "</div>"; echo "</div>";
} }
?> ?>

View file

@ -10,7 +10,7 @@ if (is_dir("assets/icons/")) {
<nav class="nav-root flex-left between"> <nav class="nav-root flex-left between">
<div class="nav-name flex-left"> <div class="nav-name flex-left">
<h3>Fluffys Amazing Gallery!</h3> <h3>OnlyLegs</h3>
</div> </div>
<div class="nav-links flex-left"> <div class="nav-links flex-left">
<?php <?php