Blame | Last modification | View Log | Download
John,I have been an extremely satisfied ADODB user for several years now.To give you something back for all your hard work, I've spent the last 3days rewriting the adodb-session.php code.----------What's New----------Here's a list of the new code's benefits:* Combines the functionality of the three files:adodb-session.phpadodb-session-clob.phpadodb-cryptsession.phpeach with very similar functionality, into a single file adodb-session.php.This will ease maintenance and support issues.* Supports multiple encryption and compression schemes.Currently, we support:MD5Crypt (crypt.inc.php)MCryptSecure (Horde's emulation of MCrypt, if MCrypt module is not available.)GZipBZip2These can be stacked, so if you want to compress and then encrypt yoursession data, it's easy.Also, the built-in MCrypt functions will be *much* faster, and more secure,than the MD5Crypt code.* adodb-session.php contains a single class ADODB_Session that encapsulatesall functionality.This eliminates the use of global vars and defines (though they aresupported for backwards compatibility).* All user defined parameters are now static functions in the ADODB_Sessionclass.New parameters include:* encryptionKey(): Define the encryption key used to encrypt the session.Originally, it was a hard coded string.* persist(): Define if the database will be opened in persistent mode.Originally, the user had to call adodb_sess_open().* dataFieldName(): Define the field name used to store the session data, as'DATA' appears to be a reserved word in the following cases:ANSI SQLIBM DB2MS SQL ServerPostgresSAP* filter(): Used to support multiple, simulataneous encryption/compressionschemes.* Debug support is improved thru _rsdump() function, which is called afterevery database call.------------What's Fixed------------The new code includes several bug fixes and enhancements:* sesskey is compared in BINARY mode for MySQL, to avoid problems withsession keys that differ only by case.Of course, the user should define the sesskey field as BINARY, tocorrectly fix this problem, otherwise performance will suffer.* In ADODB_Session::gc(), if $expire_notify is true, the multiple DELETES inthe original code have been optimized to a single DELETE.* In ADODB_Session::destroy(), since "SELECT expireref, sesskey FROM $tableWHERE sesskey = $qkey" will only return a single value, we don't loop on theresult, we simply process the row, if any.* We close $rs after every use.---------------What's the Same---------------I know backwards compatibility is *very* important to you. Therefore, thenew code is 100% backwards compatible.If you like my code, but don't "trust" it's backwards compatible, maybe weoffer it as beta code, in a new directory for a release or two?------------What's To Do------------I've vascillated over whether to use a single function to get/setparameters:$user = ADODB_Session::user(); // getADODB_Session::user($user); // setor to use separate functions (which is the PEAR/Java way):$user = ADODB_Session::getUser();ADODB_Session::setUser($user);I've chosen the former as it's makes for a simpler API, and reduces theamount of code, but I'd be happy to change it to the latter.Also, do you think the class should be a singleton class, versus a staticclass?Let me know if you find this code useful, and will be including it in thenext release of ADODB.If so, I will modify the current documentation to detail the newfunctionality. To that end, what file(s) contain the documentation? Pleasesend them to me if they are not publically available.Also, if there is *anything* in the code that you like to see changed, letme know.Thanks,Ross