<?php
/*=======================================================================
 *
 * dbconnect.inc.php
 *
 * Autor: Marc Vollmann
 *
 =======================================================================*/


include_once ("../include/glob_defs.inc.php");

/**
 * Zuweisung zur Variable $dsn je nach benutzter Datenquelle aus-/kommentieren
 */

if ($phpVersion >= "5.1") :
   date_default_timezone_set('Europe/Berlin');
endif;

include_once ("../lib/inc_lib_db.inc.php");

$dbCreds = array("dbHost" => $dbhostOnly, "dbUser" => $dblogin, "dbPassword" => $dbpassword, "dbName" => $dbname, "dbPort" => $dbport, "dbTable" => "user");

$db = new DB($dbCreds);

$db->dbQ('SET NAMES latin1');
$db->dbQ('SET @@SESSION.old_passwords=0');


/*
require "../PEAR/DB.php";

$dsn = array('phptype'  => 'mysqli', 
             'username' => $dblogin,
             'password' => $dbpassword,
             'hostspec' => $dbhostOnly,
             'port'     => $dbport,
             'database' => $dbname);

$dbOptions = array('ssl' => true);

$db =& MDB2::connect($dsn, $dbOptions);
if (DB::isError($db))
    die ("$PHP_SELF: " . $db->getMessage());

$db->setFetchMode(MDB2_FETCHMODE_ASSOC);
$db->query('SET NAMES latin1');
$db->query('SET @@SESSION.old_passwords=0');

// Loading the Function module
// $db->loadModule('Function');
$db->loadModule('Extended', null, false);

// Transaction savepoint stack and global counter (e.g. for function TA())
// $TA_SavepointStack = array();
// $TA_SavepointCounter = 0;
*/

$db2 = $db;

// Wrapper for deprecated DB functions
if ($phpVersion >= "7.0") :
   function mysql_escape_string($string) { global $db; return $db->escape($string); };
endif;

?>
