bernd
Logger mit Logleveln
bernd commited 3048f62 at 2009-09-14 13:31:08
<?php
require_once('inc/db_connect.php');
function config($key)
{
global $config;
if (array_key_exists($key, $config))
return $config[$key];
else
logger(LOG_ERR, "inc/base", "config", "Request to read nonexistant config option »{$key}«.");
return NULL;
}
function db_query($query)
{
DEBUG($query);
$result = @mysql_query($query);
if (mysql_error())
{
$error = mysql_error();
logger(LOG_ERR, "inc/base", "dberror", "mysql error: {$error}");
system_failure('Interner Datenbankfehler: »'.iconv('ISO-8859-1', 'UTF-8', $error).'«.');
}
$count = @mysql_num_rows($result);
if (! $count)
$count = 'no';
DEBUG("=> {$count} rows");
return $result;
}
function maybe_null($value)
{
if ($value == NULL)
return 'NULL';
if (strlen( (string) $value ) > 0)
return "'".mysql_real_escape_string($value)."'";
else
return 'NULL';
}
#define('LOG_ERR', 3);
#define('LOG_WARNING', 4);
#define('LOG_INFO', 6);
function logger($severity, $scriptname, $scope, $message)
 
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX