Subversion Repositories cheapmusic

Rev

Rev 122 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

<?php
// Include Session Handling
require_once ('includes/session.php');

// Include config & login validate file
require_once 'includes/validateUser.php';

if (isset($_SESSION['signup_post_data'])) {
    // Get not submitted form data from session
    $signup_post_data = $_SESSION['signup_post_data'];

    // Remove post data from session
    unset($_SESSION['signup_post_data']);
}

if (isset($_SESSION['sessData']['field_error'])) {
    // Get form field error from session
    $fieldError = $_SESSION['sessData']['field_error'];

    // Remove field error data from session
    unset($_SESSION['field_error']['sessData']);
}
?>
<!DOCTYPE html>
<html lang="en-US">
<head>
        <!--head-->
        <?php include_once 'elements/head.php'; ?>
    <script src="https://www.google.com/recaptcha/api.js?onload=onloadCallback" nonce="<?php echo base64_encode($_SESSION["nonce"]); ?>" async defer></script>
    <script src="<?php echo PUBLIC_URL . "js/recaptcha.js?" . filemtime("assets/js/recaptcha.js"); ?>" async defer integrity="sha384-<?php echo base64_encode(hash_file("sha384", "assets/js/recaptcha.js", true)); ?>" crossorigin="anonymous"></script>
    <script src="<?php echo PUBLIC_URL . "js/policies.js?" . filemtime("assets/js/policies.js"); ?>" async defer integrity="sha384-<?php echo base64_encode(hash_file("sha384", "assets/js/policies.js", true)); ?>" crossorigin="anonymous"></script>
        <!--//head-->
</head>
<body>
<div class="main">
    <!--header-->
    <?php include_once 'elements/header.php'; ?>
    <!--//header-->

    <!--main-->
        <div class="main-content">
          <div class="wrapper-frm bg-light text-dark border shadow text-center">
            <div class="header">
               <h1>Create a New Account</h1>
            </div>
            <div class="top">
                                <?php echo !empty($statusMsg) ? '<p class="status-msg ' . $statusMsgType . '">' . $statusMsg . '</p>' : ''; ?>
                <form action="<?php echo BASE_URL; ?>userAccount.php" method="post">
                                        <input type="hidden" name="nonce" value="<?php if (isset($_SESSION['nonce'])) echo $_SESSION['nonce']; ?>" />
                    <div class="frm-input <?php echo !empty($fieldError['first_name']) ? 'error' : ''; ?>">
                        <input type="text" name="first_name" class="user-in" placeholder="First name" aria-label="First name" value="<?php echo !empty($signup_post_data['first_name']) ? $signup_post_data['first_name'] : ''; ?>" required="" />
                        <?php echo !empty($fieldError['first_name']) ? '<p>' . $fieldError['first_name'] . '</p>' : ''; ?>
                    </div>
                    <div class="frm-input <?php echo !empty($fieldError['last_name']) ? 'error' : ''; ?>">
                        <input type="text" name="last_name" class="user-in" placeholder="Last name" aria-label="Last name" value="<?php echo !empty($signup_post_data['last_name']) ? $signup_post_data['last_name'] : ''; ?>" />
                                                <?php echo !empty($fieldError['last_name']) ? '<p>' . $fieldError['last_name'] . '</p>' : ''; ?>
                    </div>
                    <div class="frm-input">
                        <input type="text" name="zip" class="addr-in" placeholder="Zip" aria-label="Zip Code" value="<?php echo !empty($signup_post_data['zip']) ? $signup_post_data['zip'] : ''; ?>" />
                    </div>
                    <div class="frm-input <?php echo !empty($fieldError['email']) ? 'error' : ''; ?>">
                        <input type="email" name="email" class="email-in" placeholder="Email" aria-label="Email Address" value="<?php echo !empty($signup_post_data['email']) ? $signup_post_data['email'] : ''; ?>" required="" autocomplete="username" />
                                                <?php echo !empty($fieldError['email']) ? '<p>' . $fieldError['email'] . '</p>' : ''; ?>
                    </div>
                    <div class="frm-input <?php echo !empty($fieldError['password']) ? 'error' : ''; ?>">
                        <input type="password" name="password" class="pass-in" placeholder="Password" aria-label="Password" required="" autocomplete="new-password" />
                                                <?php echo !empty($fieldError['password']) ? '<p>' . $fieldError['password'] . '</p>' : ''; ?>
                    </div>
                    <div class="frm-input <?php echo !empty($fieldError['confirm_password']) ? 'error' : ''; ?>">
                        <input type="password" name="confirm_password" class="pass-in" placeholder="Confirm Password" aria-label="Confirm Password" required="" autocomplete="new-password" />
                                                <?php echo !empty($fieldError['confirm_password']) ? '<p>' . $fieldError['confirm_password'] . '</p>' : ''; ?>
                    </div>
                    <div class="check pb-3 pt-2">
                        <p id="acceptPoliciesMsg"></p>
                        <input type="checkbox" id="acceptPolicies" name="acceptPolicies" value="1" required="" />
                        <label for="acceptPolicies"><span></span>I agree to the <a href="../terms.php" target="_blank">Terms of Service</a> and I accept the <a href="../privacy.php" target="_blank">Privacy Policy</a>.</label>
                    </div>
                    <div class="pb-3">
                        <div class="g-recaptcha" data-sitekey="<?php echo GR_SITE_KEY; ?>" data-badge="inline" data-size="invisible" data-callback="setResponse"></div>
                    </div>
                    <div class="frm-btn">
                        <button id="signupBtn" class="btn btn-success" type="submit" name="signupSubmit" value="Sign Up">Sign Up</button>
                        <script nonce="<?php echo base64_encode($_SESSION["nonce"]) ?>">
                        document.addEventListener("DOMContentLoaded", function() {
                                document.getElementById("signupBtn").addEventListener("click", function() {
                                return checkAcceptPolicies();
                                });
                        });
                        </script>
                    </div>
                </form>
            </div>
            <div class="bottom">
                <p>Already Have an Account? <a href="<?php echo BASE_URL; ?>index.php">Login</a></p>
            </div>
          </div>
        </div>
        <!--//main-->

        <!--footer-->
        <?php include_once 'elements/footer.php'; ?>
        <!--//footer-->
</div>
</body>
</html>