Added "Login Incorrect" message in login form.
[gnucomo.git] / src / web / page.class.php
index 81598be..48ea4b8 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.12 $
 **
 **  DESCRIPTION      : Base class for Gnucomo web interface pages.
 **
 ********************************
 **      ORIGINAL AUTHOR : Arjen Baart - arjen@andromeda.nl
 **      CREATION DATE   : Jan 22, 2003
-**      LAST UPDATE     : Feb 03, 2003
+**      LAST UPDATE     : Jan 19, 2012
 **      MODIFICATIONS   : 
 **************************************************************************/
 
 /*****************************
    $Log: page.class.php,v $
-   Revision 1.1  2003-02-05 09:38:42  arjen
+   Revision 1.12  2007-12-12 09:11:06  arjen
+   Prepared for version 0.0.12
+
+   Revision 1.11  2007/11/21 14:40:48  arjen
+   New version number and release date.
+
+   Revision 1.10  2007/11/21 14:38:06  arjen
+   The buttonbar at the top of each page is now a fixed 'div' element
+   instead of a framed page.
+   Contributed by Edwin Nadorp.
+
+   Revision 1.9  2007/10/23 14:47:42  arjen
+   Prepared for release 0.0.10
+
+   Revision 1.8  2007/01/11 13:44:29  arjen
+   Manually edit parameters.
+   View logs from abusing IP addresses.
+
+   Revision 1.7  2003/12/24 07:41:23  arjen
+   Changed version number
+
+   Revision 1.6  2003/09/04 06:53:40  arjen
+   Prepared for release 0.0.8
+
+   Revision 1.5  2003/08/14 10:37:04  arjen
+   Prepared for release 0.0.7
+
+   Revision 1.4  2003/07/15 11:05:32  arjen
+   Chnaged version number to 0.0.6 in login form.
+
+   Revision 1.3  2003/02/19 09:12:27  arjen
+   Added the 'form' class on table and td elements. This class is intended
+   for borderless tables that are used to layout HTML forms.
+
+   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.12 2007-12-12 09:11:06 arjen Exp $";
 
 
 require_once('gnucomo_config.php');
 
+$last_error = " ";
+
+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>
-   <center><table>
+   <h4 align="center"><i>Version 0.0.12, December 12, 2007</i></h4>
+   <h2 class='error'><?php echo $last_error?></h2>
+   <center><table class='form'>
    <tr>
-   <td width='50%'><img src='logo.png' alt='GnoCoMo logo'></td>
-   <td><form name="login" method="POST">
-       <table>
+   <td width='50%' class='form'>
+      <a href='http://gnucomo.org/' target='_top'><img src='logo.png' alt='GnuCoMo logo'></a></td>
+   <td class='form'><form name="login" method="POST">
+       <table class='form'>
        <tr>
-       <td>Username</td>
-       <td><input type="text" name="username"></td>
+       <td class='form'>Username</td>
+       <td class='form'><input type="text" name="username"></td>
        </tr>
        <tr>
-       <td>Password</td>
-       <td><input type="password" name="password"></td>
+       <td class='form'>Password</td>
+       <td class='form'><input type="password" name="password"></td>
        </tr>
        <tr>
-       <td>&nbsp;</td>
-       <td align="right"><input type="submit" value="signin"></td>
+       <td class='form'>&nbsp;</td>
+       <td align="right" class='form'>
+          <input type="submit" value="signin">
+          <input type="reset" value="clear">
+       </td>
        </tr>
        </table>
        </form>
@@ -83,6 +136,7 @@ class page
       $this->database = false;
       $this->path = $path;
       session_start();
+      set_error_handler("error");
    }
 
    function Head()
@@ -100,12 +154,29 @@ class page
       <title><?php echo $this->the_title ?></title>
       </head>
       <body>
+        <div id="header">
+           <a href='index.php'><img src='small-logo.png' title='Gnucomo' alt='Gnucomo'></a>
+           <a href='objects.php'><img src='server.png' title='Objects' alt='Objects'></a>
+           <a href='users.php'><img src='user.png' title='Users' alt='Users'></a>
+           <a href='services.php'><img src='service.png' title='Services' alt='Services'></a>
+           <a href='issues.php'><img src='bell.png' title='Issues' alt='Issues'></a>
+           <a href='classes.php'><img src='change.png' title='Classes' alt='Classes'></a>
+           <!-- a href='notification2.php'>N2</a -->
+           <a href='logout.php'><img src='exit.png' title='Logout' alt='Logout'></a>
+        </div>
+
+        <div id="menu_title">&nbsp;</div>
+
+        <div id="content">
 <?php
    }
 
    function Body()
    {
-      echo "The default body.";
+      //echo "The default body.";
+      echo "<div id='content'>
+                 <img src='logo.png' alt='GnuCoMo'>
+            </div>";
    }
 
    function Tail()
@@ -114,12 +185,18 @@ class page
       {
          pg_close($this->database);
       }
+      echo "<br></div>
+            <div id='footer'>
+            &copy; <a href='http://www.gnucomo.org'>GnuCoMo</a>
+            </div>";
       echo "</body>";
       echo "</html>";
    }
 
    function Showpage()
    {
+      global $last_error;
+
       $this->config = new gnucomo_config;
 
       $this->config->read("gnucomo");
@@ -140,6 +217,7 @@ class page
             $this->database = pg_connect($this->config->Database($name, $passw));
             if ($this->database == false)
             {
+               $last_error = "Login Incorrect";
                login_form();
             }
             else