matrix-register/validation.php

70 lines
1.2 KiB
PHP
Raw Normal View History

2021-03-01 16:56:53 +01:00
<?php
error_reporting(E_ALL);
ini_set('display_errors', true);
require("static/web.php");
require("lib/register.php");
$class = "";
$title = "";
$message = "";
$registered = false;
if ($_SERVER['REQUEST_METHOD'] === 'GET') {
$token = $_GET['token'] ?? '';
if ($token) {
$registrator = new Registrator();
$registered = $registrator->registerUser($message);
if ($registered) {
$class = "success";
$title = "Congratulations";
} else {
$class = "error";
$title = "Sorry";
$message = "Failed to register your account.";
}
} else {
$class = "error";
$title = "Sorry";
$message = "Something goes wrong.";
}
}
?>
<!DOCTYPE HTML>
<html lang="de">
<head>
<title>matrix.kraut.space - register</title>
<?php echo HTML_META ?>
</head>
<body>
<div id="wrapper">
<?php echo HTML_HEADER ?>
<main>
<div class="<?php echo $class ?>">
<?php if ($title): ?>
<h3><?php echo $title ?></h3>
<?php endif ?>
<?php if ($message): ?>
<p><?php echo $message ?></p>
<?php endif ?>
</div>
</main>
<?php echo HTML_FOOTER ?>
</div> <!-- ende div wrapper -->
</body>
</html>