function registration_confirm() { $p_user = new PublicUser(); if (isset($_POST['action'])) { //If session has been set if (isset($_SESSION['new_user'])) { if ($_POST['code'] == $_SESSION['new_user']['code']) { if ($p_user->register_user($_SESSION['new_user'])) { //After registration complete clear the $_SESSION variable unset($_SESSION['new_user']); //Do no echo anything else echo 'yes'; } } else { echo $_POST['code'] . " " . $_SESSION['new_user']['code']; } } else { //If not set the varication code then resent it into the registration page safe_redirect(get_home_url() . '/registration.php'); } } }