inc/database.inc.php
changeset 1 58094faf794d
child 4 55ed92aa7cf5
equal deleted inserted replaced
0:2cd8c1649ba9 1:58094faf794d
       
     1 <?
       
     2 
       
     3 // +--------------------------------------------------------------------+
       
     4 // | PowerAdmin								|
       
     5 // +--------------------------------------------------------------------+
       
     6 // | Copyright (c) 1997-2002 The PowerAdmin Team			|
       
     7 // +--------------------------------------------------------------------+
       
     8 // | This source file is subject to the license carried by the overal	|
       
     9 // | program PowerAdmin as found on http://poweradmin.sf.net		|
       
    10 // | The PowerAdmin program falls under the QPL License:		|
       
    11 // | http://www.trolltech.com/developer/licensing/qpl.html		|
       
    12 // +--------------------------------------------------------------------+
       
    13 // | Authors: Roeland Nieuwenhuis <trancer <AT> trancer <DOT> nl>	|
       
    14 // |          Sjeemz <sjeemz <AT> sjeemz <DOT> nl>			|
       
    15 // +--------------------------------------------------------------------+
       
    16 
       
    17 // Filename: auth.inc.php
       
    18 // Startdate: 26-10-2002
       
    19 // Description: Constructs the database class.
       
    20 //
       
    21 // $Id: database.inc.php,v 1.3 2002/12/27 02:45:08 azurazu Exp $
       
    22 //
       
    23 
       
    24 require_once("dal.inc.php");
       
    25 
       
    26 function dbError($msg)
       
    27 {
       
    28         // General function for printing critical errors.
       
    29         include_once("header.inc.php");
       
    30         ?>
       
    31         <P><TABLE CLASS="error"><TR><TD CLASS="error"><H2>Oops! An error occured!</H2>
       
    32         <BR>
       
    33         <FONT STYLE="font-weight: Bold"><?= $msg->getDebugInfo(); ?><BR><BR><a href="javascript:history.go(-1)">&lt;&lt; back</a></FONT><BR></TD></TR></TABLE></P>
       
    34         <?
       
    35         die();
       
    36 }
       
    37 
       
    38 // Setup error handling.
       
    39 PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, 'dbError');
       
    40 
       
    41 //$dsn = "mysql://padev:blapadev@localhost/padev" ;
       
    42 $dsn = "$dbdsntype://$dbuser:$dbpass@$dbhost/$dbdatabase";
       
    43 $db = DB::connect($dsn);
       
    44 
       
    45 if (DB::isError($db))
       
    46 {
       
    47 	// Error handling should be put.
       
    48         error(MYSQL_ERROR_FATAL, $db->getMessage());
       
    49 }
       
    50 
       
    51 // Do an ASSOC fetch. Gives us the ability to use ["id"] fields.
       
    52 $db->setFetchMode(DB_FETCHMODE_ASSOC);
       
    53 
       
    54 
       
    55 /* erase info */
       
    56 $mysql_pass = $dsn = '';
       
    57 
       
    58 
       
    59 ?>