Allright. I've KINDOF got cookies working.
This is the problem. I'm making a cookie-based login system similar to the one in the tutorials here on the site. I made a test script that just had 2 functions, to set and to read cookies, and it worked fine there.
From there I put them in the script, and from all visible indicators the cookies are being set (i KNOW the setcookie line is being called without error). However, when I go back in a different function later on, it can't read the cookies, I just get a blank string.
Code:
Here is how I'm setting....
if ($passwrd == $pwd) {
$id_hash = md5($user_name.$hidden_hash_var);
setcookie('username',$user_name,(time()+3600),'/','',0);
setcookie('password',$id_hash,(time()+3600),'/','',0);
echo "Logged in user $user_name with $id_hash!";
That $paasswrd=$pwd is just a check to see if they entered correct pass against an SQL table. To call, I'm doin something like
$user_name = $HTTP_COOKIE_VARS["username"];
$enc_pass = $HTTP_COOKIE_VARS["password"];
---except that both $user_name and $enc_pass are blank.
Ideas?