Files
wow-registrace/public/registrace.php
T
vojta 2b9a673912 Initial commit: AzerothCore registration site
PHP registration page for AzerothCore with SRP6 salt/verifier generation,
Cloudflare Turnstile + honeypot + rate limiting anti-spam, and a WoW-themed
landing page with client setup instructions.
2026-08-05 11:41:24 +02:00

114 lines
4.0 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
declare(strict_types=1);
$config = require __DIR__ . '/../includes/bootstrap.php';
$errors = $_SESSION['flash_errors'] ?? [];
$old = $_SESSION['flash_old'] ?? [];
$success = $_SESSION['flash_success'] ?? null;
unset($_SESSION['flash_errors'], $_SESSION['flash_old'], $_SESSION['flash_success']);
$siteKey = htmlspecialchars($config['turnstile']['site_key'], ENT_QUOTES);
$token = csrf_token();
?>
<!DOCTYPE html>
<html lang="cs">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Registrace účtu — WoW server</title>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Cinzel:wght@500;600;700&family=Cinzel+Decorative:wght@700&family=EB+Garamond:ital,wght@0,400;0,600;1,400&display=swap" rel="stylesheet">
<link rel="stylesheet" href="assets/style.css">
<?php if ($siteKey !== ''): ?>
<script src="https://challenges.cloudflare.com/turnstile/v0/api.js" async defer></script>
<?php endif; ?>
</head>
<body>
<div class="frame">
<main class="card">
<a class="back-link" href="index.php">&larr; Zpět na úvod</a>
<div class="crest" aria-hidden="true"></div>
<h1>Registrace účtu</h1>
<div class="divider"><span>⚔</span></div>
<?php if ($success): ?>
<div class="alert alert-success">
<?= htmlspecialchars($success, ENT_QUOTES) ?>
</div>
<?php endif; ?>
<?php if (!empty($errors)): ?>
<div class="alert alert-error">
<ul>
<?php foreach ($errors as $error): ?>
<li><?= htmlspecialchars($error, ENT_QUOTES) ?></li>
<?php endforeach; ?>
</ul>
</div>
<?php endif; ?>
<?php if (!$success): ?>
<form method="post" action="register.php" autocomplete="off">
<input type="hidden" name="csrf_token" value="<?= htmlspecialchars($token, ENT_QUOTES) ?>">
<!-- Honeypot: skryté před lidmi přes CSS, boti pole často vyplní -->
<div class="hp-field" aria-hidden="true">
<label for="website">Nechte prázdné</label>
<input type="text" id="website" name="website" tabindex="-1" autocomplete="off">
</div>
<label for="username">Uživatelské jméno</label>
<input
type="text"
id="username"
name="username"
minlength="<?= (int) $config['rules']['username_min'] ?>"
maxlength="<?= (int) $config['rules']['username_max'] ?>"
value="<?= htmlspecialchars($old['username'] ?? '', ENT_QUOTES) ?>"
required
>
<p class="hint">Pouze písmena A-Z a číslice, <?= (int) $config['rules']['username_min'] ?><?= (int) $config['rules']['username_max'] ?> znaků.</p>
<label for="email">E-mail</label>
<input
type="email"
id="email"
name="email"
value="<?= htmlspecialchars($old['email'] ?? '', ENT_QUOTES) ?>"
required
>
<label for="password">Heslo</label>
<input
type="password"
id="password"
name="password"
minlength="<?= (int) $config['rules']['password_min'] ?>"
maxlength="<?= (int) $config['rules']['password_max'] ?>"
required
>
<label for="password_confirm">Heslo znovu</label>
<input
type="password"
id="password_confirm"
name="password_confirm"
minlength="<?= (int) $config['rules']['password_min'] ?>"
maxlength="<?= (int) $config['rules']['password_max'] ?>"
required
>
<?php if ($siteKey !== ''): ?>
<div class="cf-turnstile" data-sitekey="<?= $siteKey ?>"></div>
<?php endif; ?>
<button type="submit"><span>Zaregistrovat se</span></button>
</form>
<?php endif; ?>
</main>
</div>
</body>
</html>