function connect_to_database() { global $mysqlc, $prefs; if ($mysqlc !== null) { debuglog("AWOOOGA! ATTEMPTING MULTIPLE DATABASE CONNECTIONS!", "MYSQL", 1); return; } try { $dsn = "mysql:host=" . $prefs['mysql_host'] . ";port=" . $prefs['mysql_port'] . ";dbname=" . $prefs['mysql_database']; $mysqlc = new PDO($dsn, $prefs['mysql_user'], $prefs['mysql_password']); debuglog("Connected to MySQL", "SQL_CONNECT", 8); } catch (Exception $e) { debuglog("Database connect failure - " . $e, "SQL_CONNECT", 1); sql_init_fail($e->getMessage()); } }
function connect_to_database() { global $mysqlc, $prefs; if ($mysqlc !== null) { debuglog("AWOOOGA! ATTEMPTING MULTIPLE DATABASE CONNECTIONS!", "SQLITE", 1); return; } try { $dsn = "sqlite:prefs/collection_" . $prefs['player_backend'] . ".sq3"; $mysqlc = new PDO($dsn); debuglog("Connected to SQLite", "MYSQL", 8); // This, apparently, increases performance generic_sql_query('PRAGMA journal_mode=MEMORY', false, true); generic_sql_query('PRAGMA cache_size=4000', false, true); generic_sql_query('PRAGMA synchronous=OFF', false, true); generic_sql_query('PRAGMA threads=4', false, true); } catch (Exception $e) { debuglog("Couldn't Connect To SQLite - " . $e, "MYSQL", 1); sql_init_fail($e->getMessage()); } }
$prefs['collection_type'] = "sqlite"; } include "backends/sql/connect.php"; if (array_key_exists('collection_type', $prefs)) { connect_to_database(); } else { probe_database(); include "backends/sql/" . $prefs['collection_type'] . "/specifics.php"; } if (!$mysqlc) { sql_init_fail(); } savePrefs(); list($result, $message) = check_sql_tables(); if ($result == false) { sql_init_fail($message); } // // Do some initialisation and cleanup of the Apache backend // include "includes/firstrun.php"; debuglog("Initialisation done. Let's Boogie!", "INIT", 9); debuglog("=================****==================", "STARTED UP", 2); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <head> <title>RompR</title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <link rel="shortcut icon" sizes="196x196" href="newimages/favicon-196.png" />