added static-only mode

This commit is contained in:
root 2025-01-27 20:51:45 +01:00
parent eb3a62c932
commit 54475c9e7c
2 changed files with 96 additions and 6 deletions

View file

@ -3,11 +3,19 @@ server {
listen [::]:4443;
server_name uptime.nowherejezfoltodf4jiyl6r56jnzintap5vyjlia7fkirfsnfizflqd.onion;
root /srv/darknet-onion-webring/www/;
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php8.2-fpm.sock;
}
index index.php;
root /srv/darknet-onion-webring/www/;
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php8.2-fpm.sock;
}
index index.php;
# optional read-only static php file without the searchbar, to display all links by default :
#
#location /index.php {
# return 404;
#}
# index static.php;
}

82
www/static.php Normal file
View file

@ -0,0 +1,82 @@
<!DOCTYPE html>
<html>
<body>
<head>
<title>Darknet Lantern</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" type="text/css" href="style.css">
<link rel="icon" href="/img/logo-favicon.png">
</head>
<center >
<?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>";
?>
<?php
$sensitive = '1';
$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, check the documentation to know how to add links into it.</p>";
}
if ($lines_uv >= 2){
echo '</br></br></br><div class="unverified"><h3>Unverified Links</h3></br></div>';
echo nl2br("\n");
DisplayCSVNEW($unverifiedcsvpath,$query,$sensitive);
}else{
echo "<p>Your unverified.csv file is empty, please check the documentation 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>";
// TODO list the available categories
}
?>
<?php
require("webring.php");
?>