summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--inc/config.php5
-rw-r--r--inc/database.php5
2 files changed, 8 insertions, 2 deletions
diff --git a/inc/config.php b/inc/config.php
index 2e605b0b..60c8d5c2 100644
--- a/inc/config.php
+++ b/inc/config.php
@@ -11,7 +11,8 @@
// Database stuff
- // "mysql", "pgsql", etc
+ // SQL driver ("mysql", "pgsql", "sqlite", "dblib", etc)
+ // http://www.php.net/manual/en/pdo.drivers.php
define('DB_TYPE', 'mysql', true);
// Hostname or IP address
define('DB_SERVER', 'localhost', true);
@@ -20,6 +21,8 @@
define('DB_PASSWORD', '', true);
// TinyBoard database
define('DB_DATABASE', '', true);
+ // Anything more to add to the DSN string (eg. port=xxx;foo=bar)
+ define('DB_DSN', '', true);
// The name of the session cookie (PHP's $_SESSION)
define('SESS_COOKIE', 'imgboard', true);
diff --git a/inc/database.php b/inc/database.php
index 8ffc9f84..e9780640 100644
--- a/inc/database.php
+++ b/inc/database.php
@@ -4,8 +4,11 @@
global $pdo;
if($pdo) return true;
+ $dsn = DB_TYPE . ':host=' . DB_SERVER . ';dbname=' . DB_DATABASE;
+ if(!empty($dsn))
+ $dsn .= ';' . DB_DSN;
try {
- return $pdo = new PDO(DB_TYPE . ':host=' . DB_SERVER . ';dbname=' . DB_DATABASE, DB_USER, DB_PASSWORD);
+ return $pdo = new PDO($dsn, DB_USER, DB_PASSWORD);
} catch(PDOException $e) {
$message = $e->getMessage();