All pastes #727787 Raw Edit

Unnamed

public text v1 · immutable
·published 2007-10-06 11:50 UTC
rendered paste body
<?php

function main () {
    $Default = "hovedside";
    $Folder = "inc/"; // Husk å ha / som siste tegn.

    if ( isset($_GET['side']) ) {
        $Page = ($Page = substr( strtolower( preg_replace('([^a-zA-Z])', '', $_GET['page']) ), 0, 20) ) ? $Page : $Default;
    } else {
        $Page = $Default;
    }

    $Page = $Folder . $Page . ".php";
	
    if ( file_exists($Page) && is_readable($Page) ) {
        include($Page);
    } else {
        header ("HTTP 1.0 404 Not Found");
        $Output = "<h1>404 Not found</h4>\n<p>Finner ikke siden.</p>\n";
    }
    echo $Output;
}

?>