note 15676 rejected from function.session-start by jimw
| From: | jimw@php.net | Date: | Wed, 26 Sep 2001 06:53:51 +0000 |
| Subject: | note 15676 rejected from function.session-start by jimw | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-18312@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?