Page 1 of 1

Login script on Nutscrape not working

Posted: Fri Aug 06, 2004 4:58 pm
by turbo2ltr
Ok, so I finally got around to checking out my site on netscape and I was extremely dissapointed.

Mostly fixable cosmetic stuff, but this has got me stumped:
The login doesn't work at all anymore.

It would appear that one of the two cookies I'm trying to set doesn't get set.

Code: Select all

<?php
if($rememberme)
   setcookie ("login_key", $cookie_val, 3153600,"/");  // stay logged in
else
   setcookie ("login_key", $cookie_val, 0,"/");  	// only good for this session

setcookie ("login_name", $user[user_username], 3153600,"/");  	// always store the username.
?>
The key is set, but the name isn't. I put netscape on the lowest security and told it to "accept all cookies". I can see the key cookie in the Cookie manager. But thats it. no name cookie. I don't have a clue why it's not working.

It works fine in IE.
Anyone?

Thanks,
Mike

Posted: Fri Aug 06, 2004 5:01 pm
by turbo2ltr
One important thing I forgot to mention is right after I set the cookies:

Code: Select all

header("Location: index.php?$qs");
Where $qs is the query string.
This puts the person on the page they were on before the login.

Posted: Fri Aug 06, 2004 5:04 pm
by Joe
Well, your cookie should be set like:

Code: Select all

setcookie("login_key", $cookie_val, time()+3600);
Also, are you sure $cookie_val has a value appended to it.

More info: http://uk2.php.net/manual/en/function.setcookie.php

Posted: Fri Aug 06, 2004 5:05 pm
by feyd
you may need to alter the location header so it's a fully qualified url.. not just a relative one.. I don't remember if NS demands this, but that's the way the standard says it's supposed to be.. at least I remember it saying that..

Posted: Fri Aug 06, 2004 5:05 pm
by Joe
turbo2ltr wrote:One important thing I forgot to mention is right after I set the cookies:

Code: Select all

header("Location: index.php?$qs");
Where $qs is the query string.
This puts the person on the page they were on before the login.
Well again, that is because output is already been given! (I think, I would have to view the source you have)

Posted: Fri Aug 06, 2004 5:10 pm
by turbo2ltr
wow, thats what happens when you copy someone elses example. What threw me off is that it works in IE.

I changed it to (time()+31536000) for a year and it works fine now.

Thanks!

Posted: Fri Aug 06, 2004 5:11 pm
by turbo2ltr
Joe wrote:
turbo2ltr wrote:One important thing I forgot to mention is right after I set the cookies:

Code: Select all

header("Location: index.php?$qs");
Where $qs is the query string.
This puts the person on the page they were on before the login.
Well again, that is because output is already been given! (I think, I would have to view the source you have)
This is by design. It works as intended.

Posted: Fri Aug 06, 2004 5:42 pm
by Joe
Oh sorry! My foolish mistake :?