<?php 

require ("config.php");
require ($CONFIG_PATH . "general_config.php");
require ($INCLUDE_DIRECTORY . "common.php");

/*
Copyright © 2001 Nick Gammon.

  Author: Nick Gammon <nick@gammon.com.au>
  Web:    http://www.gammon.com.au/
  Date:   February 2001

  This program is free software; you can redistribute it and/or modify 
  it under the terms of the GNU General Public License as published by 
  the Free Software Foundation; either version 2 of the License, 
  or (at your option) any later version. 

  This program is distributed in the hope that it will be useful, 
  but WITHOUT ANY WARRANTY; without even the implied warranty of 
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
  See the GNU General Public License for more details. 

  You should have received a copy of the GNU General Public License 
  along with this program; if not, write to 

  The Free Software Foundation, Inc., 
  59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.


  The Free Software Foundation maintains a web page at: http://www.fsf.org

  See the file gpl.txt for the full GNU General Public License.

*/

Init ("Administrative logon"); 

function ShowLogonForm ()
  {
  global $PHP_SELF;
?>

<h1>Administrative logon</h1>


<form METHOD="post" ACTION="<?php echo $PHP_SELF;?>"> 
 <p>User name: &nbsp; <input type=text name=username size=40 maxlength=40></p> 
 <p>Pass word: &nbsp; <input type=password name=password size=40 maxlength=40></p> 
 <input type=hidden name=adminaction value=logon>
 <?php FormSession (); ?>
<p>&nbsp;&nbsp;<input Type=submit Value="Log on"></p>

</form> 

<?php

  } // end of ShowLogonForm
  
if ($adminaction == "logon")
  {
  // *now* we can show the error message
  if (!$userinfo)
      ShowError ("That username/password combination is not on file"); 
  }

if ($userinfo ["logged_on"])
  $username = $userinfo ["username"];
else
  ShowLogonForm ();

echo "<hr>\n";
echo "<h3>Administrator main menu</h3>\n";
bList ();
  if ($userinfo ['amendclients'])
    {
    LI(); 
    hLink ("Client maintenance", $ADMIN_DIRECTORY . "edittable.php", "table=registration");
    }
      
  if ($userinfo ['amendbugs'])
    {
    LI(); 
    hLink ("Bugs and suggestions", $ADMIN_DIRECTORY . "edittable.php", "table=bugs");
    }

  if ($userinfo ['boilerplate'])
    {
    LI(); 
    hLink ("Boilerplate messages", $ADMIN_DIRECTORY . "boilerplate.php");
    }
       
  if ($userinfo ['executesql'])
    {
    LI(); 
    hLink ("Execute SQL command", $ADMIN_DIRECTORY . "executesql.php");
    LI(); 
    hLink ("Execute SQL file", $ADMIN_DIRECTORY . "executesqlfile.php");
    }
  
 if ($userinfo ['edittable'])
    {
    LI();  
    ShowTablesToEdit ();
    }   // end  of being able to edit tables in general
eList ();

MessageTail (); 

?>  
  
