<?php


// contents of function LogonForm

/*

Copyright © 2001 Nick Gammon.

  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. 

*/

  global $header, $bbsection_id, $bbtopic_id, $bbsubject_id, $control, $THIS_PAGE,
         $username, $FORUM_URL, $page;
  
  ?>
  
  <form METHOD="post" ACTION="<?php echo $THIS_PAGE;?>"> 
    <table border=0 width="100%">
    <tr valign=top>
      <td align=left>
        <font size=2><?php echo $header; ?></font>
      </td>
      <td align=right>
        <table border=0 >
          <tr align=right>
          <td colspan=2> 
            <font size=1> 
            <?php 
              if ($control ['home_url'])
                {
                hLink ("Home", $control ['home_url']); 
                echo "&nbsp;|&nbsp;\n";
                }
              hLink ("Users", $FORUM_URL . "bbuserlist.php"); 
              echo "&nbsp;|&nbsp;\n";
              hLink ("Search", $FORUM_URL . "bbsearch.php"); 
              if ($control ['faq_url'])
                {
                echo "&nbsp;|&nbsp;\n";
                hLink ("FAQ", $control ['faq_url']); 
                }
            ?>
            </font>
          </td>
          </tr>
          <tr align=right>
          <th ><font size=1>Username:</font></th>
          <td >
            <font size=1><input type=text name=username size=20 maxlength=40
            value="<?php echo $username;?>"><br>
            <?php if ($control ['allow_registrations'])
                    hLink ("Register forum user name", 
                           $FORUM_URL . "bbuseredit.php", 
                           "", true); 
            ?>
            </font>
         </td>
        </tr>
        <tr align=right>
            <th><font size=1>Password:</font></th>
            <td>
            <font size=1><input type=password name=password size=20 maxlength=40><br> 
            <?php hLink ("Forgotten password?", 
                          $FORUM_URL . "bbpassword.php", 
                          "action=forgot", true); ?>
            </font>
          </td>
        </tr>
        <tr align=right>
          <td colspan=2> 
          <input Type=submit Value="Log on">
          <input type=hidden name=action value=logon>
          </td>
        </tr>


        </table>
      </td>
    </tr>
    </table>
  <?php
  
  // preserve variables so we end up seeing the same form
  if ($bbsection_id)
    echo "<input type=hidden name=\"bbsection_id\" value=$bbsection_id>\n";
  if ($bbtopic_id)
    echo "<input type=hidden name=\"bbtopic_id\" value=$bbtopic_id>\n";
  if ($bbsubject_id)
    echo "<input type=hidden name=\"bbsubject_id\" value=$bbsubject_id>\n";
  if ($page)
    echo "<input type=hidden name=\"page\" value=$page>\n";
  echo "</form>\n";

?>
