<?php

session_start();

if (!isset($_SESSION['userAccreditation']) || !isset($_SESSION['userRole'])) {
    $_SESSION['userAccreditation'] = 0;
    $_SESSION['userRole'] = 0;
}

if (!isset($_COOKIE['theme'])) {
    $theme = random_int(0, 3);
    setcookie('theme', $theme, time()+10*60*60, "/", ".e59.fr");
    $darkTheme = $darkThemes[$theme];
    $lightTheme = $lightThemes[$theme];
}

if (isset($_GET['theme'])) {
    $newTheme = (int)$_GET['theme'] % 3;
    setcookie('theme', $newTheme, time()+10*60*60, "/", ".e59.fr");    // % 2 => Number of different themes
    $darkTheme = $darkThemes[$newTheme];
    $lightTHeme = $lightThemes[$newTheme];

} else if (isset($_COOKIE['theme'])) {
    $theme = (int)$_COOKIE['theme'] % 3;
    $darkTheme = $darkThemes[$theme];
    $lightTheme = $lightThemes[$theme];
}

$status = "";

?>