adlerka.top/pages/global/account.php
2024-01-18 11:49:38 +01:00

40 lines
805 B
PHP

<?php
require_once "lib/router.php";
function render()
{
global $routerConfig;
$diddoAjax = true;
switch ($_POST["action"]) {
case "login":
doLogin();
break;
case "register":
doRegister();
break;
case "logout":
doLogout();
break;
default:
$diddoAjax = false;
break;
}
if ($diddoAjax) {
exit();
}
ob_start();
if ($_SESSION["ID"] > 0) {
$account_template = file_get_contents($routerConfig["template_dir"] . "account.html");
echo $account_template;
} else {
$login_template = file_get_contents($routerConfig["template_dir"] . "login.html");
echo $login_template;
}
return ob_get_clean();
}