Exemple #1
0
 public static function singleton()
 {
     if (self::$_instance === null) {
         // Let exceptions bubble up for now
         self::$_instance = new PDO('mysql:dbname=' . $GLOBALS['mysql_db'] . ';host=' . $GLOBALS['mysql_host'], $GLOBALS['mysql_user'], $GLOBALS['mysql_pass']);
     }
     return self::$_instance;
 }
Exemple #2
0
 protected function __construct()
 {
     $this->db = VDB::singleton();
     // Only check for new tables at /
     if (!isset($_REQUEST['state'])) {
         $this->createTableIfNotExists();
     }
     $this->setSaveHandlers();
     session_start();
 }
Exemple #3
0
// Build config file if not already present
if (!file_exists('src/config.php')) {
    require_once 'src/build_config.php';
}
// Get configuration settings
require 'src/config.php';
// Set version
$smarty->assign('version', $version);
// Get functions
require 'src/functions.php';
// Get IPv6 Functions
require_once 'src/Net/IPv6.php';
// Get PDO wrapper and connect
require_once 'src/VDB.php';
try {
    $pdo = VDB::singleton();
} catch (Exception $e) {
    echo "Error connecting to database: " . $e->getMessage();
    exit;
}
// Make sure the private_dirs exist and are writable
if (!is_writable($session_dir)) {
    die("Error: {$session_dir} is not writabale.  Please read INSTALL");
}
if (!is_writable("{$private_dirs}/templates_c")) {
    die("Error: {$private_dirs}/templates_c is not writabale.  Please read INSTALL");
}
if (!is_writable("{$private_dirs}/configs")) {
    die("Error: {$private_dirs}/configs is not writabale.  Please read INSTALL");
}
if (!is_writable("{$private_dirs}/cache")) {
Exemple #4
0
function get_account_info($id)
{
    $pdo = VDB::singleton();
    $q = "select * from accounts where cid={$id}";
    $result = $pdo->query("select * from accounts where cid={$id}") or die(print_r($pdo->errorInfo()));
    return $result->fetch();
}