Jump to content

Few newbie questions about sessions...


pneudralics

Recommended Posts

1) Session is not a cookie and a session is stored in a temporary server folder somewhere. Am I correct?

 

2) For a website that have users..is it better to use sessions or cookies?

 

3) How long does a session last by default if the user doesn't logout?

 

Thanks in advance.

Link to comment
https://forums.phpfreaks.com/topic/156152-few-newbie-questions-about-sessions/
Share on other sites

1  On the Server, the sessions are stored in the session save path as defined in the php.ini file

2  That depends on what you want to do

3  Read the php.ini file under the Session key to learn about how often the GC runs and the modifier that goes with it.

1. sort of correct... session values are stored in active memory

2. both... session data is for active content that will get flushed when user closes session or browser, cookies are used when you want to save information between user sessions

3. depends on the PHP.INI file setting, mine is set to: session.cache_expire = 180 minutes

1) Correct read revraz comment for more on this

2) Generally yes but it depends on what you want to store

3) Until the browser is closed. Check for more information: http://www.php.net/manual/en/session.configuration.php#ini.session.cookie-lifetime

 

You can extend the lifetime of a cookie by altering it's settings through: http://be2.php.net/manual/en/function.session-set-cookie-params.php

 

don't go with the information that mattal999 provides you cookies aren't the kind of resource you want to use as storage between requests as cookies are easy to create and modify sessions aren't really save either but they provide an extra layer of security

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.