require_once '../libs/autoloader.php'; require_once '../libs/connect.class.php'; $register = new register($mysqli); $ajax = new AJAX(); $nonce = $_POST['nonce']; $username = $_POST['username']; $email1 = $_POST['email']; $email2 = $_POST['reemail']; $pass1 = $_POST['pass']; $pass2 = $_POST['repass']; // check if session is still alive. if (isset($_SESSION['current_page'])) { if ($ajax->checkAJAX($nonce, $_SESSION['current_page'])) { if (isset($_POST['submit'])) { $register->Username($username); $register->Email($email1, $email2); $register->Password($pass1, $pass2); if (empty($register->errors)) { //if no errors, add user. $register->addUser($username, $pass1, $email1); if (!isset($mysqli->errorno)) { //query went through without a problem //echo success, then clear form, disable button, and destroy session echo "<div id=\"return_success\">"; echo "<ul style=\"list-style: none;\">"; echo "<li><b>Your user has been added to the database!</b></li>"; echo "</ul>"; echo "</div>"; ?> <script type="text/javascript"> $("#register").find("input[type=text], [type=password]").val("");