<?php
// be aware of too big files
// they will cause a memory error
// lookin forward to handle this
include('securesqlite.class.php');
/**
* connect to encrypted SQLite db
*/
try {
// if there is no database with this name it will be created
// it will create a database like yourDatabase.encrypted.db
// and it will use a decrypted database like yourDatabase.db
$db = new secureSQLite('yourDatabase.db','YourKeyForEn-AndDecryption');
} catch(Exception $e) {
die(dPrint($e->getMessage()));
}
// create a table
$db->query("CREATE TABLE IF NOT EXISTS `test_table` (`name` VARCHAR( 20 ) NOT NULL)");
// close and save encrypted db
// if you close db without parameter "true" it won't save changes
// YOU SHOULD ALWAYS CLOSE THE CONNECTION TO REMOVE THE DECRYPTED DATABASE
$db->close(true);
?>
|