diff --git a/app/image/delete_image.php b/app/image/delete_image.php new file mode 100644 index 0000000..e69de29 diff --git a/app/image/edit_author.php b/app/image/edit_author.php new file mode 100644 index 0000000..e69de29 diff --git a/app/image/edit_description.php b/app/image/edit_description.php new file mode 100644 index 0000000..9ef91da --- /dev/null +++ b/app/image/edit_description.php @@ -0,0 +1,76 @@ +connect_error) { + // Send notification that connection couldn't be made +} +function image_privilage($id) { + $session_id = $_SESSION['id']; + if (isset($session_id) || !empty($session_id)) { + if ($session_id == $id) { + return True; + } else { + return False; + } + } else { + return False; + } +} +function get_image_info($conn, $id) { + // Setting SQL query + $sql = "SELECT * FROM swag_table WHERE id = ".$id; + // Getting results + $query = mysqli_query($conn, $sql); + // Fetching associated info + $image_array = mysqli_fetch_assoc($query); + + return($image_array); +} + + +// Get image ID to search up +$image_post_id = $_POST['image_id']; +$image_info = get_image_info($conn, $image_post_id); + +if (isset($_POST['description'])) { + // If privilaged, continue + if (image_privilage($image_info['id'])) { + // 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['description']; + $param_id = $image_post_id; + + // Attempt to execute the prepared statement + if (mysqli_stmt_execute($stmt)) { + echo ""; + } else { + echo ""; + } + } + } else { + echo ""; + } +} diff --git a/app/image/edit_tags.php b/app/image/edit_tags.php new file mode 100644 index 0000000..e69de29 diff --git a/app/server/conn.php b/app/server/conn.php new file mode 100644 index 0000000..2f6fda8 --- /dev/null +++ b/app/server/conn.php @@ -0,0 +1,17 @@ +connect_error) { + // Send notification that connection couldn't be made +} diff --git a/image.php b/image.php index 91d9900..2a6cdb5 100644 --- a/image.php +++ b/image.php @@ -95,20 +95,6 @@ if (image_privilage($image['author']) || is_admin($_SESSION['id'])) { - - "; - - flyout($header, $content, $action); - } /* Confirm deleting user @@ -137,19 +123,7 @@ if (image_privilage($image['author']) || is_admin($_SESSION['id'])) { } } - /* - 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 */ @@ -177,19 +151,7 @@ if (image_privilage($image['author']) || is_admin($_SESSION['id'])) { } } - /* - 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 */ @@ -367,15 +329,49 @@ if (image_privilage($image['author']) || is_admin($_SESSION['id'])) { - - + + @@ -383,7 +379,11 @@ if (image_privilage($image['author']) || is_admin($_SESSION['id'])) { @@ -394,7 +394,7 @@ if (image_privilage($image['author']) || is_admin($_SESSION['id'])) { - +