Merge pull request 'issue 83: submission status is centered in the middle on submission' (#84) from SovereigntyIsNotFreedom/darknet-lantern:main into main

Reviewed-on: http://git.nowherejezfoltodf4jiyl6r56jnzintap5vyjlia7fkirfsnfizflqd.onion/nihilist/darknet-lantern/pulls/84
Reviewed-by: Doctor Dev <doctor_dev@noreply.localhost>, @Nihilist
This commit is contained in:
Doctor Dev 2025-06-11 10:33:26 +02:00
commit e60f7f7e78
4 changed files with 40 additions and 27 deletions

View file

@ -203,8 +203,6 @@ function DisplayCategories($instancename, $path) {
?>
</br>
<h1><a href="http://git.nowherejezfoltodf4jiyl6r56jnzintap5vyjlia7fkirfsnfizflqd.onion/nihilist/darknet-lantern"><img src="img/lantern project large.png" class="projectbanner"></a></h1>
<p><u>Update Frequency:</u> every 3 hours</p> </br>

View file

@ -23,6 +23,7 @@
<div class="width-class">
<?php
require("header.php");
$min_length = 1;
$max_length = 32;
@ -35,8 +36,8 @@ require("header.php");
$lines_uv = count(file($unverifiedcsvpath));
$lines_v = count(file($verifiedcsvpath));
//echo "<p>CSV LINES: " . $lines_uv . " " . $lines_v . "</p>";
?>
<form action="index.php" method="GET">
<input type="text" name="query" />
<input type="submit" value="Search" /> </br>
@ -99,6 +100,7 @@ require("header.php");
?>
</div>
<center><a href="submit.php">Submit a new link</a></center>
<?php

View file

@ -325,3 +325,10 @@ img{
}*/
.submission-status-success{
color: green;
}
.submission-status-error{
color: red;
}

View file

@ -1,5 +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']);
@ -12,13 +14,13 @@ if (isset($_POST['submit'])){
$captcha = htmlspecialchars($_POST['captcha']);
// Captcha Auth check
if ($captcha != htmlspecialchars($_SESSION['secure'])){
echo "Captcha Failed";
$submission_message = "Error: Captcha Failed";
} else {
if (empty($link) or empty($name) or empty($description)){
echo "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){
echo "Don't excede the limit";
$submission_message = "Error: Don't exceed the limit";
} else {
// Open the file once before the loop
@ -37,7 +39,10 @@ if (isset($_POST['submit'])){
// Handle error opening the file
error_log("Error opening the file.");
}
echo "Link Successfully Submitted";
if ($submission_message === null) { // Only set success message if no error occurred
$submission_message = "Link Successfully Submitted";
}
}
}
}
@ -68,6 +73,7 @@ if (isset($_POST['submit'])){
<html>
<?php include("header.php");?>
<div class="width-class">
<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>
@ -90,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>