protected function __construct() { $this->db = VDB::singleton(); // Only check for new tables at / if (!isset($_REQUEST['state'])) { $this->createTableIfNotExists(); } $this->setSaveHandlers(); session_start(); }
// 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")) {
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(); }