mirror of
https://github.com/tim-krehan/shopping-list.git
synced 2024-11-23 22:30:41 +01:00
15 lines
484 B
PHP
15 lines
484 B
PHP
|
<?php
|
||
|
include $_SESSION["docroot"].'/config/config.php';
|
||
|
include $_SESSION["docroot"].'/php/connect.php';
|
||
|
if(!(preg_match("/error.+/", $_SERVER["REQUEST_URI"])))
|
||
|
{
|
||
|
$result = $mysqli->query('SELECT * FROM `sessions` WHERE `session_id` = \''.$_COOKIE["token"].'\';');
|
||
|
|
||
|
if($result->num_rows == 0 && (!(in_array("site", array_keys($_GET))) || $_GET["site"]!="login"))
|
||
|
{
|
||
|
header('Location: /login/url='.$_SERVER["REQUEST_URI"]);
|
||
|
}
|
||
|
$mysqli->close();
|
||
|
}
|
||
|
?>
|