From 7c144fec1d93ad7c95e1d508d842a40f02efc31c Mon Sep 17 00:00:00 2001 From: SovereigntyIsNotFreedom Date: Mon, 9 Jun 2025 07:30:42 +0100 Subject: [PATCH 1/6] issue 83: submission status is centered in the middle on submission --- www/header.php | 2 +- www/index.php | 6 +++--- www/style.css | 7 +++++++ www/submit.php | 17 ++++++++++++----- 4 files changed, 23 insertions(+), 9 deletions(-) diff --git a/www/header.php b/www/header.php index 0073bf1..a6a949c 100644 --- a/www/header.php +++ b/www/header.php @@ -204,7 +204,7 @@ function DisplayCategories($instancename, $path) { - +
Submit a link

Update Frequency: every 3 hours


diff --git a/www/index.php b/www/index.php index f147029..85dcbc4 100644 --- a/www/index.php +++ b/www/index.php @@ -23,6 +23,7 @@
CSV LINES: " . $lines_uv . " " . $lines_v . "

"; - ?> +

@@ -99,7 +100,6 @@ require("header.php"); ?>
-
Submit a new link
'],'', $_POST['link']); - // Clear user input + // Clear user input + $success_message = null; + $error_message = null; $link = htmlspecialchars($link); $name = htmlspecialchars($_POST['name']); $description = htmlspecialchars($_POST['description']); @@ -12,13 +14,13 @@ if (isset($_POST['submit'])){ $captcha = htmlspecialchars($_POST['captcha']); // Captcha Auth check if ($captcha != htmlspecialchars($_SESSION['secure'])){ - echo "Captcha Failed"; + $error_message = "Captcha Failed"; }else{ if (empty($link) or empty($name) or empty($description)){ - echo "All of the fields must not be empty"; + $error_message = "All of the fields must not be empty"; }else{ if (strlen($link) > 512 or strlen($name) > 64 or strlen($description) > 256 or strlen($sensitive) > 1 or strlen($category) > 64){ - echo "Don't excede the limit"; + $error_message = "Don't excede the limit"; }else{ // Open the file once before the loop @@ -37,7 +39,7 @@ if (isset($_POST['submit'])){ // Handle error opening the file error_log("Error opening the file."); } - echo "Link Successfully Submitted"; + $success_message = "Link Successfully Submitted"; } } } @@ -68,6 +70,11 @@ if (isset($_POST['submit'])){
+ +

+ +

+

Character Limits

Link should be 354

From bfd1c6ca7cae683fc4342005a3e604fd133b449d Mon Sep 17 00:00:00 2001 From: SovereigntyIsNotFreedom Date: Tue, 10 Jun 2025 10:34:40 +0200 Subject: [PATCH 2/6] Update www/index.php Place "Submit Link" where it was originally --- www/index.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/www/index.php b/www/index.php index 85dcbc4..9e67613 100644 --- a/www/index.php +++ b/www/index.php @@ -101,6 +101,8 @@ require("header.php"); ?>
+
Submit a new link
+ From 124421ed896de072af0a86dabbe1cf7df7aefab5 Mon Sep 17 00:00:00 2001 From: SovereigntyIsNotFreedom Date: Tue, 10 Jun 2025 10:35:56 +0200 Subject: [PATCH 3/6] Update www/header.php Removing "Submit Link" --- www/header.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/www/header.php b/www/header.php index a6a949c..a168414 100644 --- a/www/header.php +++ b/www/header.php @@ -203,8 +203,6 @@ function DisplayCategories($instancename, $path) { ?> - -
Submit a link

Update Frequency: every 3 hours


From 19fa5fefcd8946120cffa5d488335403ae34aef0 Mon Sep 17 00:00:00 2001 From: SovereigntyIsNotFreedom Date: Tue, 10 Jun 2025 10:38:15 +0200 Subject: [PATCH 4/6] Update www/submit.php --- www/submit.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/www/submit.php b/www/submit.php index 5471283..1f9f196 100644 --- a/www/submit.php +++ b/www/submit.php @@ -20,7 +20,7 @@ if (isset($_POST['submit'])){ $error_message = "All of the fields must not be empty"; }else{ if (strlen($link) > 512 or strlen($name) > 64 or strlen($description) > 256 or strlen($sensitive) > 1 or strlen($category) > 64){ - $error_message = "Don't excede the limit"; + $error_message = "Don't exceed the limit"; }else{ // Open the file once before the loop From 3cb5af0f361ad57615c1fe384d9ca567d1c4462c Mon Sep 17 00:00:00 2001 From: Gasp Date: Tue, 10 Jun 2025 18:22:41 +0100 Subject: [PATCH 5/6] submit message status --- www/submit.php | 55 +++++++++++++++++++++++++------------------------- 1 file changed, 27 insertions(+), 28 deletions(-) diff --git a/www/submit.php b/www/submit.php index 1f9f196..dd2668e 100644 --- a/www/submit.php +++ b/www/submit.php @@ -1,11 +1,11 @@ '],'', $_POST['link']); // Clear user input - $success_message = null; - $error_message = null; $link = htmlspecialchars($link); $name = htmlspecialchars($_POST['name']); $description = htmlspecialchars($_POST['description']); @@ -14,33 +14,36 @@ if (isset($_POST['submit'])){ $captcha = htmlspecialchars($_POST['captcha']); // Captcha Auth check if ($captcha != htmlspecialchars($_SESSION['secure'])){ - $error_message = "Captcha Failed"; - }else{ + $submission_message = "

Captcha Failed

"; + } else { if (empty($link) or empty($name) or empty($description)){ - $error_message = "All of the fields must not be empty"; - }else{ + $submission_message = "

All of the fields must not be empty

"; + } else { if (strlen($link) > 512 or strlen($name) > 64 or strlen($description) > 256 or strlen($sensitive) > 1 or strlen($category) > 64){ - $error_message = "Don't exceed the limit"; - }else{ + $submission_message = "

Don't exceed the limit

"; + } else { - // Open the file once before the loop - $file = fopen("../submissions/submission.csv", "a"); + // Open the file once before the loop + $file = fopen("../submissions/submission.csv", "a"); - if ($file !== false) { - // Create an array with the inputs to write as a single row - $row = [$link, $name,$description,$category,$sensitive]; + if ($file !== false) { + // Create an array with the inputs to write as a single row + $row = [$link, $name,$description,$category,$sensitive]; - // Write the row to the CSV file - fputcsv($file, $row, ',', '"'); + // Write the row to the CSV file + fputcsv($file, $row, ',', '"'); - // Close the file after writing - fclose($file); - } else { - // Handle error opening the file - error_log("Error opening the file."); - } - $success_message = "Link Successfully Submitted"; - } + // Close the file after writing + fclose($file); + } else { + // Handle error opening the file + error_log("Error opening the file."); + } + + if ($submission_message === null) { // Only set success message if no error occurred + $submission_message = "

Link Successfully Submitted

"; + } + } } } } @@ -70,11 +73,7 @@ if (isset($_POST['submit'])){
- -

- -

- +

Character Limits

Link should be 354

From 0cf996661162d925970f80e1548e48376e572e59 Mon Sep 17 00:00:00 2001 From: SovereigntyIsNotFreedom Date: Wed, 11 Jun 2025 08:57:58 +0100 Subject: [PATCH 6/6] submit message status --- www/submit.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/www/submit.php b/www/submit.php index dd2668e..6eb35a5 100644 --- a/www/submit.php +++ b/www/submit.php @@ -1,7 +1,7 @@ '],'', $_POST['link']); @@ -14,13 +14,13 @@ if (isset($_POST['submit'])){ $captcha = htmlspecialchars($_POST['captcha']); // Captcha Auth check if ($captcha != htmlspecialchars($_SESSION['secure'])){ - $submission_message = "

Captcha Failed

"; + $submission_message = "Error: Captcha Failed"; } else { if (empty($link) or empty($name) or empty($description)){ - $submission_message = "

All of the fields must not be empty

"; + $submission_message = "Error: All of the fields must not be empty"; } else { if (strlen($link) > 512 or strlen($name) > 64 or strlen($description) > 256 or strlen($sensitive) > 1 or strlen($category) > 64){ - $submission_message = "

Don't exceed the limit

"; + $submission_message = "Error: Don't exceed the limit"; } else { // Open the file once before the loop @@ -41,7 +41,7 @@ if (isset($_POST['submit'])){ } if ($submission_message === null) { // Only set success message if no error occurred - $submission_message = "

Link Successfully Submitted

"; + $submission_message = "Link Successfully Submitted"; } } } @@ -73,7 +73,7 @@ if (isset($_POST['submit'])){
- +

Character Limits

Link should be 354

@@ -96,7 +96,7 @@ if (isset($_POST['submit'])){
- +