Im building a really small social site about sports.
And i would like to ask a more experienced developer, if it would be better to use native session or ci session library? and if ci library it it better to use the databse store?
Thank you for your options
The CI session library will get you up and going very quickly, giving you greater flexibility than native sessions. Keep in mind, though, that the CI_Session class is pretty paranoid; you might get some unexpected session expiration, particularly with AJAX-heavy applications.
I recommend going with CI sessions, with the following caveats:
sess_update()
function to prevent unexpected expirations)Additionally, you'll need to store sessions in a table if you risk needing more storage than cookies allow (4KB, I think; you'll use it up even faster with encryption). Might as well go with a database and be done with it.
You can also have the best of both by using the native session extended library.
To quote:
I would go for native PHP Session because I believe there's a problem with the latter.
What if the user's browser have cookies disabled? Although Browsers with cookies disabled aren’t getting far on the internet these days… But still, there are people having their cookies disabled so CI sessioncookies in not a very good candidate...
So how can we use $_SESSION[] in codeigniter? Try this:
Since the pages in mvc are triggered by the controller, we could do this
to the CI_Controller class on system/core/Controller.php