mirror of
http://git.nowherejezfoltodf4jiyl6r56jnzintap5vyjlia7fkirfsnfizflqd.onion/nihilist/darknet-lantern.git
synced 2025-05-16 20:26:58 +00:00
Added captcha: Created new page with captcha auth and fields saving mechanism.
This commit is contained in:
parent
243e3d24bb
commit
412a36e66d
10 changed files with 592 additions and 8 deletions
6
www/README.md
Normal file
6
www/README.md
Normal file
|
@ -0,0 +1,6 @@
|
|||
To make the captcha image work you will need to install php-gd.
|
||||
Since there might be version in the name first try searching your package manager
|
||||
|
||||
Next you need to go to /etc/php/[your_version]/cli/php.ini and remove the semi-colon(;) from the line with extension=gd.
|
||||
|
||||
Done.
|
BIN
www/font.ttf
Normal file
BIN
www/font.ttf
Normal file
Binary file not shown.
28
www/generate.php
Normal file
28
www/generate.php
Normal file
|
@ -0,0 +1,28 @@
|
|||
<?php
|
||||
|
||||
session_start();
|
||||
$_SESSION['secure'] = rand(1000,999999);
|
||||
header('Content-type: image/jpeg');
|
||||
$text = $_SESSION['secure'];
|
||||
|
||||
$font_size = 30;
|
||||
$image_width = 125;
|
||||
$image_height = 40;
|
||||
|
||||
$image = imagecreate($image_width,$image_height);
|
||||
imagecolorallocate($image, 255,255,255);
|
||||
$text_color = imagecolorallocate($image, 0,0,0);
|
||||
|
||||
for ($x=1;$x<=45;$x++){
|
||||
$x1 = rand(1,100);
|
||||
$y1 = rand(1,100);
|
||||
$x2 = rand(1,100);
|
||||
$y2 = rand(1,100);
|
||||
// Diplays the lines on the image. Now 45 lines.
|
||||
imageline($image, $x1, $y1, $x2, $y2, $text_color);
|
||||
}
|
||||
// Adds font
|
||||
imagettftext($image, $font_size, 0, 15, 30, $text_color, './font.ttf', $text);
|
||||
// Returns an image
|
||||
imagejpeg($image);
|
||||
?>
|
|
@ -79,11 +79,6 @@ if (!preg_match("~^(?:f|ht)tps?://~i", $data[3])) {
|
|||
echo $urllink . '"> '; // display the link
|
||||
echo $data[2] . ' </a></p></td><td class="description">'; // display the link title and close the a href and first cell, open the second cell
|
||||
echo $data[5] . " </td><td>"; // OPTIONAL: display the description column
|
||||
if ($data[7] == 0.0){
|
||||
continue;
|
||||
}else{
|
||||
echo $data[7] . " </td><td>"; // display the score and close the second cell, open the third cell
|
||||
}
|
||||
echo $data[7] . " </td><td>"; // display the score and close the second cell, open the third cell
|
||||
|
||||
if($data[6] == "YES"){
|
||||
|
|
|
@ -1,3 +1,18 @@
|
|||
|
||||
<?php
|
||||
|
||||
// Open a known directory, and proceed to read its contents
|
||||
if (is_dir($dir)) {
|
||||
if ($dh = opendir($dir)) {
|
||||
while (($file = readdir($dh)) !== false) {
|
||||
echo "filename: $file : filetype: " . filetype($dir . $file) . "\n";
|
||||
}
|
||||
closedir($dh);
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
|
@ -19,6 +34,7 @@
|
|||
<link rel="icon" href="/img/logo-favicon.png">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="width-class">
|
||||
<?php
|
||||
|
||||
|
@ -36,7 +52,6 @@ require("header.php");
|
|||
//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 +114,8 @@ require("header.php");
|
|||
|
||||
?>
|
||||
</div>
|
||||
<a href="submit.php">Submit a link</a>
|
||||
|
||||
<?php
|
||||
require("footer.php");
|
||||
?>
|
||||
|
|
|
@ -12,8 +12,12 @@
|
|||
.width-class{
|
||||
width: 100%;
|
||||
object-fit: contain;
|
||||
align: center;
|
||||
|
||||
align: center;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
.input-class{
|
||||
margin: 0 20% 0 20%;
|
||||
}
|
||||
|
||||
.projectbanner{
|
||||
|
|
0
www/submission.csv
Normal file
0
www/submission.csv
Normal file
|
84
www/submit.php
Normal file
84
www/submit.php
Normal file
|
@ -0,0 +1,84 @@
|
|||
<?php
|
||||
session_start();
|
||||
|
||||
if (isset($_POST['submit'])){
|
||||
// Clear user input
|
||||
$link = htmlspecialchars($_POST['link']);
|
||||
$name = htmlspecialchars($_POST['name']);
|
||||
$description = htmlspecialchars($_POST['description']);
|
||||
$captcha = htmlspecialchars($_POST['captcha']);
|
||||
// Captcha Auth check
|
||||
if ($captcha != htmlspecialchars($_SESSION['secure'])){
|
||||
echo "Captcha Failed";
|
||||
}else{
|
||||
if (empty($link) or empty($name) or empty($description)){
|
||||
echo "All of the fields must not be empty";
|
||||
}else{
|
||||
// Clearing unusual characters in all the fields
|
||||
$clear_link = str_replace(['@','*','(',') ',';','#'],'',$link);
|
||||
$clear_name = str_replace(['@','.',',','(',')','#',';'],'',$name);
|
||||
$clear_description = str_replace(['@',';'], '', $description);
|
||||
|
||||
|
||||
// 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 = [$clear_link, $clear_name,$clear_description];
|
||||
|
||||
// Write the row to the CSV file
|
||||
fputcsv($file, $row, ',', '"');
|
||||
|
||||
// Close the file after writing
|
||||
fclose($file);
|
||||
} else {
|
||||
// Handle error opening the file
|
||||
errorlog("Error opening the file.");
|
||||
}
|
||||
header("Location: index.php");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
|
||||
<!DOCTYPE html>
|
||||
<head>
|
||||
<title>Darknet Lantern</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<meta name="twitter:card" content="summary" />
|
||||
<meta name="description" content="Darknet Lantern is a minimalistic Peer to Peer Decentralised Search Engine for the Darknet, that got officially released on>
|
||||
<meta property="og:site_name" content="Darknet Lantern" />
|
||||
<meta property="og:title" content="Darknet Lantern" />
|
||||
<meta property="og:type" content="website" />
|
||||
<!-- // Now displays the url of the instance -->
|
||||
<meta property="og:url" content="<?php echo htmlspecialchars($_SERVER['SERVER_NAME']); ?>" />
|
||||
<!-- // Default images for previews -->
|
||||
<meta property="og:image:url" content="<?php echo htmlspecialchars($_SERVER['SERVER_NAME']) . "/img/logo-large.png"; ?>" />
|
||||
<meta property="og:locale" content="en_US" />
|
||||
<!-- // This tells search engines which URL should be considered the original source when multiple URLs contain the same content. -->
|
||||
<link rel="canonical" href="<?php echo htmlspecialchars($_SERVER['SERVER_NAME']); ?>" />
|
||||
<link rel="stylesheet" type="text/css" href="style.css">
|
||||
<link rel="icon" href="/img/logo-favicon.png">
|
||||
</head>
|
||||
<html>
|
||||
<?php include("header.php");?>
|
||||
<div class="width-class">
|
||||
<form action="submit.php" method="POST">
|
||||
<label style="color:white">Link</label>
|
||||
<input required class="input-class" type="text" name="link" placeholder="http://link.com/onion">
|
||||
<label style="color:white">Name</label>
|
||||
<input required class="input-class" type="text" name="name">
|
||||
<label style="color:white">Description</label>
|
||||
<input required class="input-class" type="text" name="description">
|
||||
<label style="color:white">Captcha</label>
|
||||
<div>
|
||||
<img src="generate.php">
|
||||
<input type="text" name="captcha">
|
||||
<input type="submit" value="submit" name="submit" />
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</html>
|
Loading…
Add table
Add a link
Reference in a new issue