<?
################################################
#                                              #
#  DAE - Dynamic Apache Errors                 #
#  Version 1.1 - 2005-03-30 Florian Beer       #
#                                              #
#  Dieses Script steht unter der MDWDW Lizenz. #
#  Die 'Mach doch was du willst' Lizenz.       #
#  Viel Spass damit!                           #
#                                              #
################################################


class Error {

    var 
$error;
    var 
$msg;
    var 
$error_notes;
    var 
$img;
    var 
$host;
    var 
$admin;
    var 
$unique_id;

    function 
Error(){


        
# Error Messages

        
$this->msg[401][sts] = "Unauthorized"
        
$this->msg[401][txt] = "Ä Ä Ähäääää - Du hast das Zauberwort nicht gesagt!";
        
        
$this->msg[402][sts] = "Payment Required";
        
$this->msg[402][txt] = "He, Alder, kostet krass 10 Euro!";
        
        
$this->msg[403][sts] = "Forbidden";
        
$this->msg[403][txt] = "You shall not pass!";
        
        
$this->msg[404][sts] = "Not Found"
        
$this->msg[404][txt] = "Wüüüaaarg!";
        
        
$this->msg[405][sts] = "Method Not Allowed";
        
$this->msg[405][txt] = "Nö, so nicht!";
        
        
$this->msg[406][sts] = "Not Acceptable";
        
$this->msg[406][txt] = "Willst Watsche mit Fuss?";
        
        
$this->msg[407][sts] = "Proxy Authentication Required";
        
$this->msg[407][txt] = "Nönö, musst du erst Kollega fragen!";
        
        
$this->msg[409][sts] = "Conflict";
        
$this->msg[409][txt] = "Willst du Schläge oder was?!";
        
        
$this->msg[410][sts] = "Gone";
        
$this->msg[410][txt] = "Kein Anschluss unter dieser Nummer";
        
        
$this->msg[411][sts] = "Length Required";
        
$this->msg[411][txt] = "Zeig her das Teil!";
        
        
$this->msg[414][sts] = "Request URI too large";
        
$this->msg[414][txt] = "Zu lang, das Teil!";
        
        
$this->msg[415][sts] = "Unsupported Media Type";
        
$this->msg[415][txt] = "Was der Bauer nicht kennt, frisst er nicht!";

        
$this->msg[417][sts] = "Possible hacking attempt";
        
$this->msg[417][txt] = "You shall not pass!";

        
$this->msg[src][sts] = "Direct Access";
        
$this->msg[src][txt] = "Wanna get the <a href=\"error.phps\">source</a>?";

        
$this->msg[na][sts] = "Not Available";
        
$this->msg[na][txt] = "Error Code is not supported by this Script or Apache.<br>Wanna get the <a href=\"error.phps\">source</a>?";

        
$this->msg[thx][sts] = "";
        
$this->msg[thx][txt] = "Thanky You!";

        
# Which Error Code?
        
if($_SERVER['REDIRECT_STATUS'])
            
$this->error $_SERVER['REDIRECT_STATUS'];
        else
            
$this->error $_GET['e'];

        
# Maybe we even have a Server Message?
        
$this->error_notes $_SERVER['REDIRECT_ERROR_NOTES'];

        
# Get Unique ID
        
$this->unique_id $_SERVER['UNIQUE_ID'];

        
# Custom Error Notes
        
if($this->error == 417$this->error_notes 'If you think this is a false positive, please contact the admin and provide following ID: <span class="unique_id">'.$this->unique_id.'</span>';
        if(
$this->error == 404$this->error_notes.= '<br>Try going <a href="javascript:history.back()">back</a> to where you came from.';        
        if(
$this->error == thx$this->error_notes '... for helping improving the system.';

        
# Check for Picture
        
if(file_exists('errors/'.$this->error.('.png'))) {
                        
$this->img '<img src="errors/'.$this->error.'.png" align="left">';
                }


        
# Direct Access?
        
if(!isset($this->error))     $this->error src;

        
# Invalid Error Code?
        
if(!$this->msg[$this->error])     $this->error na;


        
# Get Domain Name
        
$this->host = (isset($_SERVER['REDIRECT_HTTP_HOST']) ? $_SERVER['REDIRECT_HTTP_HOST'] : $_SERVER['HTTP_HOST']);

        
# Set Contact eMail    
        
if(ereg("board-of-metal.org",$this->host)) $this->admin "admin@board-of-metal.org";
        if(
ereg("no-panic.at",$this->host)) $this->admin "admin@no-panic.at";

    }


    function 
getHtml(){        
        
$html = <<<HTML
        <html>
        <head>
        <title>$this
->host - error [$this->error]</title>
        <style>
        body {
            margin: 0px;
        }

        form {
            display:inline;
        }

        #box {
            border: 2px solid #b0b0b0;
            background-color: #cccccc;
            padding: 20px;
            z-index: 10;
            width: 500px;
            height: 250;
            align: center;
            position: absolute;
            margin: 70 20 20 20;
            text-align: left;
        }
        
        #error {
            position: absolute;
            z-index: 1;
            font-size: 60px;
            font-family: Verdana, Arial, Sans-Serif;
            font-weight: bold;
            top: 12px;
            left: 370px;
            color: #909090;
        }
        
        #host {
            position: absolute;
            z-index: 2;
            font-size: 23px;
            font-family: Verdana, Arial, Sans-Serif;
            font-wight: bold;
            top: 52px;
            left: 19px;
            color: #B0B0B0;
        }

        .notes {
            font-size: 10px;
            align: right;
            font-family: Verdana, Arial, Sans-Serif;
            font-style: normal;
        }

        .sts {
            font-weight: bold;
            color: #4B4B4B;
            font-size: 20px;
            position: relative;
            top: -13px;
            text-transform: uppercase;
        }
        
        .txt {
            position: relative;
            top: 20%;
            font-family: Garamond, Verdana, Arial, Sans-Serif;
            font-style: italic;
            margin-left: 4px;
            font-size: 24px;
        }
        
        .unique_id {
            border: 1px dotted #cccccc;
            padding: 0 2 0 2;
            background-color: white;
            margin: 0 2 0 2;
        }
        </style>
        </head>
        <body>
        <div id="host">
{$this->host}</div>
        <div id="error">[$this
->error]</div>
        <div id="box">
        <div class="sts">
{$this->msg[$this->error][sts]}</div>
        <div class="txt">
{$this->img} {$this->msg[$this->error][txt]}<br>
        <span class="notes">$this
->error_notes</span><br>
        <span class="notes">In case of questions, contact: <a href="mailto:
{$this->admin}?subject=Incident ID: {$this->unique_id}">{$this->admin}</a></span>
        </div>
        </div>
        </body>
        </html>
HTML;
        return 
$html;
    }
}

$page = new Error();
echo 
$page->getHtml();

?>