mwstewart Posted March 14, 2007 Share Posted March 14, 2007 Hello guys, I've written a logon page that has a remember function. When users log in they are authenticated against the DB, if authenticated the data taken from the query is used to initialize session variables. There is an if statement at the top of my index.php page that sets cookies should the user wish to be remembered (check box). I use the session variables to write to the cookies which are then used to automatically log in the user next time. All pretty standard stuff. Trouble is, the cookies are not being written, session variables do not seem to be accessible until after header information is sent. Is this correct? I always thought session data was available all the time at the server. This means that currently I have to refresh the logon page twice before the cookie is written. Any suggestions? Cheers, Mark Link to comment https://forums.phpfreaks.com/topic/42707-writing-session-variables-to-cookies/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.