1<?php 2require_once '../mplt.php'; 3$timer = new mplt(); 4require_once '../dalmp.php'; 5# ----------------------------------------------------------------------------------------------------------------- 6 7/** 8 * 9 * For using DALMP with sqlite3 databases encrypted you 10 * need to install sqlcipher: http://sqlcipher.net/ 11 * 12 * Encrypting your databases sessions or queues is helpful on shared environments where you need more privacy 13 * 14 * ----------------------------------------------------------------------------------------------------------------- 15 On a Mac OS X you can compile sqlcipher with something like: 16 ./configure --prefix=/usr/local/sqlcipher --enable-tempstore=yes CFLAGS="-DSQLITE_HAS_CODEC" LDFLAGS="-lcrypto" 17 18 On FreeBSD use this version: 19 git clone git://github.com/nbari/sqlcipher.git 20 21 Or try to use this port: http://www.freebsd.org/cgi/query-pr.cgi?pr=160993 22 23 later you will have to recompile php sqlite3 extension 24 * ----------------------------------------------------------------------------------------------------------------- 25 * 26 */ 27 28/** 29 * 30 * For enable encryption you must define the constant DALMP_SQLITE_ENC_KEY 31 * that constan will have the key used for encrypting / decrypting. 32 * 33 * existing databases will need to be recreated, since now the full database will be encrypted 34 * in case of an error simple delete your old database and let DALMP re-create it automatically 35 * 36 */ 37define('DALMP_SQLITE_ENC_KEY', 'my sqlite key'); 38 39/** 40 * thats all, now your sqlite3 database will be encrypted. 41 */ 42 43define('DALMP_SESSIONS_SQLITE_DB','/tmp/sessions.db'); 44 45$sessions = new DALMP_Sessions(); 46 47/** 48 * access this script from a browser for avoiding complains 49 * later check for the dalmp_sessions.db and try to read it 50 * from the comand line you can test the encryption by doing 51 strings dalmp_sessions.db 52 ?:z{ 53 Eyq 54 ... 55 56 */ 57$_SESSION['test'] = 1 + @$_SESSION['test']; 58 59echo $_SESSION['test'] .' - '.session_id(); 60 61echo DALMP::isCli(1); 62 63# ----------------------------------------------------------------------------------------------------------------- 64echo PHP_EOL,str_repeat('-', 80),PHP_EOL,'Time: ',$timer->getPageLoadTime(),' - Memory: ',$timer->getMemoryUsage(1),PHP_EOL,str_repeat('-', 80),PHP_EOL; 65