Added DB_DSN
This commit is contained in:
parent
ebed5b55db
commit
796a544560
@ -11,7 +11,8 @@
|
|||||||
|
|
||||||
// Database stuff
|
// 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);
|
define('DB_TYPE', 'mysql', true);
|
||||||
// Hostname or IP address
|
// Hostname or IP address
|
||||||
define('DB_SERVER', 'localhost', true);
|
define('DB_SERVER', 'localhost', true);
|
||||||
@ -20,6 +21,8 @@
|
|||||||
define('DB_PASSWORD', '', true);
|
define('DB_PASSWORD', '', true);
|
||||||
// TinyBoard database
|
// TinyBoard database
|
||||||
define('DB_DATABASE', '', true);
|
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)
|
// The name of the session cookie (PHP's $_SESSION)
|
||||||
define('SESS_COOKIE', 'imgboard', true);
|
define('SESS_COOKIE', 'imgboard', true);
|
||||||
|
@ -4,8 +4,11 @@
|
|||||||
global $pdo;
|
global $pdo;
|
||||||
if($pdo) return true;
|
if($pdo) return true;
|
||||||
|
|
||||||
|
$dsn = DB_TYPE . ':host=' . DB_SERVER . ';dbname=' . DB_DATABASE;
|
||||||
|
if(!empty($dsn))
|
||||||
|
$dsn .= ';' . DB_DSN;
|
||||||
try {
|
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) {
|
} catch(PDOException $e) {
|
||||||
$message = $e->getMessage();
|
$message = $e->getMessage();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user