Login   Register  
PHP Classes
elePHPant
Icontem

File: example.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Sven Dunemann  >  Secure SQLite  >  example.php  >  Download  
File: example.php
Role: Example script
Content type: text/plain
Description: Example of class usage
Class: Secure SQLite
Access encrypted SQLite database files
Author: By
Last change: information added
Date: 2011-08-16 00:03
Size: 840 bytes
 

Contents

Class file image Download
<?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);                        
?>