LobbySIO/logout.php

61 lines
3.3 KiB
PHP
Raw Permalink Normal View History

2018-10-15 15:14:36 -04:00
<?php
/*
2021-06-12 09:29:10 -04:00
* Copyright (C) 2018 josh.north@point808.com
2018-10-15 15:14:36 -04:00
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
ini_set('session.gc_maxlifetime', 24*60*60); // MIN SESSION
ini_set('session.gc_probability', 1); // GC RATES
ini_set('session.gc_divisor', 100); // TIMES
2021-05-28 17:02:01 -04:00
ini_set('session.use_cookies', '1');
ini_set('session.use_only_cookies', '1');
2021-08-11 10:54:25 -04:00
ini_set('session.cookie_lifetime', '0');
2021-10-18 10:38:41 -04:00
ini_set('session.cookie_secure', '1');
ini_set('session.cookie_httponly', '1');
ini_set('session.cookie_samesite', 'Strict');
session_save_path('.tmp'); // TEMP
session_start(); // START
require_once __DIR__ . '/autoload.php'; // AUTOLOAD
$StaticFunctions = new \App\LobbySIO\Misc\StaticFunctions(); // DEFAULT CLASSES
$SiteInfo = new \App\LobbySIO\Database\SiteInfo();
$Users = new \App\LobbySIO\Database\Users();
if (isset($_SESSION['user_id'])) { // LOGGED IN? GET USER OBJECT
$session_user = $Users->getUserInfo($_SESSION['user_id'], "1", "0"); }
if (isset($session_user)) { // GET UID OR SET TO KIOSK
$uid = $session_user["0"]["users_id"];} else { $uid = "2"; }
$app_disp_lang = filter_input(INPUT_COOKIE, 'app_disp_lang', FILTER_SANITIZE_FULL_SPECIAL_CHARS); // SETUP LANGUAGE
if(!isset($app_disp_lang)) {
$app_disp_lang=$StaticFunctions->getDefaultLanguage(); }
$siteidcookie = filter_input(INPUT_COOKIE, 'app_site'); // SETUP SITE
foreach($SiteInfo->getSite("0", $uid, "0", "0") as $arr) {
$lookup_array[$arr['sites_id']]=1; }
if(isset($lookup_array[$siteidcookie])) {
$siteid = $siteidcookie; } else { $siteid = "1"; }
if(!isset($siteid)) { $siteid="1"; }
$Translate = new \App\LobbySIO\Language\Translate($app_disp_lang); // SETUP TRANSLATOR
$transLang = $Translate->userLanguage();
$app_current_pagename = $transLang['LOGOUT']; // PAGE SETUP
$app_current_pageicon = '<i class="fas fa-sign-out"></i> ';
require_once("inc/header.inc.php");
if ($StaticFunctions->getSessionStatus() == false) { // CHECK STATUS
echo $StaticFunctions->killSession(); // ELSE DIE
2021-10-20 12:00:23 -04:00
Classes\Misc\Csrf::removeToken('home');
2018-10-15 15:14:36 -04:00
} else { ?>
<!-- CONTENT START -->
<?php echo $StaticFunctions->killSession(); ?>
<!-- CONTENT END -->
2021-06-12 09:29:10 -04:00
<?php } require_once("inc/footer.inc.php");