<?php 

$dir = '../../';

require_once $dir.'includes/main.php';

$errors = array();

$admin_password = clean($_POST['admin_password']);

//check errors
if(!fetch_rows("SELECT admin_password FROM _settings WHERE admin_password = '{$admin_password}' LIMIT 1")){

    $_SESSION['messages'][] = "Password is incorrect";
    $_SESSION['messages'][] = "Please try again";
    header("location: ../login");
    exit;

}else{

    // on success
    setcookie('admin_password', $admin_password, $t + (60*60*24*30*12), '/');
    $_SESSION['messages'][] = "Welcome to the Admin Panel";
    header("Location: ../");
    exit;

}

?>