Compare commits

...

2 commits

View file

@ -11,11 +11,12 @@ $parser = wiki::factory(true);
$page = $_GET['page'];
$page = preg_replace(',/$,', '', $page);
$page = preg_replace(',/,', '-', $page);
$valid_page = (preg_match("/[^abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_-]/", $page) || file_exists("pages/{$page}.md"));
$valid_page = (!preg_match("/[^abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_-]/", $page) && file_exists("pages/{$page}.md"));
if ($page !== "" && !$valid_page) {
http_response_code(404);
echo "This wiki page doesn't exist, you'll be redirected to the homepage.";
echo '<META HTTP-EQUIV="refresh" content="0;URL=' . $page_start . '/">';
echo "This wiki page doesn't exist, you'll be redirected to the homepage.\n";
echo '<META HTTP-EQUIV="refresh" content="0;URL=' . $page_start . '/">'."\n";
exit;
}
if ($page == "") {
$title = "wiki.tilde.green";