From 9fd958648b22e12b8bd891aa5f06fc11c3d412a4 Mon Sep 17 00:00:00 2001 From: Fluffy-Bean Date: Mon, 1 Aug 2022 14:09:53 +0100 Subject: [PATCH] New alert system --- account/login.php | 20 ++++++++++++-------- account/password-reset.php | 14 +++++++++----- account/signup.php | 20 ++++++++++++-------- css/master.css | 13 +++++++++++++ image.php | 36 ++++++++++++++++++++++-------------- index.php | 36 ++++++++++++++++++++++-------------- scripts/alert.js | 5 +++++ ui/functions.php | 34 ++++++++++++++++++++++++++++++++++ upload.php | 20 ++++++++++++-------- 9 files changed, 141 insertions(+), 57 deletions(-) create mode 100644 scripts/alert.js diff --git a/account/login.php b/account/login.php index cb36f97..8046253 100644 --- a/account/login.php +++ b/account/login.php @@ -91,6 +91,18 @@ } ?> +
+ + +
+

Login

Passwords are important to keep safe. Don't tell anyone your password, not even Fluffy!

@@ -99,14 +111,6 @@ - ".$error."

"; - } - if (isset($success)) { - echo "

".$success."

"; - } - ?> Need an account? Sign up!
diff --git a/account/password-reset.php b/account/password-reset.php index 416f686..980dfac 100644 --- a/account/password-reset.php +++ b/account/password-reset.php @@ -74,6 +74,15 @@ } ?> +
+ + +
+

Reset Password

After reset, you will be kicked out to login again

@@ -82,11 +91,6 @@ - ".$error."

"; - } - ?>
+
+ + +
+

Make account

And amazing things happened here...

@@ -164,14 +176,6 @@ - ".$error."

"; - } - if (isset($success)) { - echo "

".$success."

"; - } - ?>
diff --git a/css/master.css b/css/master.css index d07963f..6da06d5 100644 --- a/css/master.css +++ b/css/master.css @@ -315,6 +315,18 @@ body { /* -=-=-= ALERT =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- */ +.alert-banner { + margin: 0; padding: 0; + + max-width: 621px; width: calc(100% - 2rem); + height: auto; + + top: 1rem; left: 50%; + transform: translateX(-50%); + + position: fixed; z-index: 9999999; +} + .alert { padding: 1rem; @@ -328,6 +340,7 @@ body { outline: 0.5rem solid var(--bg); } + .alert-high { background-color: var(--green); } diff --git a/image.php b/image.php index 3b31d87..8ea0c80 100644 --- a/image.php +++ b/image.php @@ -16,19 +16,27 @@ + + +
+ + +
+ Information updated

"; - } elseif ($_GET["update"] == "error") { - echo "

Something went fuckywucky, please try later

"; - } - // If ID present pull all image data if (isset($_GET['id'])) { $image = get_image_info($conn, $_GET['id']); @@ -107,7 +115,7 @@ } header("Location:index.php?del=true&id=".$image['id']); } else { - $error = "Could not delete image"; + header("Location: image.php?id=".$image['id']."&del=fail>"); } } @@ -184,7 +192,7 @@ } // Clean input - $tags_string = clean(trim($_POST['add_tags'])); + $tags_string = tag_clean(trim($_POST['add_tags'])); // getting ready forSQL asky asky $sql = "UPDATE swag_table SET tags=? WHERE id=?"; diff --git a/index.php b/index.php index 360bfe5..c343143 100644 --- a/index.php +++ b/index.php @@ -10,19 +10,27 @@ + + +
+ + +
+ Successfully deleted image: ".$_GET['id']."

"; - } - - // Account toast - if ($_GET["login"] == "success") { - echo "

O hi ".$_SESSION['username']."

"; - } - // Show search if ($_GET["srch"] == "show") { $header = "Search for a tags!"; @@ -42,12 +50,12 @@ unset($header, $content, $action); // Clean input - $tags_string = clean(trim($_POST['search'])); + $tags_string = tag_clean(trim($_POST['search'])); header("Location:https://superdupersecteteuploadtest.fluffybean.gay?q=".$tags_string); } if (isset($_GET["q"])) { - echo "

Search results for: ".$_GET['q']."

"; + echo "

Search results for: ".$_GET['q']."

"; } ?> diff --git a/scripts/alert.js b/scripts/alert.js new file mode 100644 index 0000000..c801f24 --- /dev/null +++ b/scripts/alert.js @@ -0,0 +1,5 @@ +let alertClose = document.querySelectorAll(".alert"); + +function closeAlert(aaaa) { + aaaa.closest(".alert").style.display="none"; +}; diff --git a/ui/functions.php b/ui/functions.php index 8cb251d..f5a341a 100644 --- a/ui/functions.php +++ b/ui/functions.php @@ -151,4 +151,38 @@ function flyout($header, $content, $action) { echo " "; } + + +/* + Notification of an action done, takes in min 3 inputs: + + Text is the text that shows up on the notification + Takes in string input + + Level is the level of the notification + high is a good response or the colour green + low is a bad response or the colour red + default is a neutral response or the colour black/gray + + returns notification html including classes + + ===== Editors note ================================== + I made this so I didn't have to remake the html + portion of the notification, it was annoying. + This also allows for expanding the system later on! + ===================================================== +*/ +function notify($text, $level) { + if ($level == "high") { + $text_string = "

".$text."

"; + } elseif ($level == "low") { + $text_string = "

".$text."

"; + } elseif ($level == "default") { + $text_string = "

".$text."

"; + } else { + $text_string = "

".$text."

"; + } + + return $text_string; +} ?> diff --git a/upload.php b/upload.php index d98df5c..741beb6 100644 --- a/upload.php +++ b/upload.php @@ -69,6 +69,18 @@ } ?> +
+ + +
+

Upload image

In this world you have 2 choices, to upload a really cute picture of an animal or fursuit, or something other than those 2 things.

@@ -77,14 +89,6 @@ - ".$error."

"; - } - if (isset($success)) { - echo "

".$success."

"; - } - ?>