Subversion Repositories svnkaklik

Rev

Details | Last modification | View Log

Rev Author Line No. Line
36 kaklik 1
<?php
2
 
3
// will need include of config.php
4
include_once('config.php');
5
include_once('adodb/adodb.inc.php');
6
 
7
function getdb()
8
{
9
    global $cfg;
10
 
11
    // 2004-12-09 PFM: connect to database.
12
    $db = NewADOConnection($cfg["db_type"]);
13
    $db->Connect($cfg["db_host"], $cfg["db_user"], $cfg["db_pass"], $cfg["db_name"]);
14
    if(!$db)
15
    {
16
        die ('Could not connect to database: '.$db->ErrorMsg().'<br>Check your database settings in the config.php file.');
17
    }
18
    return $db;
19
}
20
 
21
function showError($db, $sql)
22
{
23
    global $cfg;
24
    if($db->ErrorNo() != 0)
25
    {
26
        include("themes/matrix/index.php");
27
?>
28
<!DOCTYPE html
29
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
30
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
31
<html xmlns="http://www.w3.org/1999/xhtml">
32
<head>
33
        <title><?php echo $cfg["pagetitle"] ?></title>
34
        <link rel="StyleSheet" href="themes/matrix/style.css" type="text/css" />
35
    <meta http-equiv="pragma" content="no-cache" />
36
    <meta content="charset=iso-8859-1" />
37
 
38
</head>
39
<body bgcolor="<?php echo $cfg["main_bgcolor"] ?>">
40
<br /><br /><br />
41
<div align="center">
42
    <table border="1" bordercolor="<?php echo $cfg["table_border_dk"] ?>" cellpadding="0" cellspacing="0">
43
    <tr>
44
        <td>
45
        <table border="0" cellpadding="4" cellspacing="0" width="100%">
46
            <tr>
47
                    <td align="left" background="themes/matrix/images/bar.gif" bgcolor="<?php echo $cfg["main_bgcolor"] ?>">
48
                    <font class="title"><?php echo $cfg["pagetitle"] ?> Database/SQL Error</font>
49
                    </td>
50
            </tr>
51
        </table>
52
        </td>
53
    </tr>
54
    <tr>
55
        <td bgcolor="<?php echo $cfg["table_header_bg"] ?>">
56
        <div align="center">
57
        <table width="100%" bgcolor="<?php echo $cfg["body_data_bg"] ?>">
58
         <tr>
59
             <td>
60
             <table bgcolor="<?php echo $cfg["body_data_bg"] ?>" width="740 pixels" cellpadding="1">
61
             <tr>
62
                 <td>
63
                    <div align="center">
64
                     <table border="0" cellpadding="4" cellspacing="0" width="90%">
65
                     <tr>
66
                     <td>
67
<?php
68
                    if ($cfg["debug_sql"])
69
                    {
70
                        echo "Debug SQL is on. <br><br>SQL: <strong>".$sql."</strong><br><br><br>";
71
                    }
72
                    echo "Database error: <strong>".$db->ErrorMsg()."</strong><br><br>";
73
                    echo "Always check your database variables in the config.php file.<br><br>"
74
?>
75
                    </td>
76
                    </tr>
77
                    </table>
78
                    </div>
79
                </td>
80
            </tr>
81
            </table>
82
            </td>
83
        </tr>
84
        </table>
85
        </div>
86
        </td>
87
    </tr>
88
    </table>
89
 
90
</div>
91
 
92
<?php
93
        exit();
94
    }
95
}
96
?>