<?php
/*
 * pages/register.php
 * PHP logic: INTACT - include/functions/register.php face toata validarea
 * HTML: design Nostalgia2
 */
?>

<!-- Header -->
<nav class="navbar navbar-dark bg-news-header mb-5">
    <div class="container-fluid">
        <h4 class="h4 small m-0 text-uppercase"><?php echo strtoupper($lang['register']); ?></h4>
    </div>
</nav>

<?php if($jsondataFunctions['active-registrations'] == 1) { ?>

<?php
// ---- LOGICA PHP INTACT ----
include 'include/functions/register.php';
require 'include/captcha/simple.php';
$_SESSION['captcha'] = simple_php_captcha();
?>

<!-- Form inregistrare -->
<div class="main_board_darker_background p-4">
    <form role="form" method="post" action="">
        <div class="col-8 mx-auto">

            <!-- Username -->
            <div class="my-3">
                <div class="left-inner-addon input-container mt-2">
                    <img src="<?php echo $site_url; ?>assets/img/icon-user.png" alt="">
                    <input name="username" id="username" type="text"
                        class="form-control-input form-control form-input text-white small"
                        placeholder="<?php echo $lang['user-name']; ?>..."
                        pattern=".{5,16}" maxlength="16" autocomplete="off" required>
                </div>
                <p class="text-danger small mb-0" id="checkname"></p>
                <p class="text-danger small mb-0" id="checkname2"></p>
            </div>

            <!-- Parola -->
            <div class="my-3">
                <div class="left-inner-addon input-container mt-2">
                    <img src="<?php echo $site_url; ?>assets/img/icon-pass.png" alt="">
                    <input name="password" id="password" type="password"
                        class="form-control-input form-control form-input text-white small"
                        placeholder="<?php echo $lang['password']; ?>"
                        pattern=".{5,16}" maxlength="16" required>
                </div>
            </div>

            <!-- Repeta parola -->
            <div class="my-3">
                <div class="left-inner-addon input-container mt-2">
                    <img src="<?php echo $site_url; ?>assets/img/icon-pass.png" alt="">
                    <input name="rpassword" id="rpassword" type="password"
                        class="form-control-input form-control form-input text-white small"
                        placeholder="<?php echo $lang['rpassword']; ?>"
                        pattern=".{5,16}" maxlength="16" required>
                </div>
                <p class="text-danger small mb-0" id="checkpassword"></p>
            </div>

            <!-- Email -->
            <div class="my-3">
                <div class="left-inner-addon input-container mt-2">
                    <input name="email" id="email" type="email"
                        class="form-control-input form-control form-input text-white small"
                        placeholder="ex@email.com"
                        pattern=".{7,64}" maxlength="64" required>
                </div>
                <p class="text-danger small mb-0" id="checkemail"></p>
            </div>

            <!-- Captcha -->
            <div class="my-3 d-flex align-items-center gap-3">
                <img src="<?php echo $site_url; ?>include/captcha/simple.php<?php echo $_SESSION['captcha']['image_src']; ?>" alt="captcha">
                <input name="captcha" type="text"
                    class="form-control-input form-control form-input text-white"
                    placeholder="<?php echo $lang['captcha-code']; ?>"
                    style="height:70px; font-size:30px;"
                    pattern=".{4,6}" maxlength="5" required>
            </div>

        </div>

        <div class="sider-btn mt-2">
            <button class="my-4 mx-auto text-center sign-in-button btn bg-button small fw-bold"
                type="submit" style="display:block;">
                <?php echo $lang['register']; ?>
            </button>
        </div>
    </form>
</div>

<?php } else { ?>
<div class="alert alert-info m-3" role="alert">
    <strong>Info!</strong> <?php echo $lang['disabled-registrations']; ?>
</div>
<?php } ?>
