Saving sessions data in database and non-persistent cookies - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=22) +--- Thread: Saving sessions data in database and non-persistent cookies (/showthread.php?tid=2640) |
Saving sessions data in database and non-persistent cookies - El Forum - 08-16-2007 [eluser]Unknown[/eluser] Finally I have decided to publish a little extension of the Session.php library. MY_Session.php allow non-persistent cookies with easy config: Code: $config['sess_cookie_isnonpersistent'] = TRUE; And also, I have not the cookie data limit of 4KB (because session data is stored in database). The code is very simple and I have used serialize function for storing data in a TEXT field. Also, you can save data in cookies using the new method set_userdata_cookies. The old method userdata first look at the session db info, and later in the cookie :-). It is perfect if you don't want to expose sensitive data in cookies or save more and more information in sessions. More details in my blog. Download: MY_Session.zip Saving sessions data in database and non-persistent cookies - El Forum - 12-25-2007 [eluser]Edemilson Lima[/eluser] I liked very much your implementation to save session vars in the database. In fact, it was my first idea too. But isn't the PHP native session engine made in compiled C code faster than any implementation made in PHP code? My main concern is: how much these implementations using cookies or databases are better to save server resources? How does PHP native session behave when we have thousands of simultaneous users? I think you could made it more flexible using $this->CI->config->item('sess_table_name') to get the name of the session database from the config file. |