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'])) {
- +
- + diff --git a/index.php b/index.php index 47b09df..c6503c2 100644 --- a/index.php +++ b/index.php @@ -108,9 +108,6 @@ ?> - + diff --git a/scripts/top.js b/scripts/top.js deleted file mode 100644 index 87f2b5c..0000000 --- a/scripts/top.js +++ /dev/null @@ -1,13 +0,0 @@ -$(document).ready(function() { - button = document.getElementById("back-to-top"); - - window.onscroll = function() {scrollFunction()}; - - function scrollFunction() { - if (document.body.scrollTop > 300 || document.documentElement.scrollTop > 20) { - button.style.right = "1rem"; - } else { - button.style.right = "-2.5rem"; - } - } -}); diff --git a/ui/functions.php b/ui/functions.php index fadd86b..e11239b 100644 --- a/ui/functions.php +++ b/ui/functions.php @@ -188,4 +188,3 @@ function notify($text, $level) { return $text_string; } -?> diff --git a/ui/nav.php b/ui/nav.php index 9f57a20..4a4f72e 100644 --- a/ui/nav.php +++ b/ui/nav.php @@ -13,7 +13,7 @@ echo "
"; echo "".substr($_SESSION["username"], 0, 15).""; } else { - echo "Login"; + echo "Login"; } ?> diff --git a/ui/required.php b/ui/required.php index d1e1eb1..838f2b4 100644 --- a/ui/required.php +++ b/ui/required.php @@ -1,22 +1,4 @@ connect_error) { - // Send notification that connection couldn't be made -} - - /* Start session @@ -37,6 +19,11 @@ if (is_file("index.php")) { } +/* + Connect to the server +*/ +include $root_dir."app/server/conn.php"; + /* Include functions @@ -66,10 +53,16 @@ echo "
"; }); - +
- +

Header

@@ -77,3 +70,26 @@ echo "
";
+ + + + + + diff --git a/ui/top.html b/ui/top.html deleted file mode 100644 index 12b1f7c..0000000 --- a/ui/top.html +++ /dev/null @@ -1,4 +0,0 @@ - - - -