fix login error handling
authorchriskl <chriskl>
Tue, 24 Dec 2002 04:03:29 +0000 (04:03 +0000)
committerchriskl <chriskl>
Tue, 24 Dec 2002 04:03:29 +0000 (04:03 +0000)
lang/english.php
libraries/adodb/adodb-postgres.inc.php
libraries/errorhandler.inc.php
public_html/login.php

index b8886ec242b38ae3ea52d435d1c7e45490bc8ad1..81d7e79c5eb87e236bc293101df2e73b625c71e4 100755 (executable)
@@ -4,7 +4,7 @@
         * Language template file for WebDB.  Use this to base language
         * files.
         *
-        * $Id: english.php,v 1.22 2002/12/24 02:44:21 chriskl Exp $
+        * $Id: english.php,v 1.23 2002/12/24 04:03:29 chriskl Exp $
         */
 
        $appLang = 'English';
@@ -12,6 +12,7 @@
 
        $strNoFrames = 'You need a frames-enabled browser to use this application.';
        $strLogin = 'Login';
+       $strLoginFailed = 'Login failed';
        $strNoTables = 'No tables found.';
        $strNoTable = 'No table found.';
        $strNoViews = 'No views found.';
index 28dae086721d51209b51c8572ffea6a63584c2dc..91c1ce98133a33e1e3863c54c3ce0998972a142e 100755 (executable)
@@ -190,7 +190,8 @@ a different OID if a database must be reloaded. */
                }\r
                \r
                //if ($user) $linea = "user=$user host=$linea password=$pwd dbname=$db port=5432";\r
-               $this->_connectionID = pg_connect($str);\r
+               $this->_connectionID = @pg_connect($str);\r
+\r
                if ($this->_connectionID === false) return false;\r
                $this->Execute("set datestyle='ISO'");\r
                 return true;\r
@@ -214,7 +215,7 @@ a different OID if a database must be reloaded. */
                        if ($pwd)  $str .= " password='{$pwd}'";\r
                        if ($db)   $str .= " dbname='{$db}'";\r
                }//print $str;\r
-               $this->_connectionID = pg_pconnect($str);\r
+               $this->_connectionID = @pg_pconnect($str);\r
                if ($this->_connectionID === false) return false;\r
                $this->Execute("set datestyle='ISO'");\r
                return true;\r
index 3a8308537be165bec99c1a0d597ca4e305ad6db5..217280213969652a549e63c0d8bf47715d2dd5c8 100644 (file)
@@ -3,7 +3,7 @@
 /**
  * Overrides default ADODB error handler to provide nicer error handling.
  *
- * $Id: errorhandler.inc.php,v 1.1 2002/12/22 15:01:32 chriskl Exp $
+ * $Id: errorhandler.inc.php,v 1.2 2002/12/24 04:03:29 chriskl Exp $
  */
 
 define('ADODB_ERROR_HANDLER','Error_Handler');
@@ -20,7 +20,7 @@ define('ADODB_ERROR_HANDLER','Error_Handler');
  */
 function Error_Handler($dbms, $fn, $errno, $errmsg, $p1=false, $p2=false)
 {
-       global $strSQLError, $strInStatement;
+       global $strSQLError, $strInStatement, $strLogin, $strLoginFailed;
 
        switch($fn) {
        case 'EXECUTE':
@@ -36,20 +36,14 @@ function Error_Handler($dbms, $fn, $errno, $errmsg, $p1=false, $p2=false)
 
        case 'PCONNECT':
        case 'CONNECT':
-               $host = $p1;
-               $database = $p2;
-
-               $s = "$dbms error: [$errno: $errmsg] in $fn($host, ?, ?, $database)\n";
-               /*
-               echo $s;
                include('../conf/config.inc.php');
+               $_failed = true;
                include($appBase . '/login.php');
                // Theme
                echo "<style type=\"text/css\">\n<!--\n";
                include("../themes/{$guiTheme}/global.css");
                echo "\n-->\n</style>\n";
                exit;
-               */
                break;
        default:
                $s = "$dbms error: [$errno: $errmsg] in $fn($p1, $p2)\n";
index d578477388dc0fe7a9b6b3e0e76995559ef3d9c9..a2c6887b30f3b0cd734eb2a104fed0071034667b 100755 (executable)
@@ -3,7 +3,7 @@
        /**
         * Login screen
         *
-        * $Id: login.php,v 1.7 2002/12/23 10:38:16 jmpoure Exp $
+        * $Id: login.php,v 1.8 2002/12/24 04:03:29 chriskl Exp $
         */
 
        // Include application functions
@@ -22,6 +22,7 @@
                                <td height="115" align="center" valign="middle">
                                        <center>
                                        <h1><?php echo $appName ?> <?php echo $strLogin ?></h1>
+                                       <?php if (isset($_failed) && $_failed) echo "<p class=\"message\">$strLoginFailed</p>" ?>
                                        <table class="navbar" border="0" cellpadding="5" cellspacing="3">
                                                <form action="<?php echo $_SERVER['PHP_SELF'] ?>" method="post" name="login_form">
                                                <tr>