Browse Source

Added DB_DSN

pull/40/head
Savetheinternet 13 years ago
parent
commit
796a544560
  1. 5
      inc/config.php
  2. 5
      inc/database.php

5
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);

5
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();

Loading…
Cancel
Save