session-set-save-handler

PDO prepare silently fails

I'm experimenting with PHP's session_set_save_handler and I'd like to use a PDO connection to store session data. I have this function as a callback for write actions: function _write($id, $data) { logger('_WRITE ' . $id . ' ' . $data); try { $access = time(); $sql = 'REPLACE INTO sessions SET id=:id, access=:ac...

PHP mysqli->real_escape_string when using sessions saved in the DB

Ok, I hope I've got everything listed up nicely before posting this question because I've found bits and pieces of a solution here and there but no real answer to my issue. 1: I'm using a singleton MySQL connection with mysqli, not using stored procedures; 2: I found code online explaining session_set_save_handler and have embedded it ...

PHP: on session death change DB

I am using PHP for a project. I have set the session life to 0 so that when the user closes the browser, the session dies and he/she is logged out. However, I have a status variable in the DB which stores the information telling me if the user is logged in or not. I use this to inform other users the status of a particular user. When th...

session_set_save_handler - Why isn't this code working?

Hello, I've been trying to save PHP session data in a MySQL database, but can't get it to work. For a simple example, here's code that should increment a counter with each visit. I've seen other examples, etc. but can someone please tell me why this code isn't working? (Apache/2.2.11 (Win32) DAV/2 mod_ssl/2.2.11 OpenSSL/0.9.8i PHP/5....