File "admin-login.inc.php"
Full Path: /srv/www/www.cadoro.it/src/controllers/admin-login.inc.php
File size: 818 bytes
MIME-type: text/x-php
Charset: utf-8
<?php
$error = null;
if ($principal) {
if (in_array($principal['role'], array(3))) {
header("Location: " . BASE_URL . "/admin/blog-articles");
} else {
header("Location: " . BASE_URL . "/admin/users");
}
exit;
}
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$email = _post('email');
$password = _post('password');
$user = models\UserBE::get_by_email($email);
if ($user && $user['password'] == md5($password)) {
$user->remember();
if (in_array($user['role'], array(3))) {
header("Location: " . BASE_URL . "/admin/blog-articles");
} else {
header("Location: " . BASE_URL . "/admin/users");
}
exit;
} else {
$error = true;
}
}
$smarty->assign("error", $error);
$smarty->display("admin-login.tmpl");
?>