mirror of
http://git.nowherejezfoltodf4jiyl6r56jnzintap5vyjlia7fkirfsnfizflqd.onion/nihilist/darknet-lantern.git
synced 2025-07-01 18:56:40 +00:00
submit message status
This commit is contained in:
parent
19fa5fefcd
commit
3cb5af0f36
1 changed files with 27 additions and 28 deletions
|
@ -1,11 +1,11 @@
|
|||
<?php
|
||||
session_start();
|
||||
$submission_message = null; // Initialize the variable
|
||||
|
||||
if (isset($_POST['submit'])){
|
||||
// Link checks
|
||||
$link = str_replace(['<','>'],'', $_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 = "<h3 class='submission-status-error'>Captcha Failed</h3>";
|
||||
} else {
|
||||
if (empty($link) or empty($name) or empty($description)){
|
||||
$error_message = "All of the fields must not be empty";
|
||||
}else{
|
||||
$submission_message = "<h3 class='submission-status-error'>All of the fields must not be empty</h3>";
|
||||
} 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 = "<h3 class='submission-status-error'>Don't exceed the limit</h3>";
|
||||
} 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 = "<h3 class='submission-status-success'>Link Successfully Submitted</h3>";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -70,11 +73,7 @@ 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 }?>
|
||||
<?php echo $submission_message; ?>
|
||||
<center>
|
||||
<h1>Character Limits</h1>
|
||||
<p>Link should be 354</p>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue