<?php
/*
  osCommerce, Open Source E-Commerce Solutions
  http://www.oscommerce.com

  Implemented by Blake Schwendiman (blake@intechra.net)
	Updated 2002/3/30 -- Ross Lapkoff (rlapkoff@austin.rr.com)

  Copyright (c) 2002 osCommerce

  Released under the GNU General Public License
*/

  require('includes/application_top.php');
	require(DIR_WS_FUNCTIONS . 'misc_funcs.php');
	
  if (isset($username)) {
	  $aResult = tep_db_query("select admin_id, admin_pass from " . TABLE_ADMINISTRATORS . " where admin_name = '$username'");		
    if (tep_db_num_rows($aResult)) {
        $check = tep_db_fetch_array($aResult);
        $pass_ok = validate_password($password, $check['admin_pass']);
				
	  if ($pass_ok) {
		tep_session_unregister( 'login_id' );
		tep_session_register( 'login_id' );
		$login_id = $check['admin_id'];
     		tep_redirect(tep_href_link($retpage));
		exit();
	    } 
	  } 
	}
?>
<html>
<head>
<title><?php echo TITLE; ?></title>
<link rel="stylesheet" type="text/css" href="includes/stylesheet.css">
<script language="javascript" src="includes/general.js"></script>

</head>
<body onload="SetFocus();">

<!-- header //-->
<?php require(DIR_WS_INCLUDES . 'header.php'); ?>
<!-- header_eof //-->

<!-- body //-->
<table border="0" width="100%" cellspacing="5" cellpadding="5">
  <tr>
    <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="0">
      <tr>
        <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
        </table></td>
      </tr>
    </table></td>
<!-- body_text //-->
    <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="0">
      <tr>
        <td><table border="0" width="100%" cellspacing="0" cellpadding="2" class="topBarTitle">
				<tr>
            <td colspan="5"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
          </tr>
        </table></td>
      </tr>
      <tr>
        <td width="100%"><table border="0" width="100%" cellspacing="0" cellpadding="0">
          <tr>
            <td class="pageHeading">&nbsp;<?php echo HEADING_TITLE; ?>&nbsp;</td>
          </tr>
        </table></td>
      </tr>
      <tr>
        <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
          <tr><td colspan="5"><?php echo tep_draw_separator('pixel_black.gif', '100%', '1'); ?></td>
          </tr>
          <tr><td colspan="5">&nbsp;</td>
          </tr>
          <tr><td colspan="5"><form action="<?php tep_href_link('login.php'); ?>" method="post">
              <table>
                <tr><td class="main"><?php echo TEXT_INFO_USER_NAME; ?>&nbsp;</td>
                    <td><input type="text" name="username"></td>
                </tr>
                <tr><td class="main"><?php echo TEXT_INFO_PASSWORD; ?>&nbsp;</td>
                    <td><input type="password" name="password"></td>
                </tr>
                <tr><td colspan="2"><input type="hidden" name="retpage" value="<?php echo $retpage; ?>">
		    <input type="submit" name="Submit" value="Login"></td>												
                </tr>
		          </table>
            </form>
            </td>
          </tr>
        </table></td>
      </tr>
    </table></td>

<!-- body_text_eof //-->
  </tr>
</table>
<!-- body_eof //-->

<!-- footer //-->
<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
<!-- footer_eof //-->
</body>
</html>
<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>