Next Oct 2 Previous
Remembering passwords
This is an excerpt from a log-in procedure. What is not correct (given that the User class exists and works propery)?
<?php
...
$user = new User($pdo, $_POST["usercode"]);
if ($user->checkPassword($_POST["password"])) {
$_SESSION["authenticated"] = true;
if (isset($_POST["save_credentials"])) {
$_COOKIE["password"] = $_POST["password"];
$_COOKIE["usercode"] = $_POST["usercode"];
}
}
...
?>
A: The password data should have been encrypted before storing it in a cookie
B: the superglobal $_COOKIE cannot be used this way.
C: No cookies will be set.
D: Nothing as long as the user is not using IE 8 or worse.
E: You still need to send a redirect to commit the cookie.
Choose all that apply.



