Re: PHP Sessions?
| From: | rory walsh | Date: | Wed, 02 Mar 2005 21:37:27 +0000 |
| Subject: | Re: PHP Sessions? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-209857@lists.php.net to get a copy of this message | ||
Yes I see what you mean. I only wanted to start a session IF the user logged in, but I see your point, the session can be started as soon as anyone opens the main page. I'll give it a go and see if that helps, cheers,
Rory.
Chris W. Parker wrote:
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.