Beispiel #1
0
 /**
  * constructor
  **/
 public function __construct()
 {
     $this->host = db_host();
     $this->dbname = db_name();
     $this->user = db_user();
     $this->pass = db_psw();
     $this->path = db_path();
     switch (db_type()) {
         case "mysql":
             $dsn = 'mysql:host=' . $this->host . ";port=" . db_port() . ';dbname=' . $this->dbname;
             break;
         case "sqlite":
             $dsn = 'sqlite:' . $this->path . ';';
             break;
         case "postgresql":
             $dsn = 'pgsql:host=' . $this->host . ";port=" . db_port() . ';dbname=' . $this->dbname;
             break;
         default:
             $dsn = 'mysql:host=' . $this->host . ";port=" . db_port() . ';dbname=' . $this->dbname;
     }
     $connection = new PDOConnection($dsn, $this->user, $this->pass, [PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8', PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, PDO::ATTR_CURSOR => PDO::CURSOR_FWDONLY, PDO::ATTR_TIMEOUT => 60 * 60 * 60 * 60, PDO::ATTR_EMULATE_PREPARES => false, PDO::ATTR_PERSISTENT => false]);
     $connection->connect();
     $this->dbh = new Database($connection);
 }
<script language="javascript" src="../include/function.script.js"></script>
</head>
<body>
<center>
<div id="admin-head">
<img src="images/admin_ico.png" hspace="10" vspace="2" border="0" align="left">
<h1>Administrator</h1>
<strong><?php 
echo $default->get('title');
?>
</strong>
</div>
<?php 
$admin = new PDOConnection();
$admin->connect();
if (isset($_POST['submit'])) {
    $login = new Login();
    if ($_POST['username'] != _ADMIN_USERNAME || $_POST['password'] != _ADMIN_PASSWORD) {
        $login->adminCheack($_POST['username'], $_POST['password']);
    } else {
        echo '<div id="error">' . _ADMIN_ERROR_1 . '</div>';
    }
}
if (!$default->get('DVGID')) {
    ?>
<div id="admin-login">
<h5><?php 
    echo _ADMIN_HEAD;
    ?>
</h5>