1
0
Fork 0
forked from fun/fun

Moved the website code to ./web/ to make it easier to maintain for me. No code changes. (0.40.5)

This commit is contained in:
Johannes Findeisen 2026-04-10 22:36:29 +02:00
commit 71576be449
71 changed files with 3354 additions and 1 deletions

View file

@ -0,0 +1,27 @@
---
permalink: /cgi/challenge/
---
<?php
session_start();
session_set_cookie_params(3600);
date_default_timezone_set("{{ site.timezone }}");
if(isset($_SESSION["one"])) {
unset($_SESSION["one"]);
}
if(isset($_SESSION["two"])) {
unset($_SESSION["two"]);
}
$_SESSION["one"] = rand(0, 9);
$_SESSION["two"] = rand(0, 9);
#$_SESSION["sum"] = $_SESSION["one"] + $_SESSION["two"];
$challenge = $_SESSION["one"] . " + " . $_SESSION["two"];
header('Content-Type: text/plain; charset=utf-8');
echo($challenge);
?>

47
web/cgi/mail/mail.php Normal file
View file

@ -0,0 +1,47 @@
---
permalink: /cgi/mail/
---
<?php
session_start();
session_set_cookie_params(3600);
date_default_timezone_set("{{ site.timezone }}");
$error = "";
$sum = $_SESSION["one"] + $_SESSION["two"];
if ($_POST["sum"] != $sum) { $error = "{{ site.challenge_error }}"; }
if ($_POST["sum"] == $sum) {
$mailTo = "{{ site.email }}";
$mailAddress = "noreply@{{ site.url_short }}";
if($_POST["email"]) {
$mailAddress = $_POST["email"];
}
$mailHeaders = "From: " . $_POST["name"] . " <" . $mailAddress . ">" . "\r\n" .
"Date: " . date(DATE_RFC822);
$mailSubject = "[{{ site.url_short }}]: No subject!";
if($_POST["subject"]) {
$mailSubject = "[{{ site.url_short }}]: " . $_POST["subject"];
}
$mailBody = $_POST["message"] . "\n\n" . "Website: " . $_POST["website"] . "\nUser Agent: " . $_SERVER['HTTP_USER_AGENT'];
if (!@mail($mailTo, $mailSubject, $mailBody, $mailHeaders)) { $error = "Failed to send mail!"; }
unset($_SESSION["one"]);
unset($_SESSION["two"]);
}
header('Content-Type: text/plain; charset=utf-8');
if ($error=="") {
echo("{{ site.mail_thank_you }}");
} else {
//echo($error . " (". $_POST["sum"] . "/" . $sum . ")");
echo($error);
}
?>