Example #1
0
 function __construct()
 {
     parent::__construct();
     $table = 'lib_statistics';
     $sqlite = new sqlite($table);
     $this->sqlite = $sqlite;
     $data = $sqlite->select();
     if (isset($_SERVER['HTTP_USER_AGENT'])) {
         $this->user_agent = $_SERVER['HTTP_USER_AGENT'];
         $this->language = $_SERVER['HTTP_ACCEPT_LANGUAGE'];
     } else {
         $this->user_agent = 'UPDATING';
         $this->language = 'UPDATING';
     }
     if (!$data) {
         $stmt = "CREATE TABLE IF NOT EXISTS {$table} (\n\t\t\t\t\t\tid INTEGER NOT NULL,\n\t\t\t\t\t\tip TEXT(15) NOT NULL,\n\t\t\t\t\t\tuser_agent TEXT(100) NOT NULL,\n\t\t\t\t\t\tlanguage TEXT(100) NOT NULL,\n\t\t\t\t\t\tfirst_access TEXT(19) NOT NULL,\n\t\t\t\t\t\tlast_access TEXT(19) NOT NULL,\n\t\t\t\t\t\tPRIMARY KEY ('id')\n\t\t\t\t\t);";
         $sqlite->exec($stmt);
     }
     $data = $sqlite->selectWhere('ip = "' . $_SERVER['REMOTE_ADDR'] . '"');
     if (!$data) {
         $this->insert();
     } else {
         if ($data['user_agent'] != $this->user_agent) {
             $this->insert();
         } else {
             $this->update($data['id']);
         }
     }
 }
 public static function delete()
 {
     $input = json_decode(file_get_contents('php://input'));
     $statement = 'DELETE FROM tasks WHERE taskId = :taskId';
     $parameters = array(':taskId' => $input->taskId);
     $sqlite = new sqlite();
     return $sqlite->exec($statement, $parameters);
 }
Example #3
0
 public function valid_token()
 {
     // Get input
     $input = json_decode(file_get_contents('php://input'));
     // Run SQL
     $sqlite = new sqlite();
     // Validate
     $validated = $sqlite->query('SELECT * FROM tokens WHERE username = :username and token = :token', array('username' => $input->username, 'token' => $input->token));
     // If validated
     if ($validated) {
         return true;
     } else {
         return false;
     }
 }
 function __construct($dbPath)
 {
     $this->dbVersion = 2;
     if ($dbPath == ':memory:') {
         $this->readOnly = false;
     } else {
         $this->readOnly = !is_writable($dbPath);
     }
     parent::__construct($dbPath);
     $this->connect($dbPath);
 }
Example #5
0
 public static function &get_connection($arg_str_dbprofile = DEFAULT_DBPROFILE, $arg_database_engine = DB_ENGINE)
 {
     if ($arg_database_engine == "mysql") {
         $db =& mysql::get_connection($arg_str_dbprofile);
     } else {
         if ($arg_database_engine == "mysqli") {
             $db =& mysqli::get_connection($arg_str_dbprofile);
         } else {
             if ($arg_database_engine == "sqlite") {
                 $db =& sqlite::get_connection($arg_str_dbprofile);
             }
         }
     }
     return $db;
 }
Example #6
0
 function sqlite3($dbPath)
 {
     $this->dbVersion = 3;
     if ($dbPath == ':memory:') {
         $this->readOnly = false;
     } else {
         $this->readOnly = !is_writable($dbPath);
     }
     parent::sqlite($dbPath);
     if (class_exists('PDO') && $this->connect($dbPath)) {
         return $this->connId;
     } else {
         $this->getError();
         return false;
     }
 }
 function sqliteGetInstance($dbPath, $forceVersion = null)
 {
     if (!$forceVersion) {
         if ($dbPath == ':memory:') {
             $dbVersion = min($GLOBALS['sqliteVersionAvailable']);
         } else {
             $dbVersion = sqlite::getDbVersion($dbPath);
         }
     } else {
         $dbVersion = $forceVersion;
     }
     if ($dbVersion && ($dbVersion == 2 || $dbVersion == 3)) {
         include_once INCLUDE_LIB . 'sqlite' . $dbVersion . '.class.php';
         $classObj = 'sqlite' . $dbVersion;
         return new $classObj($dbPath);
     } else {
         return false;
     }
 }
Example #8
0
<?php

if (!isset($_SERVER['HTTP_X_REQUESTED_WITH'])) {
    die;
}
require_once '../classes/sqlite.php';
require_once '../classes/security.php';
require_once '../classes/template.php';
$db = new sqlite('../db/' . $_POST['db'], 'list');
$deleted = $db->del('id', escape_num($_POST['id']));
echo $deleted;
Example #9
0
<?php

/*
	By Nick Sheffield
	nick@nicksheffield.com
*/
require_once 'classes/sqlite.php';
require_once 'classes/security.php';
require_once 'classes/template.php';
$database = isset($_GET['db']) ? $_GET['db'] : 'todo';
$db = new sqlite('db/' . $database);
$posts = $db->get('id, content, date, complete');
$db->table('title');
$title = $db->get('name');
?>
<!DOCTYPE html>	
<html lang="en">
<head>
	<meta charset="utf-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="viewport" content="width=device-width, initial-scale=1">

	<title><?php 
