Skip to content
Permalink
ea00b0e2cb
Go to file
 
 
Cannot retrieve contributors at this time
25 lines (19 sloc) 637 Bytes
<?php
defined('APP_DIR') or define('APP_DIR', __DIR__ . '/../app/');
include_once(APP_DIR . 'controller/UserController.php');
include_once(APP_DIR . 'include/http.php');
$attempts = User::get(Http::post_params()['username'])->login_attempts;
if ($attempts >= 8) {
Http::redirect('index.php', ['error' => '2']);
}
$user = UserController::authenticate(Http::post_params());
if (!$user) {
Http::redirect('index.php', ['error' => '1']);
}
setcookie(Config::cookie_name, $user->token());
if ($user->access == 'user') {
Http::redirect('user.php');
} else if ($user->access == 'admin') {
Http::redirect('admin.php');
}
?>
You can’t perform that action at this time.