SpreadQuiz/main.php
2024-09-25 16:04:38 +02:00

87 lines
3.7 KiB
PHP

<?php
require_once "globals.php";
require_once "usermgr.php";
require_once "autologin.php";
// if not logged in, then redirect to login page
$logged_in = get_autologin_state();
if (!$logged_in) {
header("Location: " . LOGIN_URL);
}
$user_data = get_autologin_user_data();
$privilege = $user_data["privilege"];
?>
<?php if ($logged_in) { ?>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0'>
<title>SpreadQuiz</title>
<script src="js/o.js"></script>
<script src="js/req.js"></script>
<script src="js/main.js"></script>
<script src="js/spreadquiz.js"></script>
<link rel="stylesheet" href="style/spreadquiz.css"/>
<link rel="stylesheet" href="style/spreadquiz_mobile.css"/>
</head>
<body>
<section id="screen_panel">
<section id="content_pane">
<iframe id="content_frame" src="default_frame.php"></iframe>
</section>
<section id="info_pane">
<section id="user_info" class="info-pane-element">
<?= $user_data["nickname"]; ?>
<section style="margin-top: 1em">
<?php if ($privilege === PRIVILEGE_QUIZMASTER) { ?>
<span style="font-size: 10pt;"><?= $_COOKIE[SESSION_NAME] ?></span><br>
<?php } ?>
<input type="button" value="Jelszóváltoztatás" onclick="show('change_password_window')"><br>
<input type="button" value="Kijelentkezés" onclick="logout()">
</section>
</section>
<?php if ($privilege != PRIVILEGE_PLAYER) { ?>
<section id="action_panel" class="info-pane-element">
<?php if (($privilege === PRIVILEGE_CREATOR) || ($privilege === PRIVILEGE_QUIZMASTER)) { ?>
<input type="button" value="Nyitólap" onclick="open_in_content_frame('default_frame.php')">
<input type="button" value="Tartalmak kezelése" onclick="open_in_content_frame('game_manager_frame.php')">
<?php } ?>
<?php if ($privilege === PRIVILEGE_QUIZMASTER) { ?>
<input type="button" value="Felhasználók kezelése" onclick="open_in_content_frame('user_manager_frame.php')">
<input type="button" value="Csoportok kezelése" onclick="open_in_content_frame('group_manager_frame.php')">
<?php } ?>
</section>
<?php } ?>
</section>
</section>
<section class="window" shown="false" id="change_password_window">
<section class="window-inner">
<section>
<table>
<tr>
<td><label for="old_password">Aktuális jelszó:</label></td>
<td><input type="password" id="old_password"></td>
</tr>
<tr>
<td><label for="new_password_1">Új jelszó:</label></td>
<td><input type="password" id="new_password_1"></td>
</tr>
<tr>
<td><label for="new_password_2">...mégegyszer:</label></td>
<td><input type="password" id="new_password_2"></td>
</tr>
</table>
</section>
<input type="button" value="Mentés" onclick="change_password()">
<input type="button" value="Mégse" onclick="hide('change_password_window')">
</section>
</section>
</body>
</html>
<?php } ?>