diff --git a/app/image/edit_description.php b/app/image/edit_description.php
index 9ef91da..8a9a547 100644
--- a/app/image/edit_description.php
+++ b/app/image/edit_description.php
@@ -1,17 +1,4 @@
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;
+
+
+if (isset($_POST['submit'])) {
+ // 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 = $_POST['id'];
+
+ // Attempt to execute the prepared statement
+ if (mysqli_stmt_execute($stmt)) {
+ echo "sniffleAdd('Info','Description has been updated successfully! You may need to refresh the page to see the new information.','var(--green)')";
} else {
- return False;
+ echo "sniffleAdd('Error','An error occured on the servers','var(--red)')";
}
- } 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/image.php b/image.php
index 2a6cdb5..1a5b507 100644
--- a/image.php
+++ b/image.php
@@ -68,11 +68,7 @@ if (image_privilage($image['author']) || is_admin($_SESSION['id'])) {
-
+
@@ -123,35 +119,6 @@ if (image_privilage($image['author']) || is_admin($_SESSION['id'])) {
}
}
-
- /*
- 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");
- }
- }
- }
-
-
/*
Tags Confirm
*/
@@ -340,37 +307,28 @@ if (image_privilage($image['author']) || is_admin($_SESSION['id'])) {
|-------------------------------------------------------------
| Edit description
|-------------------------------------------------------------
- | As the name suggests, this edits the description, this
- | Uses the following variables:
- | editDescriptionButton
- | editDescriptionConfirm
- | editDescriptionInput
- | editDescriptionSubmit
- |-------------------------------------------------------------
-->