Author: Not specified Language: php
Description: Not specified Timestamp: 2017-01-29 10:29:20 +0000
View raw paste Reply
<?php
abstract class Page
{
    protected $_database = null;

    protected function __construct()
    {
        $this->_database = new mysqli("localhost", "root", "","Screen");
        if (mysqli_connect_errno())
            throw new Exception (mysqli_connect_error());
        if (!$this->_database->set_charset("utf8"))
            throw new Exception("Fehler beim Laden des Zeichensatzes UTF-8: ".$this->_database->error);
    }

    protected function __destruct()
    {
        $this->_database->close();
    }

    protected function generatePageHeader($headline = "")
    {
        $headline = htmlspecialchars($headline);
        header("Content-type: text/html; charset=UTF-8");
        echo <<<HTML
        <!DOCTYPE HTML>
        <html>
        <head>
            <title>$headline</title>
            <link rel="stylesheet" type="text/css" href="screen.css"/>
            <script type="text/javascript"
           src="screen.js"> </script>

HTML
;
        echo <<<HTML
            <meta charset="UTF-8">
        </head>
        <body>
        <header>
            <h1 class ="heading">$headline</h1>
        </header>
HTML
;
    }

    protected function generatePageFooter()
    {
        echo '</body> </html>';
    }

    protected function processReceivedData()
    {
        if (get_magic_quotes_gpc()) {
            throw new Exception
            ("Bitte schalten Sie magic_quotes_gpc in php.ini aus!");
        }
    }
} ?>
View raw paste Reply