My login does not seem to be creating a cookie. The form gets all the way to the cookie creation portion of the script and even echos that a cookie was made but it does not actually create one.
Here is the cookie portion of my code:
if (!$error) {
if (isset($_POST['rememberme'])) {
setcookie('guruemail', $loginemail, time() + 86400 * 365, '/', NULL);
setcookie('gurupassword', md5($loginpassword), time() + 86400 * 365, '/', NULL);
echo "Long-term cookie made";
} else {
setcookie('guruemail', $loginemail, false, '/', NULL);
setcookie('gurupassword', md5($loginpassword), false, '/', NULL);
echo "Short-term cookie made";
}
}
The login can be visited at http://protein.guru/signin.phtml
The cookie test can be viewed at: http://protein.guru/testcookie.php
Here is the cookietest code:
<?php
echo "Value is: " . $_COOKIE[$guruemail];
echo "Value is: " . $_COOKIE[$gurupassword];
?>
For the sign-in:
I am using the email: tester3651@outlook.com
Password is: meatloaf
Note:Possible newbie mistake? -- I do not have a session_start(); anywhere in either code. Not sure if I would need that for a straight cookie login.
Any feedback would be appreciated. Thanks everyone.