function CreateUser($database, $email, $password) { if (!ConfirmedUserExists($database, $email)) { $email = SanitizeString($email); $password = SanitizeString($password); $salt = GenerateSalt(); $confirmVector = GenerateSalt(); // random vector to hash with salt for confirm code $confirmCode = HashPassword($confirmVector, $salt); // confirm code is hashed value of salt plus random vector $hash = HashPassword($password, $salt); $query = "INSERT INTO users_unconfirmed SET email='{$email}', pw_hash='{$hash}', pw_salt='{$salt}', confirm_code='{$confirmCode}'"; $retval = MySqlDatabaseQuery($database, $query, TRUE); SendConfirmation($database, $email); return $retval; } else { return FALSE; } }
<?php /* File Name: resend_confirmation.php * Description: This file contains a script which submits a project * Dependencies: easy_auth_library.php, easy_auth_toolbox.php, connect.php * Additional Notes: none */ require_once "easy_auth_library.php"; require_once "connect.php"; // instantiates $database // send confirmation email SendConfirmation($database, $_POST['email']); // redirect to confirm page header('Location: ../confirm.html');