Re: Session Variables

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

 



On 31 December 2014 at 15:39, Ethan Rosenberg <
erosenberg@xxxxxxxxxxxxxxxxxxxx> wrote:

> I now have -
>
> session_name("STORE");
> session_id('Gingy');
> session_set_cookie_params( 'lifetime', '/var/www' );
> session_start();
>
>
> No luck.
>


Did you read the manual? Have you read up on what cookies are and how they
work? How about PHP sessions?

1) Setting the session ID is generally a bad idea. By doing this you are
making every visitor to your site share the same session. You will have
session locking problems with multiple simultaneous visitors.

2) The first parameter to session_set_cookie_params is the lifetime of
cookies *in seconds* so the string 'lifetime' will use the integer
equivalent, which is 0. A session that lasts 0 seconds will clearly not
work.

3) The second parameter to session_set_cookie_params is the URL path on
which the cookie is valid. This means that unless your web pages are at
http://www.example.com/var/www/... your session will not work. This should
probably be set to '/'.

4) Generally speaking there is no need to change the default cookie
parameters; the defaults work perfectly well for most session scenarios.

Please take the time to learn and understand the tools you're using,
otherwise you're unlikely to make productive progress.

Hope that helps.

-Stuart

-- 
Stuart Dallas
3ft9 Ltd
http://3ft9.com/

[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