echo $title[0]['name'];
?>
</title>
	
	<link rel="shortcut icon" href="assets/images/favicon.ico" />
	<link href='http://fonts.googleapis.com/css?family=Roboto:400,300,500|Roboto+Slab:400,300,100|Bad+Script|Source+Sans+Pro:200,300,400' rel='stylesheet' type='text/css'>
	<link rel="stylesheet" href="assets/css/style.css" />
</head>
 private function coreConfigDelete()
 {
     $ad = $this->activeDirectory[$_GET['delete']];
     $class = new sqlite('activedirectory');
     $class->delete($_GET['delete']);
     echo "<meta HTTP-EQUIV='Refresh' CONTENT='0;URL={$this->addr}'>";
 }
Example #11
0
<?php

if (!isset($_SERVER['HTTP_X_REQUESTED_WITH'])) {
    die;
}
require_once '../classes/sqlite.php';
require_once '../classes/security.php';
require_once '../classes/template.php';
$db = new sqlite('../db/' . $_POST['db'], 'title');
$db->where('id', 1);
$updated = $db->update(array('name' => escape_str($_POST['name'])));
echo $updated;
Example #12
0
 public static function dump_to_screen($table)
 {
     $sqlite = new sqlite();
     $data = $sqlite->query("SELECT * FROM {$table}");
     $data = json_decode(json_encode($data), true);
     //print_r($data);
     return $data;
 }
 function getTabDb()
 {
     $this->tabDb = array();
     $tempTabDb = $GLOBALS["db"]->array_query("SELECT id, name, location FROM database", SQLITE_ASSOC);
     foreach ($tempTabDb as $tabDbInfo) {
         if (sqlite::getDbVersion($tabDbInfo['location']) == $this->connId->connId->getVersion()) {
             $this->tabDb[] = $tabDbInfo;
         }
     }
     return $this->tabDb;
 }
Example #14
0
<?php

if (!isset($_SERVER['HTTP_X_REQUESTED_WITH'])) {
    die;
}
require_once '../classes/sqlite.php';
require_once '../classes/security.php';
require_once '../classes/template.php';
date_default_timezone_set('Pacific/Auckland');
$db = new sqlite('../db/' . $_POST['db'], 'list');
$content = escape_str($_POST['content']);
$date = gmdate('c');
$inserted = $db->insert(array('content' => $content, 'date' => $date));
if ($inserted) {
    Template::make_new(array('id' => $db->last_insert, 'content' => $content, 'date' => $date));
}
 public static function create_table()
 {
     $sqlite = new sqlite();
     return $sqlite->exec("\n            create table users (\n            UserId INTEGER PRIMARY KEY,\n            Username varchar(255) NULL DEFAULT '',\n            Password  varchar(255) NULL DEFAULT ''\n            )\n        ");
 }
Example #16
0
</div>
	<div class="base" align="center" style="margin-top: 5px;">
	<a href="index.php" class="base" target="_parent"><?php 
echo $traduct->get(1);
?>
</a>
	</div>
	<table class="main" width="100%" border="0" cellspacing="0" cellpadding="0">
<?php 
include_once INCLUDE_LIB . 'sqlite.class.php';
$query = "SELECT * FROM database ORDER BY name";
$tabDb = $db->array_query($query, SQLITE_ASSOC);
if (is_array($tabDb)) {
    foreach ($tabDb as $ligne) {
        // get Database version
        $versionNum = sqlite::getDbVersion($ligne["location"]);
        $dbPics = 'database';
        if (in_array($ligne['id'], $attachDbList)) {
            $dbPics .= '_link';
        } else {
            $dbPics .= $versionNum;
        }
        $dbPics .= '.png';
        if (isset($tempDb) && is_object($tempDb)) {
            if ($tempDb->dbVersion == 2) {
                $tempDb->close();
            } else {
                $tempDb = null;
            }
        }
        echo "\n\t" . '<tr class="database" style="vertical-align: middle">' . "\n\t\t" . '<td class="img_db" width="18">' . displayPics($dbPics, '', 0, 20) . '</td>' . "\n\t\t" . '<td class="name_db"><a href="index.php?dbsel=' . $ligne['id'] . '" target="_parent" class="dbsel">' . $ligne['name'] . '</a></td>' . "\n\t" . '</tr>';
 public static function create_table()
 {
     $sqlite = new sqlite();
     return $sqlite->exec("\n            create table tokens (\n            tokenid   INTEGER PRIMARY KEY,\n            username  varchar(255) NULL DEFAULT '',\n            token     varchar(255) NULL DEFAULT '',\n            timestamp DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL\n            )\n        ");
 }
Example #18
0
<?php

if (!isset($_SERVER['HTTP_X_REQUESTED_WITH'])) {
    die;
}
require_once '../classes/sqlite.php';
require_once '../classes/security.php';
require_once '../classes/template.php';
$db = new sqlite('../db/' . $_POST['db'], 'list');
$db->where('id', escape_num($_POST['id']));
$updated = $db->update(array('content' => $_POST['content']));
echo $updated;
Example #19
0
 /**
  * 设置debug开关
  *
  * @static
  * @access public
  * @param boolean $switch 开关
  */
 public static function setDebug($switch)
 {
     self::$debug = $switch;
 }