<?php 

$db = "";		// Connection zu DB
$error = "";		// Fehlermeldung beim Verbinden mit DB
	if( $_SERVER['SERVER_NAME'] == "localhost" ) {
		$fulldir = "/homepage/panoramicum/p3/";
		$dbhost = "localhost";
		$dbuser = "root";
		$dbname = "panoramicum";
		$dbpassword = "passatl";
	} else {
		$fulldir = "/var/www/panoramicum.de/p3/";
		$dbhost = "localhost";
		$dbuser = "panoramicum";
		$dbname = "panoramicum";
		$dbpassword = "krokanT!";
	}

// ----------------------------------------------------------------------------
// Verbindung aufbauen readwrite
// IN:
// OUT:
//  Error-string
function DBConnect() {
	global $dbhost,$dbuser,$dbpassword,$dbname,$db;

	try {
	    $db = new PDO('mysql:host=' . $dbhost. ';dbname=' . $dbname . ';charset=utf8', $dbuser, $dbpassword);
	} catch (PDOException $ex) {
	    die('Die Datenbank ist momentan nicht erreichbar. ($dbhost/$dbuser/'.$_SERVER['SERVER_NAME'].')' . htmlspecialchars($ex->getMessage() ) );
	}
}

// ----------------------------------------------------------------------------
// Verbindungen schliessen
// IN: -
// OUT: -
function DBClose() {
  // Freigeben des Resultsets
}

function repl( $txt , $in , $out ) {
	return preg_replace( $in, $out, $txt , 1 );
}

function br2nl($str) {
    return preg_replace("=<br(>|([\s/][^>]*)>)\r?\n?=i", "\n", $str);
}