summaryrefslogtreecommitdiff
path: root/pages/logout.php
blob: ea1bfce261cbd6d43596c675f965cd12654e381a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
<?php

if (isset($_COOKIE['PEH2_SESSION_TOKEN'])) {
    if (str_contains($_COOKIE['PEH2_SESSION_TOKEN'], ".") || str_contains($_COOKIE['PEH2_SESSION_TOKEN'], "/")) {
        header("Location: /") and die();
    }

    if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/tokens/" . str_replace(".", "", str_replace("/", "", $_COOKIE['PEH2_SESSION_TOKEN'])))) {
        unlink($_SERVER['DOCUMENT_ROOT'] . "/includes/tokens/" . str_replace(".", "", str_replace("/", "", $_COOKIE['PEH2_SESSION_TOKEN'])));
        header("Location: /") and die();
    } else {
        header("Location: /") and die();
    }
} else {
    header("Location: /") and die();
}