This repository has been archived on 2023-12-29. You can view files and clone it, but cannot push or open issues or pull requests.
dogstats/web/pages/err/controller.php

39 lines
959 B
PHP
Raw Normal View History

2023-10-20 20:41:49 +02:00
<?php
class Err extends Page {
function notfound($params=false)
2023-10-20 20:41:49 +02:00
{
$this->set("page",$params[0]);
2023-10-21 21:30:20 +02:00
$this->set('template', "notfound.html");
2023-10-20 20:41:49 +02:00
}
function notallowed()
{
2023-10-29 09:41:02 +01:00
//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);
2023-10-29 09:45:58 +01:00
foreach($allusers as $user)
2023-10-29 09:41:02 +01:00
{
if($user['token'] && $user['token'] == $_COOKIE['token'])
{
2023-10-29 09:45:58 +01:00
$u->id = $user['id'];
2023-10-29 09:41:02 +01:00
break;
}
}
if($u->id)
{
$u->login();
$this->redirect($_SERVER['REQUEST_URI']);
}
}
2023-10-26 22:04:05 +02:00
$this->set("loggedin",(isset($_SESSION['user']) && $_SESSION['user'] !== false));
$this->set('template', "notallowed.html");
2023-10-20 20:41:49 +02:00
}
}