submit message status

This commit is contained in:
SovereigntyIsNotFreedom 2025-06-11 08:57:58 +01:00
parent 3cb5af0f36
commit 0cf9966611

View file

@ -1,7 +1,7 @@
<?php
session_start();
$submission_message = null; // Initialize the variable
$status_class = null;
if (isset($_POST['submit'])){
// Link checks
$link = str_replace(['<','>'],'', $_POST['link']);
@ -14,13 +14,13 @@ if (isset($_POST['submit'])){
$captcha = htmlspecialchars($_POST['captcha']);
// Captcha Auth check
if ($captcha != htmlspecialchars($_SESSION['secure'])){
$submission_message = "<h3 class='submission-status-error'>Captcha Failed</h3>";
$submission_message = "Error: Captcha Failed";
} else {
if (empty($link) or empty($name) or empty($description)){
$submission_message = "<h3 class='submission-status-error'>All of the fields must not be empty</h3>";
$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 = "<h3 class='submission-status-error'>Don't exceed the limit</h3>";
$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 = "<h3 class='submission-status-success'>Link Successfully Submitted</h3>";
$submission_message = "Link Successfully Submitted";
}
}
}
@ -73,7 +73,7 @@ if (isset($_POST['submit'])){
<html>
<?php include("header.php");?>
<div class="width-class">
<?php echo $submission_message; ?>
<h3 class="<?php echo str_contains($submission_message, 'Error') ? 'submission-status-error' : 'submission-status-success' ?>"> <?php echo $submission_message ?> </h3>
<center>
<h1>Character Limits</h1>
<p>Link should be 354</p>
@ -96,7 +96,7 @@ if (isset($_POST['submit'])){
<label style="color:white">Captcha</label>
<div>
<img src="generate.php">
<input type="text" name="captcha">
<input required type="text" name="captcha">
<input type="submit" value="submit" name="submit" />
</div>
</form>