• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Session (ci, native, db, what ?)

#1
[eluser]sikkle[/eluser]
Hi,

This thread will maybe help some newbie like me Smile

Lately i take time to read barely 90% of the documentation, UserGuide, Wiki etc.

This will apear weird but something keep being "mysterious" to me.

SESSION.

Quote:PHPSession:
PHPSession utilizes PHP’s native session capabilities. PHPSession is loaded and used as a separate library, rather than replacing CodeIgniter’s Session class. It offers ‘flash’ session variables, and offers its own (very simple) api.

Native Session:
Native Session utilizes PHP’s native session capabilities. Unlike PHPSession, Native Session offers the same methods as CodeIgniter’s Session class, and is designed as a drop-in replacement. Native Session also extends the Session API to support ‘flash’ session variables and manually regenerating the session id.

DB Session
DB Session generates its own cookies and stores all session variables in a database, eschewing PHP’s native session facility. DB session is compatible with CI’s session api, and is designed as a drop-in replacement. DB Session supports ‘flash’ session variables.

OB Session
OB Session stores data either client-side in the cookie or server-side in a database table. It does not use PHP’s native session mechanism. Designed as a drop-in replacement for CodeIgniter’s session class. Easily configure non-persistent sessions, session timeouts and session auto regeneration. Supports ‘flash’ session variables and manual regeneration of the session id.

I understand for anyone who got enough skill, those explanation is enough.

i'm still not able to understand what is the best to use if you control 100% of your dedicated server.

I'll be happy to listen what solution people use, and more WHY ! Smile

Thanks a lot for people who taking time to give a minute for this.

#2
[eluser]Phil Sturgeon[/eluser]
These are all just various different ways of storing session variables. CI uses a library that either uses $_SESSION or inserts them into a database temporarily. Some of these are extensions to the native class and some are just replacements with some snazzy extras.

From reading through the descriptions it sounds like OB Session is the best as it not only allows you to control timeouts, auto-regeneration and other things, but you can make it use cookies or database storage which is a little more useful than good old sessions.

#3
[eluser]sikkle[/eluser]
many thanks for this response, this is weird to didnt get any response from what people use and why Smile

Time consuming i presume Smile

#4
[eluser]Rick Jolly[/eluser]
IMO, an ideal session library would use php native sessions with database storage and cookie-less sessions when the client won't accept cookies.

I like php native sessions because:
- only the session id is stored as a cookie on the client's computer.
- headers are added that allows IE to accept the cookie when security is set on high.
- a common api that can be used for any php application (not just CI) so it is cross-platform.

I like database storage because:
- it will work on distributed servers so it is scalable.
- you can easily query your database to find info about current logged in users. For example, how many users are currently logged in.

I like the option of cookie-less sessions (session id passed in the url) because:
- I've had clients behind a corporate firewall that won't accept cookies.



Unfortunately there are no CI libraries that have all these capabilities. Not one supports cookie-less sessions.

Native Session is a nice simple library. It adds flash data and session regeneration, but you have to use the CI methods instead of accessing the $_SESSION array which I find a bit more awkward.

OBSession is the most complete. When configured appropriately it will store the session id as a cookie and the rest of the data in the database. One drawback is that it sets the session id as a regular cookie as opposed to a native session cookie. That means that it will not work in IE if security is set to high.

#5
[eluser]sikkle[/eluser]
This is so this!

Many thanks for those comment.


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.