diff --git a/index.php b/index.php index b895bbc..b4927ff 100644 --- a/index.php +++ b/index.php @@ -2,13 +2,20 @@ require "secrets.php"; if (!isset($_SERVER['HTTP_USER_AGENT'])) { - die("Who are you?"); + http_response_code(412); + die("Who are you? (no user agent)"); } -if ($_SERVER['HTTP_USER_AGENT'] === "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/30.0.1599.101 Safari/537.36" || $_SERVER['HTTP_USER_AGENT'] === "Java/1.7.0_17") { +$banned = [ // Ser ut til å overvåke oppetid på HS-er, kanskje for korrelering med // relays. - header('Location: http://fuckthefuckoffok.onion', true, 301); + "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/30.0.1599.101 Safari/537.36" => "just_stop", + // Jævla idiot indekserer dataurler. + "Python-urllib/1.17" => "Do_not_follow_dataurls_and_use_descriptive_UA.", +]; + +if (isset($banned[$_SERVER['HTTP_USER_AGENT']])) { + header('Location: http://fuckthefuckoffok.onion/' . $banned[$_SERVER['HTTP_USER_AGENT']], true, 301); exit; } @@ -25,7 +32,7 @@ define('PER_PAGE', 10); define('FROM_POST', 5); -define('MAX_FILE_SIZE', 4*1024*1024); +define('MAX_FILE_SIZE', 32*1024*1024); function error($msg="Du gjorde noe galt.", $code=500) { http_response_code($code); @@ -412,7 +419,7 @@ function cleanmime($v) { } ?> -<?= $title ?><?= $title ?>"; } + echo "

"; echo process_post($postid, $post, ($isidx?[]:$posts), $board, $isidx, $firstpost); - echo ""; + echo "

"; } function process_post($postid, $post, $posts, $board, $isidx, $firstpost) { $post = str_replace("\r", "", $post);