1
|
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 |
|
8
|
24 |
require_once("MDB2.php"); |
1
|
25 |
|
|
26 |
function dbError($msg) |
|
27 |
{ |
|
28 |
// General function for printing critical errors. |
|
29 |
include_once("header.inc.php"); |
|
30 |
?> |
4
|
31 |
<P><TABLE CLASS="error"><TR><TD CLASS="error"><H2><? echo _('Oops! An error occured!'); ?></H2> |
1
|
32 |
<BR> |
4
|
33 |
<FONT STYLE="font-weight: Bold"><?= $msg->getDebugInfo(); ?><BR><BR><a href="javascript:history.go(-1)"><< <? echo _('back'); ?></a></FONT><BR></TD></TR></TABLE></P> |
1
|
34 |
<? |
|
35 |
die(); |
|
36 |
} |
|
37 |
|
|
38 |
PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, 'dbError'); |
|
39 |
|
|
40 |
$dsn = "$dbdsntype://$dbuser:$dbpass@$dbhost/$dbdatabase"; |
8
|
41 |
$db = MDB2::connect($dsn); |
1
|
42 |
|
8
|
43 |
if (MDB2::isError($db)) |
1
|
44 |
{ |
|
45 |
// Error handling should be put. |
|
46 |
error(MYSQL_ERROR_FATAL, $db->getMessage()); |
|
47 |
} |
|
48 |
|
|
49 |
// Do an ASSOC fetch. Gives us the ability to use ["id"] fields. |
8
|
50 |
$db->setFetchMode(MDB2_FETCHMODE_ASSOC); |
1
|
51 |
|
|
52 |
/* erase info */ |
|
53 |
$mysql_pass = $dsn = ''; |
|
54 |
|
|
55 |
|
|
56 |
?> |