<?php
if (!defined('WBLEGAL')) die('Kann nicht ohne Personal WebBase ausgeführt werden.');
function db_connect()
{
global $WBConfig;
global $wb_selc;
global $wb_conn;
if ($WBConfig->getMySQLPort() != '')
$zus = ':'.$WBConfig->getMySQLPort();
else
$zus = '';
if ($WBConfig->getMySQLUseMySQLI()) {
$wb_conn = @mysqli_connect($WBConfig->getMySQLServer().$zus, $WBConfig->getMySQLUsername(), $WBConfig->getMySQLPassword());
} else {
$wb_conn = @mysql_connect($WBConfig->getMySQLServer().$zus, $WBConfig->getMySQLUsername(), $WBConfig->getMySQLPassword());
}
if ((!$wb_selc) || (!$wb_conn))
die('<h1>Fehler</h1>Es konnte keine Verbindung zu dem Datenbankserver hergestellt werden.<br><br>Bitte prüfen Sie den Serverstatus und die Gültigkeit der Konfigurationsdatei "includes/config.inc.php".<br><br>MySQL meldet folgendes:<br><br><code>'.mysql_errno().': '.mysql_error().'</code>');
}
function db_query($inp, $halte_an_bei_fehler = true)
{
global $configuration;
global $WBConfig;
dbg_log_db_query($inp);
global $mysql_count;
$mysql_count++;
$ss = getmicrotime();
}
if ($WBConfig->getMySQLUseMySQLI())
else
$ee = getmicrotime();
global $mysql_time;
$mysql_time += $ee-$ss;
}
if ($halte_an_bei_fehler)
{
if ($WBConfig->getMySQLUseMySQLI())
else
if ($e != '')
{
$mess = '<b>MySQL-Fehler!</b><br><br>Folgender MySQL-Fehler ist aufgetreten:<br><br><code>'.$e.'</code><br><br>Folgende Query wurde ausgeführt:<br><br><code>'.htmlentities($inp).'</code><br><br>Die Scriptausführung wurde aus Sicherheitsgründen abgebrochen.';
global $modul;
global $m2;
$m = '';
if ((isset($modul)) && ($modul != ''))
$m = $modul;
else
$m = '';
if ((isset($m2)) && ($m2 != ''))
{
if ($m2 == '')
$z = $m2.'?';
else
$z = ' ('.$m2.'?)';
}
else
{
$z = '';
}
}
}
return $x;
}
function db_fetch($inp)
{
global $WBConfig;
if ($WBConfig->getMySQLUseMySQLI())
else
$ee = getmicrotime();
global $mysql_time;
$mysql_time += $ee-$ss;
}
}
function db_escape($inp)
{
global $WBConfig;
if ($WBConfig->getMySQLUseMySQLI())
else
}
function db_simple_escape($inp)
{
global $WBConfig;
if ($WBConfig->getMySQLUseMySQLI())
else
}
function db_num($inp)
{
global $WBConfig;
if ($WBConfig->getMySQLUseMySQLI())
else
}
function db_affected_rows()
{
global $WBConfig;
if ($WBConfig->getMySQLUseMySQLI())
else
}
function db_list_dbs()
{
global $WBConfig;
if ($WBConfig->getMySQLUseMySQLI())
return @mysqli_list_dbs();
else
}
function db_list_tables($db)
{
global $WBConfig;
if ($WBConfig->getMySQLUseMySQLI())
return @mysqli_list_tables($db);
else
}
function db_error()
{
global $WBConfig;
if ($WBConfig->getMySQLUseMySQLI())
else
}
function db_disconnect()
{
global $WBConfig;
if ($WBConfig->getMySQLUseMySQLI())
else
}
function db_time()
{
// Warum? Wenn die Zeit von PHP und MySQL verschieden ist (z.B. da auf unterschiedliche Server verteilt), gäbe es Probleme!
$res = db_query("SELECT NOW()");
$row = db_fetch($res);
return $row[0];
}
db_connect();
?>