ACK! X_X I SPOKE TOO SOON!
Tell me whats wrong with this...
Code: Select all
function login()
{
global $POST_username, $POST_password, $UserInfo, $DB;
if (isset($POST_username) && empty($cookie))
{
$DB->query("SELECT * FROM users WHERE username='".$POST_username."'", "CurrentUser");
$UserInfo = $DB->fetch_row("CurrentUser");
setcookie ("cookie[username]", "X".$POST_username, time()+3600, '/');
setcookie ("cookie[password]", "Y".$POST_password, time()+3600, '/');
print "<meta http-equiv=refresh content=\"0;url=index.php?page=two\">";
}
elseif (isset($cookie))
{
echo "Success";
}
else
{
$UserInfo['username'] = "Guest";
$UserInfo['password'] = "NULL";
}
if (isset ($cookie)) {
while (list ($name, $value) = each ($cookie)) {
echo "$name == $value<br>\n";
}
} else { echo "dangit"; }
}
I get cookie alerts so the first if definitely works, but at the end, I always get "dangit" no matter what. So it seems my cookie is empty.... (Which is weird because I put a letter in front of the variable to make sure it isn't empty

)