note 15676 added to function.session-start

From: Date: Wed, 26 Sep 2001 05:26:47 +0000
Subject: note 15676 added to function.session-start
Groups: php.notes 
Request: Send a blank email to php-notes+get-18310@lists.php.net to get a copy of this message
Well, I've been using sessions and MySQL to keep track of user information. I just have a simple function to authenticate the user against a username and password in MySQL and then I use mysql_fetch_object to get a $user object. After I register $user, I just do a session_start() on every page following the log on and I have access to the user information stored in the database via the user object. Seems to work well. However, I did have some problems that seem to be related to headers. After using a session_start() at the top of a script that generated PDF code and then sent the PDF document to the browser from memmory, I was getting a blank PDF document. Acrobat would start, but would never finish displaying the document. Removing the session_start() fixed the problem so I attributed it to that. Then I tried placing a session_write_close() immediately following the session_start(), since I had no plans to change any variables in the session at that point. This also seemed to clear up the problem. That's the solution I've stuck with. I'm not quite sure why all that works the way it does, and I'd be interested to know if anyone else does? -- http://www.php.net/manual/en/function.session-start.php http://master.php.net/manage/user-notes.php?action=edit+15676 http://master.php.net/manage/user-notes.php?action=delete+15676 http://master.php.net/manage/user-notes.php?action=reject+15676

« previous php.notes (#18310) next »