This is a dangerous place to step foot into... tread carefully.
-
- ".$error."";
- }
- ?>
-
-
-
-
-
diff --git a/image.php b/image.php
index 6cc21af..2d8d8fe 100644
--- a/image.php
+++ b/image.php
@@ -50,6 +50,7 @@ if (isset($image['author'])) {
}
?>
+
@@ -189,6 +190,61 @@ if (isset($image['author'])) {
}
}
+ /*
+ 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
+ $tags_string = strtolower($tags_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 = 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: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
*/
@@ -290,25 +346,27 @@ if (isset($image['author'])) {
Tags
".$tag."";
+ }
+ } else {
+ echo "
No tags present
";
}
- $tags_string = "This is a test of ta.gs and their s//ystem_of_ignoring ran!!dom characters BUT THIS DOES$$$$$$.NT WORK YET!!!!";
- $tags_string = strtolower($tags_string);
- $tags_string = clean($tags_string);
- $image_tags_array = explode(" ", $tags_string);
- foreach ($image_tags_array as $tag) {
- echo "