Example #1
0
 function __construct()
 {
     $this->settings = parent::getSetting();
     $host = $this->settings['dbhost'];
     $user = $this->settings['dbusername'];
     $pass = $this->settings['dbpassword'];
     $db = $this->settings['dbname'];
     $this->mysqli = new MySQLi($host, $user, $pass, $db);
     if ($this->mysqli->connect_errno) {
         die('Unable to connect to database [' . $this->mysqli->connect_error . ']');
     }
     $this->mysqli->set_charset('utf8');
 }
Example #2
0
<?php

require_once 'header.php';
if (isset($_POST['login'])) {
    $ss = new SystemComponent();
    $info = $ss->getSetting();
    if ($info['adminpass'] == hash('SHA256', trim($_POST['pass']))) {
        $_SESSION['admin_loged'] = true;
        header('Location: index.php');
        die;
    } else {
        header('Location: login.php?error=1');
        die;
    }
} else {
    ?>
<form action="" method="post"> 
	<Div class="col-md-6 col-md-push-3">  
		<?php 
    if (isset($_GET['out'])) {
        ?>
			<div class="row"><div class="alert alert-success">Logout was successful</div></div>
		<?php 
    } else {
        if (isset($_GET['error'])) {
            ?>
<br><br>
			<div class="row"><div class="alert alert-danger">Login failed</div></div>
		<?php 
        }
    }