48 lines
1.3 KiB
PHP
48 lines
1.3 KiB
PHP
<?php
|
|
|
|
$db = ""; // Connection zu DB
|
|
$error = ""; // Fehlermeldung beim Verbinden mit DB
|
|
if( $_SERVER['SERVER_NAME'] == "localhost" ) {
|
|
$fulldir = "/homepage/klausfriese/p3/";
|
|
$dbhost = "localhost";
|
|
$dbuser = "root";
|
|
$dbname = "panoramicum";
|
|
$dbpassword = "passatl";
|
|
} else {
|
|
$fulldir = "/var/www/vhosts/klausfriese.de/httpdocs";
|
|
$dbhost = "localhost";
|
|
$dbuser = "panoramicum";
|
|
$dbname = "panoramicum";
|
|
$dbpassword = "202WQi42)Gp2-69H";
|
|
}
|
|
|
|
// ----------------------------------------------------------------------------
|
|
// 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);
|
|
} |