Could not find image with ID: ".$_GET['id']."
"; // Replacement "no image" image and description $image_path = "assets/no_image.png"; $image_alt = "No image could be found, sowwy"; } } else { // No ID toast echo "No ID present
"; // Replacement "no image" image and description $image_path = "assets/no_image.png"; $image_alt = "No image could be found, sowwy"; } // Get all user details if (isset($image['author'])) { $get_user = "SELECT * FROM users WHERE id = ".$image['author']; $user_results = mysqli_query($conn, $get_user); $user = mysqli_fetch_assoc($user_results); } ?>Something went fuckywucky, please try later
"; } /* Check if the user is an admin session id = 1 Or the owner of the image, image author == session id This may not be the best system of doing this, but much better than not having it at all I plan on adding an array of privilaged users that user with the id of 1 can modify, sort of like a mod/admin list of users */ if (isset($_SESSION['id']) && $image['author'] == $_SESSION['id'] || $_SESSION['id'] == 1) { $privilaged = True; } else { $privilaged = False; } /* Test flyout button */ if (isset($_POST['test_flyout'])) { $header = "Sus"; $content = "This is a test UwU. You are currently viewing image: ".$_GET['id']; $action = "This button does nothing! I'm another button, but scawwy"; flyout($header, $content, $action); } /* Delete flyout This goes with the confirm script below, to use flyout, you must include the js script and php function */ if (isset($_POST['delete_flyout']) && $privilaged) { $header = "Are you sure?"; $content = "Deleting this image is pernament, there is no going back after this!!!!!"; $action = ""; flyout($header, $content, $action); } /* Confirm deleting user user must be privilaged to do this action this the privilaged == true */ if (isset($_POST['delete_confirm']) && $privilaged) { // Unset all the variables, needed by flyout unset($header, $content, $action); // Delete from table $image_delete_request = "DELETE FROM swag_table WHERE id =".$image['id']; $image_delete = mysqli_query($conn,$image_delete_request); if ($image_delete) { // See if image is in the directory if (is_file("images/".$image['imagename'])) { unlink("images/".$image['imagename']); } // Delete thumbnail if exitsts if (is_file("images/thumbnails/".$image['imagename'])) { unlink("images/thumbnails/".$image['imagename']); } header("Location:index.php?del=true&id=".$image['id']); } else { $error = "Could not delete image"; } } /* Description edit */ if (isset($_POST['description_flyout']) && $privilaged) { $header = "Enter new Description/Alt"; $content = "Whatcha gonna put in there 👀"; $action = ""; flyout($header, $content, $action); } /* Description confirm */ if (isset($_POST['description_confirm']) && $privilaged) { // Unset all the variables, needed by flyout unset($header, $content, $action); // getting ready forSQL asky asky $sql = "UPDATE swag_table SET alt=? WHERE id=?"; // Checking if databse is doing ok if ($stmt = mysqli_prepare($conn, $sql)) { mysqli_stmt_bind_param($stmt, "si", $param_alt, $param_id); // Setting parameters $param_alt = $_POST['update_alt']; $param_id = $image["id"]; // Attempt to execute the prepared statement if (mysqli_stmt_execute($stmt)) { header("Location:https://superdupersecteteuploadtest.fluffybean.gay/image.php?id=".$image["id"]."&update=success"); } else { header("Location:https://superdupersecteteuploadtest.fluffybean.gay/image.php?id=".$image["id"]."&update=error"); } } } /* Description athor */ if (isset($_POST['author_flyout']) && $_SESSION['id'] == 1) { $header = "Who owns the image?????"; $content = "Enter ID of image owner"; $action = ""; flyout($header, $content, $action); } /* Author confirm */ if (isset($_POST['author_confirm']) && $_SESSION['id'] == 1) { // Unset all the variables, needed by flyout unset($header, $content, $action); // getting ready forSQL asky asky $sql = "UPDATE swag_table SET author=? WHERE id=?"; // Checking if databse is doing ok if ($stmt = mysqli_prepare($conn, $sql)) { mysqli_stmt_bind_param($stmt, "si", $param_author, $param_id); // Setting parameters $param_author = $_POST['update_author']; $param_id = $image["id"]; // Attempt to execute the prepared statement if (mysqli_stmt_execute($stmt)) { header("Location:https://superdupersecteteuploadtest.fluffybean.gay/image.php?id=".$image["id"]."&update=success"); } else { header("Location:https://superdupersecteteuploadtest.fluffybean.gay/image.php?id=".$image["id"]."&update=error"); } } } ?>No description provided
"; } ?>Author: Deleted User
"; } } else { echo "Author: No author
"; } // Image ID echo "ID: ".$image['id']."
"; // File name echo "File Name: ".$image['imagename']."
"; // Image Upload date echo "Last updated: ".$image['upload']." (+0)
"; // Image resolution list($width, $height) = getimagesize($image_path); echo "Image resolution: ".$width."x".$height."
"; // Image download echo "Download image"; // Flyout test button ?>