MINT-Projekt/check.php

92 lines
No EOL
2.8 KiB
PHP

<?php
/*
* Copyright (C) 2021 Eichehome
*
* 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/>.
*/
error_reporting(E_ALL); //Debuging
require_once 'include/DBConnection.inc.php';
function autoloader($classname)
{
include 'class/' . $classname . '.php';
}
spl_autoload_register('autoloader');
$session = new Session();
$db = new Datenbank($dbname, $username, $password, $servername);
/*===============================*/
if (isset($_SESSION["login"]) && $session->get("login") == 1) {
if (isset($_SESSION["reload"]) && $session->get("reload") == 1) {
$session->destroy();
$session->start();
$session->set("finished", 1);
$url = "index.php";
header("Location: $url");
echo '<script type="text/javascript">';
echo 'window.location.href="'.$url.'";';
echo '</script>';
echo '<noscript>';
echo '<meta http-equiv="refresh" content="0;url='.$url.'" />';
echo '</noscript>'; exit;
} else {
$session->set("reload", 1);
}
if (isset($_SESSION["status"]) && $session->get("status") == "ok") {
$message = $session->get("message");
}
} else {
$session->set("status", "error");
$session->set("message", "Nicht eingeloggt");
$url = "index.php";
header("Location: $url");
echo '<script type="text/javascript">';
echo 'window.location.href="'.$url.'";';
echo '</script>';
echo '<noscript>';
echo '<meta http-equiv="refresh" content="0;url='.$url.'" />';
echo '</noscript>'; exit;
}
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Sportwahlen | Check</title>
<link rel="stylesheet" href="assets/css/main.css">
</head>
<body>
<?php if (isset($message) && $message != ""): ?>
<div class="modal">
<div class="message sucsses">
<!-- Ausgabe einer eventuellen Statusmeldung -->
<p><?php echo $message; ?></p>
</div>
</div>
<?php endif;?>
<noscript>
<p>
Bitte einmal Neuladen (F5-Taste)
</p>
</noscript>
<script src="assets/js/main.js"></script>
</body>
</html>