<?php
/*
	File     : index.php
	Version  : 0.2.1 Beta
	Copyright: Attila Soki 2001
	e-mail   : atiware@gmx.net
	Date     : 2001-05-12
*/

	if ($logout) {
		setcookie("MMCADMINID","0");
		setcookie("MMCADMINCOOKIE","logout");
	}
	include_once("Admin.class.php");
	if (($submit1) || isset($submit1) || (strlen($username)>0)) {
		$admin=new Admin();
		if ($admin->login(trim($username),trim($password))) {
			setcookie("MMCADMINID",$admin->getId());
			setcookie("MMCADMINCOOKIE",$admin->getCookie());
			header("Location: adminMenu.php");
		}
	}
	require("head.inc.php");
?>

  <tr> 
    <td colspan="2" align="center" valign="middle"> 
      <form method="post" action="index.php" name="loginform" ENCTYPE="multipart/form-data">
        <table width="50%" border="0" cellspacing="0" cellpadding="0" vspace="0" hspace="0" name="login">
          <tr> 
            <td colspan="2" align="center" valign="middle"> 
              <div align="center"> <font face="Verdana, Arial, Helvetica, sans-serif" size="2"> 
                <a href="lostPassword.php">I have forgotten my password</a>
                </font></div>
            </td>
          </tr>
          <tr> 
            <td width="50%"><font face="Verdana, Arial, Helvetica, sans-serif" size="2">Username:</font></td>
            <td width="50%"> <font face="Verdana, Arial, Helvetica, sans-serif" size="2"> 
              <input type="text" name="username" size="30" maxlength="64">
              </font></td>
          </tr>
          <tr> 
            <td width="50%"><font face="Verdana, Arial, Helvetica, sans-serif" size="2">Password:</font></td>
            <td width="50%"> <font face="Verdana, Arial, Helvetica, sans-serif" size="2"> 
              <input type="password" name="password" size="30" maxlength="64">
              </font></td>
          </tr>
          <tr> 
            <td colspan="2" align="center" valign="middle"> 
              <div align="center"> <font face="Verdana, Arial, Helvetica, sans-serif" size="2"> 
                <input type="submit" name="submit1" value="Login">
                </font></div>
            </td>
          </tr>
<?php
	$dbo=new MySql();
	if (!$dbo->checkConnection()) {
?>
            <td colspan="2" align="center" valign="middle"> 
              <div align="center"> <font face="Verdana, Arial, Helvetica, sans-serif" size="2" color="#CC0000"> 
                Warning! Unable to connect SQL server.<br>
                <?php echo $dbo->getLastErrorNo()." ".$dbo->getLastErrorMsg() ?><br>
                <?php echo $dbo->ErrNo()." ".$dbo->Error() ?>
                </font></div>
            </td>
          </tr>
<?php
	}
	$dbo->close();
	if ((int)$SERVER_PORT==80) {
?>
            <td colspan="2" align="center" valign="middle"> 
              <div align="center"> <font face="Verdana, Arial, Helvetica, sans-serif" size="3" color="#CC0000"> 
                Warning! You are using an unsecure (non SSL) connection!
                </font></div>
            </td>
          </tr>
<?php
	}
?>
        </table>
      </form>
    </td>
  </tr>
<?php
	require("foot.inc.php");
?>