<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
// +----------------------------------------------------------------------+
// | PHP version 4/5                                                      |
// +----------------------------------------------------------------------+
// | This source file is a part of iScripts Multicart                     |
// +----------------------------------------------------------------------+
// | Authors: Programmer<programmer@armia.com>        		              |
// +----------------------------------------------------------------------+
// | Copyrights Armia Systems, Inc and iScripts.com © 2005                |
// | All rights reserved                                                  |
// +----------------------------------------------------------------------+
// | This script may not be distributed, sold, given away for free to     |
// | third party, or used as a part of any internet services such as      |
// | webdesign etc.                                                       |
// +----------------------------------------------------------------------+
?>
<?php
include "../includes/config.php";
include "../includes/session.php";
include "../includes/functions.php";

if (get_magic_quotes_gpc()) {
    $_POST = array_map('stripslashes_deep', $_POST);
    $_GET = array_map('stripslashes_deep', $_GET);
    $_COOKIE = array_map('stripslashes_deep', $_COOKIE); 
} 

$txtUserName = $_POST["txtUserName"];
$txtPassword = $_POST["txtPassword"];

if ($_POST["btnLogin"] == "Login") {
    $sql = " SELECT admin_name,admin_password FROM " . $tableprefix . "settings ";
    $result = mysql_query($sql) or die(mysql_error());
    if (mysql_num_rows($result) > 0) {
        $row = mysql_fetch_array($result);
        $adminname = $row["admin_name"];
        $adminpassword = $row["admin_password"];
        if (($adminname == $txtUserName) AND ($adminpassword == addslashes(md5($txtPassword)))) {
            $_SESSION["sess_adminname"] = $row["admin_name"];
            header("Location:adminmain.php");
            exit;
        } else {
            $message = "Invalid Login! Please retry.";
        } 
    } else {
        $message = "Error! Please retry.";
    } 
} 
include "../includes/htmltop.php";
?>


<body topmargin="0">
<table width="804" border="0" align="center" cellpadding="0" cellspacing="0">
	<tr>
		<td align="center">
			<table width="802" border="0" align="center" cellpadding="0" cellspacing="0">
				<tr>
					<td >
						<table width="800" border="0" align="center" cellpadding="0" cellspacing="0">
            				<tr>
              					<td>
									<table width="100%"  border="0" cellspacing="0" cellpadding="0" class="maintext">
                  						<tr>
                    						<td>
												<?php include "../includes/topheader_admin.php";?>
												<table width="100%"  border="0" cellspacing="0" cellpadding="0">
													<tr>
														<td valign="top" bgcolor="#FFFFFF">
															<?php 
																include "../includes/admintopmenuband.php"; 
																include "../includes/dotline.php";
																//include "includes/centermain.php"; 
															?>
																<table width="100%"  border="0" cellspacing="0" cellpadding="0">
																<tr>
																	<td style="width:1px" class="siteborder"><img src="../images/spacer.gif"></td>
																	<td width="100%">
																		<table width="100%"  border="0" cellspacing="0" cellpadding="0">
																			<tr>
																				<td align="center" valign="top">
																					<p>&nbsp;</p>
																						                                   
																						<table width="100%">
																							<tr>
																								<td>
																									<!-- ***************************************************** -->
																									<form name="frmLogin" action="<?php echo $_SERVER["PHP_SELF"]?>" method="POST">
																										<table cellpadding="2" cellspacing="2"  align="center" class="heading">
																											<tr><td colspan="2" align="center"  class="headng">Login</td></tr>
																											<tr><td colspan="2">&nbsp;</td></tr>
																											<tr><td colspan="2" class="message"><?php echo $message;?></td></tr>
																											<tr><td colspan="2">&nbsp;</td></tr>
																											<tr><td align="left">User Name</td><td align="left"><input type="text" class="textbox" value="<?php htmlentities($txtUserName) ; ?>" name="txtUserName"></td></tr>
																											<tr><td align="left">Password</td><td align="left"><input type="password" class="textbox" value="" name="txtPassword"></td></tr>
																											<tr><td colspan="2">&nbsp;</td></tr>
																											<tr><td colspan="2" align="center"><input type="submit" value="Login" name="btnLogin" class="button"></td></tr>
																											<tr><td colspan="2">&nbsp;</td></tr>
																										</table>
																									</form>
																									<!-- ***************************************************** -->
																								</td>
																							</tr>
																						</table>
																					
                             														
																				</td>
                                											</tr>
                           												</table>
                             										</td>
                              										<td style="width:1px" class="siteborder"><img src="../images/spacer.gif"></td>
                                  								</tr>
                     										</table>	
															<?
																include "../includes/dotline.php";
																include "../includes/adminbottommenu.php";
																//include "../includes/bottomband.php";
															?>
														</td>
                          							</tr>
                      							</table>
											</td>
                  						</tr>
									</table>
								</td>
 							</tr>
						</table>
					</td>
				</tr>
			</table>
		</td>
	</tr>
</table>
<?
include "../includes/footer.php";
?>
</body>
</html>




