View sourcecode

The following files exists in this folder. Click to view.

check_login.php

14 lines UTF-8 Unix (LF)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
<?php
session_start
();

// Kolla om användaren är inloggad via session eller cookie
if (
    (!isset(
$_SESSION['logged_in']) || $_SESSION['logged_in'] !== true) &&
    (!isset(
$_COOKIE['logged_in']) || $_COOKIE['logged_in'] !== 'true')
) {
    
// Om inte inloggad, skicka tillbaka till index.php
    
header('Location: index.php?error=2');
    exit;
}