Example #1
0
/**
 * Set a "remember me" cookie
 */
function stay_connected($user)
{
    setcookie('freeder_remember_me', generate_auth_token($user), time() + 31536000);
}
        array_push($errors, "Last name cannot be blank");
    }
    if (empty($password)) {
        array_push($errors, "Password cannot be blank");
    }
    if (empty($password_confirmation)) {
        array_push($errors, "Password confirmation cannot be blank");
    }
    if ($password != $password_confirmation) {
        array_push($errors, "Password and confirmation do not match.");
    }
    if (count($errors) == 0) {
        $password_digest = encrypt_password($password);
        try {
            $stmt = $conn->query("INSERT INTO users(first_name, last_name, email, password_digest) \n                                VALUES('{$first_name}', '{$last_name}', '{$email}', '{$password_digest}')");
            $auth_token = generate_auth_token();
            set_auth_token($username, $auth_token, $conn);
        } catch (PDOException $e) {
            array_push($errors, $e->getMessage());
        }
    }
}
var_dump($errors);
?>

<!DOCTYPE html>
<html>
  <head>
    <title> Login | UTEP Alumni Store </title>
    <?php 
require_once '_stylesheets.php';