perfected automated logins
All checks were successful
Build and push / Pulling repo on server (push) Successful in 3s
All checks were successful
Build and push / Pulling repo on server (push) Successful in 3s
This commit is contained in:
@ -11,34 +11,6 @@ class Err extends Page {
|
||||
|
||||
function notallowed()
|
||||
{
|
||||
//check if user has a cookie and if so, logg them in and refresh the page
|
||||
if(isset($_COOKIE['token']))
|
||||
{
|
||||
$u = new User();
|
||||
$allusers = $u->getAll(false);
|
||||
foreach($allusers as $user)
|
||||
{
|
||||
if($user['token'] && $user['token'] == $_COOKIE['token'])
|
||||
{
|
||||
$u->id = $user['id'];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if($u->id)
|
||||
{
|
||||
$u->load($u->id);
|
||||
$u->login();
|
||||
$url = '/'.implode('/',$GLOBALS['url']);
|
||||
//var_dump($url);
|
||||
$this->redirect($url);
|
||||
}
|
||||
else
|
||||
{
|
||||
setcookie('token', '', time() - 3600, "/");
|
||||
}
|
||||
}
|
||||
|
||||
$this->set("loggedin",(isset($_SESSION['user']) && $_SESSION['user'] !== false));
|
||||
$this->set('template', "notallowed.html");
|
||||
}
|
||||
|
Reference in New Issue
Block a user