issue 83: submission status is centered in the middle on submission

This commit is contained in:
SovereigntyIsNotFreedom 2025-06-09 07:30:42 +01:00
parent 0240c82df0
commit 7c144fec1d
4 changed files with 23 additions and 9 deletions

View file

@ -3,7 +3,9 @@ session_start();
if (isset($_POST['submit'])){
// Link checks
$link = str_replace(['<','>'],'', $_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'])){
<html>
<?php include("header.php");?>
<div class="width-class">
<?php if ($success_message != null){?>
<h3 class="submission-status-success"> <?php echo $success_message ?></h3>
<?php }else {?>
<h3 class="submission-status-error"><?php echo $error_message ?></h3>
<?php }?>
<center>
<h1>Character Limits</h1>
<p>Link should be 354</p>