Re: Sessions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



2009/7/3 Daniel Brown <danbrown@xxxxxxx>

> On Thu, Jul 2, 2009 at 23:27, Jason Carson<jason@xxxxxxxxxxxxxx> wrote:
> > Hello all,
> >
> > Do I have to add session_start() at the beginning of every page so that
> > the $_SESSION variables work on all pages or do I use session_start() on
> > the first page and something else on other pages?
>
>     Yes, unless you're using session autoloading.  Also, in most
> cases, you will only need to call session_start() once (before
> referencing $_SESSION), even if $_SESSION is accessed in an included
> file.
>
> --
> </Daniel P. Brown>
> daniel.brown@xxxxxxxxxxxx || danbrown@xxxxxxx
> http://www.parasane.net/ || http://www.pilotpig.net/
> Check out our hosting and dedicated server deals at
> http://twitter.com/pilotpig
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

Some people have a file called init.php, which would contain
session_start(); as well as other things that need to be done every page
load (connect to the database perhaps?) and they just 'require' that at the
top of every page.

-- 
Luke Slater
http://dinosaur-os.com/
:O)

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux