Use our own error handler for PHP errors and warnings
authorarjen <arjen>
Thu, 13 Feb 2003 08:59:52 +0000 (08:59 +0000)
committerarjen <arjen>
Thu, 13 Feb 2003 08:59:52 +0000 (08:59 +0000)
src/web/page.class.php

index 81598be..b823aee 100644 (file)
@@ -8,7 +8,7 @@
 ***********************
 **      FILE NAME      : page.class.php
 **      SYSTEM NAME    : Gnucomo - Gnu Computer Monitoring
-**      VERSION NUMBER : $Revision: 1.1 $
+**      VERSION NUMBER : $Revision: 1.2 $
 **
 **  DESCRIPTION      : Base class for Gnucomo web interface pages.
 **
 
 /*****************************
    $Log: page.class.php,v $
-   Revision 1.1  2003-02-05 09:38:42  arjen
+   Revision 1.2  2003-02-13 08:59:52  arjen
+   Use our own error handler for PHP errors and warnings
+
+   Revision 1.1  2003/02/05 09:38:42  arjen
    A base class for all web interface pages
 
 ******************************/
 
-// RCSID = "$Id: page.class.php,v 1.1 2003-02-05 09:38:42 arjen Exp $";
+// RCSID = "$Id: page.class.php,v 1.2 2003-02-13 08:59:52 arjen Exp $";
 
 
 require_once('gnucomo_config.php');
 
+$last_error = "&nbsp;";
+
+function error($errno, $errstr, $errfile, $errline)
+{
+   global $last_error;
+
+   $last_error = $errstr;
+}
+
 function login_form()
 {
+   global $last_error;
+
 ?>
    <div class='login'>
    <h1 align="center">GNU Computer Monitoring</h1>
-   <h4 align="center"><i>Version 0.0.4, Februari 05, 2003</i></h4>
+   <h4 align="center"><i>Version 0.0.5, Februari 08, 2003</i></h4>
+   <p>
+      <h2 class='error'><?php echo $last_error?></h2>
+   </p>
    <center><table>
    <tr>
    <td width='50%'><img src='logo.png' alt='GnoCoMo logo'></td>
@@ -83,6 +100,7 @@ class page
       $this->database = false;
       $this->path = $path;
       session_start();
+      set_error_handler("error");
    }
 
    function Head()