darknet-lantern/www/index.php
2025-04-01 08:37:59 +02:00

105 lines
4.1 KiB
PHP

<!DOCTYPE html>
<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 the 1st of Febuary 2025." />
<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['HTTP_HOST']); ?>" />
<!-- // Default images for previews -->
<meta property="og:image:url" content="<?php echo htmlspecialchars($_SERVER['HTTP_HOST']) . "/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['HTTP_HOST']); ?>" />
<link rel="stylesheet" type="text/css" href="style.css">
<link rel="icon" href="/img/logo-favicon.png">
</head>
<body>
<div class="width-class">
<?php
require("header.php");
$min_length = 1;
$max_length = 32;
$instance= $_SERVER['SERVER_NAME'];
$participantpath="participants/" . $instance . '/';
$verifiedcsvpath="participants/" . $instance . '/verified.csv';
$unverifiedcsvpath="participants/" . $instance . '/unverified.csv';
// check if the verified and unverified csv files have links in them or not:
$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>
<p>Sensitive Search: <input type="checkbox" name="sensitive" value="1"></p></br>
</form>
<?php
$sensitive = $_GET['sensitive'];
if ($sensitive == 1){
//echo "<p>Sensitive ON " . $sensitive . "</p>";
$sensitive=1;
}else{
$sensitive=0;
//echo "<p>Sensitive OFF " . $sensitive . "</p>";
}
$query = $_GET['query'];
// gets value sent over search form
if(strlen($query) >= $min_length and strlen($query) <= $max_length){ // if query length is more or equal minimum length then
$query = htmlspecialchars($query);
// removes the risky characters
// there needs to be regex checking, only allow [a-zA-Z0-9.:/]
$query=preg_replace("/[^a-zA-Z0-9:\/.\ -]/", "", $query);
echo "<p>Search results for " . $query . " :</p>";
echo nl2br("\n");
echo nl2br("\n");
//echo $verifiedcsvpath;
//echo nl2br("\n");
//echo $unverifiedcsvpath;
if ($lines_v >= 2){
echo '<div class="verified"><h3>Verified Links</h3></br></div>';
echo nl2br("\n");
DisplayCSVNEW($verifiedcsvpath,$query,$sensitive);
}else{
echo '<p>Your verified.csv file is empty, <a href="http://blog.nowherejezfoltodf4jiyl6r56jnzintap5vyjlia7fkirfsnfizflqd.onion/opsec/darknetlantern/index.html">check this tutorial</a> to know how to add links into it.</p>';
}
if ($lines_uv >= 2){
echo '</br></br></br><center><div class="unverified"><h3>Unverified Links</h3></br></div></center>';
echo nl2br("\n");
DisplayCSVNEW($unverifiedcsvpath,$query,$sensitive);
}else{
echo '<p>Your unverified.csv file is empty, please check the <a href="http://blog.nowherejezfoltodf4jiyl6r56jnzintap5vyjlia7fkirfsnfizflqd.onion/opsec/darknetlantern/index.html">check this tutorial</a> to know how to add links into it.</p>';
}
// display the results of verified.csv
// only display the results of verified.csv that matches with the search term
// display the results of unverified.csv
// only display the results of unverified.csv that matches with the search term
}
else { // if query length is less than minimum or more than maximum
echo '</br></br><img src="img/logo-large.png"><p>Search query must be between ' . $min_length . " and " . $max_length . " characters.</p>";
}
?>
</div>
<?php
require("footer.php");
?>