<?php /** Administration Bootstrap */ 
//session_start();
chdir('../');
        
include('includes/include_all.inc.php');

try {
    $pdo = new PDO("mysql:host=" . DB_HOST . ";dbname=" . DB_NAME, DB_USER, DB_PASS);
    $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
} catch(PDOException $e) {
    die("Connection failed: " . $e->getMessage());
}

//Create User object
$obj_users = new Users($pdo);

if(!$obj_users->checkUserLoginOrNot()){
    header('Location: '.BASEURL.'login.php');
    exit();
}

if($_SESSION['admin']=='0'){
    session_destroy();
    header('Location: '.BASEURL.'login.php');
    exit();
}
?>