RE: [PHP] PHP Sessions?
| From: | Chris W. Parker | Date: | Wed, 02 Mar 2005 21:32:23 +0000 |
| Subject: | RE: [PHP] PHP Sessions? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-209856@lists.php.net to get a copy of this message | ||
rory walsh <mailto:rorywalsh@ear.ie>
on Wednesday, March 02, 2005 1:26 PM said:
> The problem there is that I have to test if the user has logged on so
> I need to include the if statement? Can the session_start not be
> called from within an if statement? Does it really have to be the
> very first thing in the script, if so I imagine that this means a
> single script cannot be used to manage a complete website?
No session_start(); can go anywhere. It's just that it appears that your
logic is setup in such a way that session_start(); is not being called
when you need it be. By putting it before everything else you can avoid
this.
And as well, is there a reason you wouldn't want to just start the
session at the beginning of the page? I mean, why wait till the user has
submitted the form to start the session?
Chris.