Location: PHPKode > scripts > zregistry > registry.php
<?php
class registry {
	private $db;

	function __construct($location, $mode = 666) {
		if (extension_loaded ( 'sqlite' )) {			
			if ($this->db = sqlite_open ( $location, $mode, $sqliteerror )) {
				$result = sqlite_array_query($this->db, 'SELECT name from SQLITE_MASTER');
							
				if(!$result){
					$query = 'CREATE TABLE registry(reg_key text, reg_value text)';
					sqlite_query($this->db, $query);
				}
			} else {
				die($sqliteerror);
			}
		} else {
			die('sqlite extension not loaded');
		}
	}
	
	public function getValue($reg_key) {
		$result = sqlite_single_query($this->db, 'SELECT reg_value FROM registry WHERE reg_key == "'.$reg_key.'"');
		return $result;
	}
	
	public function setValue($reg_key, $reg_value) {
		$result = sqlite_query($this->db, 'SELECT * FROM registry WHERE reg_key == "'.$reg_key.'"');
		if(sqlite_num_rows($result) == 0){
			sqlite_query($this->db, 'INSERT INTO registry(reg_key, reg_value) VALUES ("'.$reg_key.'", "'.$reg_value.'")');
		} else {
			sqlite_query($this->db, 'UPDATE registry SET reg_value = "'.$reg_value.'" WHERE reg_key = "'.$reg_key.'"');
		}
	}
	
	public function dropKey($reg_key){
		$result = sqlite_query($this->db, 'DELETE FROM registry WHERE reg_key = "'.$reg_key.'"');
	}
}
Return current item: zregistry