bernd
add a function to handle redirections
bernd commited a1bdbea at 2009-12-08 15:22:51
<?php
require_once('inc/db_connect.php');
require_once('inc/debug.php');
function config($key)
{
global $config;
if (array_key_exists($key, $config))
return $config[$key];
/* read configuration from database */
$options = db_query( "SELECT `key`, value FROM misc.config" );
while( $object = mysql_fetch_assoc( $options ) ) {
$config[$object['key']]=$object['value'];
}
DEBUG($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 redirect($target)
{
global $debugmode;
if (! $debugmode)
header("Location: {$target}");
die();
}
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;
}
 
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX