"; // Div Start echo "
"; // Header for the flyout, must be included echo "

Header

"; // Flyout content, must be included!!!! echo "

Description

"; // Flyout button, not required so must need more information when added echo $action; // Exit button + Div End echo "
"; // Must be included with flyout.php echo ""; ?> 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 This gets the user info from the image */ if (isset($image['author'])) { $user = get_user_info($conn, $image['author']); } /* Check user privilge This requires the user to be logged in or an admin */ if (image_privilage($image['author']) || is_admin($_SESSION['id'])) { $privilaged = True; } else { $privilaged = False; } ?> Lynx Gallery "; 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 { header("Location: image.php?id=".$image['id']."&del=fail>"); } } /* 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:image.php?id=".$image["id"]."&update=success"); } else { header("Location:image.php?id=".$image["id"]."&update=error"); } } } /* Adding tags */ if (isset($_POST['tags_flyout']) && $privilaged) { $header = "Tags"; $content = "Add image tags here! This is still being tested so your tags may be removed later on. Tags ONLY accept, letters, numbers and underscores. Hyphens will be stitched to underscores and spaces will seperate the different tags from eachother."; $action = "
"; flyout($header, $content, $action); } /* Tags Confirm */ if (isset($_POST['tags_confirm']) && $privilaged) { // Unset all the variables, needed by flyout unset($header, $content, $action); // Clean tags before adding function clean($string) { // Change to lowercase $string = strtolower($string); // Replace hyphens $string = str_replace('-', '_', $string); // Regex $string = preg_replace('/[^A-Za-z0-9\_ ]/', '', $string); // Return string return preg_replace('/ +/', ' ', $string); } // Clean input $tags_string = tag_clean(trim($_POST['add_tags'])); // getting ready forSQL asky asky $sql = "UPDATE swag_table SET tags=? WHERE id=?"; // Checking if databse is doing ok if ($stmt = mysqli_prepare($conn, $sql)) { mysqli_stmt_bind_param($stmt, "si", $param_tags, $param_id); // Setting parameters $param_tags = $tags_string; $param_id = $image["id"]; // Attempt to execute the prepared statement if (mysqli_stmt_execute($stmt)) { header("Location:image.php?id=".$image["id"]."&update=success"); } else { header("Location:image.php?id=".$image["id"]."&update=error"); } } } /* Description athor */ if (isset($_POST['author_flyout']) && is_admin($_SESSION['id'])) { $header = "Who owns the image?????"; $content = "Enter ID of image owner"; $action = "
"; flyout($header, $content, $action); } /* Author confirm */ if (isset($_POST['author_confirm']) && is_admin($_SESSION['id'])) { // 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:image.php?id=".$image["id"]."&update=success"); } else { header("Location:image.php?id=".$image["id"]."&update=error"); } } } ?>
"; ?>

Description

".$image_alt."

"; } else { echo "

No description provided

"; } ?>

Details

Author: ".$user['username']."

"; } else { echo "

Author: Deleted User

"; } } else { echo "

Author: No author

"; } // Image ID echo "

ID: ".$image['id']."

"; // File name if (strlen($image['imagename']) > 30) { echo "

File Name: ".trim(substr($image['imagename'], 0, 30))."...

"; } else { echo "

File Name: ".$image['imagename']."

"; } // File extention echo "

File Type: ".pathinfo($image['imagename'], PATHINFO_EXTENSION)."

"; // Image resolution list($width, $height) = getimagesize($image_path); echo "

Image resolution: ".$width."x".$height."

"; // Image Upload date echo "

Last updated: ".$image['upload']." (+0)

"; // Image download echo "Download image"; ?>

Tags

".$tag."

"; } } else { echo "

No tags present

"; } ?>

Danger zone

"; // Delete echo "
"; // Edit description echo "
"; // Edit tags echo "
"; // Edit authro if (is_admin($_SESSION['id'])) { echo "
"; } echo ""; echo""; echo ""; } ?> "; include "ui/top.html"; include "ui/footer.php"; ?>