Chris
cfa964b4c5
All checks were successful
Build and push / Pulling repo on server (push) Successful in 3s
39 lines
966 B
PHP
39 lines
966 B
PHP
<?php
|
|
|
|
class Err extends Page {
|
|
|
|
function notfound($params=false)
|
|
{
|
|
$this->set("page",$params[0]);
|
|
$this->set('template', "notfound.html");
|
|
|
|
}
|
|
|
|
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 $userid => $user)
|
|
{
|
|
if($user['token'] && $user['token'] == $_COOKIE['token'])
|
|
{
|
|
$u->id = $userid;
|
|
break;
|
|
}
|
|
}
|
|
|
|
if($u->id)
|
|
{
|
|
$u->login();
|
|
$this->redirect($_SERVER['REQUEST_URI']);
|
|
}
|
|
}
|
|
|
|
$this->set("loggedin",(isset($_SESSION['user']) && $_SESSION['user'] !== false));
|
|
$this->set('template', "notallowed.html");
|
|
}
|
|
|
|
} |