<?
include("../includes/config.php");
if (($_GET['go'])==('')){
if(is_file("../install/install.php")){die("لم تقم بحذف ملف install.php");}
?>

 <head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1256">
<meta http-equiv="Content-Language" content="ar-sa">
<style>
INPUT {
	BORDER-RIGHT: #7f7f7f 1px solid; BORDER-TOP: #7f7f7f 1px solid; FONT-SIZE: 11px; BORDER-LEFT: #7f7f7f 1px solid; BORDER-BOTTOM: #7f7f7f 1px solid; FONT-FAMILY: Tahoma; BACKGROUND-COLOR: #F2F2F2
}
</style>
</head>
<div align="center">
&nbsp;<p>&nbsp;</p>

	<p>&nbsp;</p>
	<table border="0" width="40%" dir="rtl" cellspacing="0" cellpadding="0">
		<tr>
			<td width="41">
			<img border="0" src="images/t_r.jpg" width="41" height="36"></td>
			<td background="images/t_m.jpg">&nbsp;</td>
			<td width="32">
			<img border="0" src="images/t_l.jpg" width="32" height="36"></td>
		</tr>
		<tr>
			<td background="images/m_r.jpg" width="41">&nbsp;</td>
			<td bgcolor="#FDFDFD">
    <div id="logindiv">
      <form id="loginForm" method="POST" action="login.php?go=login">
          <div class="fieldTitle">
			<table border="0" width="93%" cellspacing="3" cellpadding="0">
				<tr>
					<td width="107">
					<p align="center"><font face="Tahoma" size="2">اسم المستخدم
					:</font></td>
					<td>&nbsp;<input name="username" type="text" value="" size="33"></td>
				</tr>
				<tr>
					<td width="107">
					<p align="center"><font face="Tahoma" size="2">كلمـــة
					المـــــرور :</font></td>
					<td>&nbsp;<input name="password" type="password" value="" size="33"></td>
				</tr>
				<tr>
					<td width="107">&nbsp;</td>
					<td>
					<p align="center">&nbsp;<input type="submit" value="دخول"></td>
				</tr>
				<tr>
				</tr>
			</table>
			</div>
          	</td>
			<td background="images/m_l.jpg" width="32">&nbsp;</td>
		</tr>
		<tr>
			<td width="41">
			<img border="0" src="images/d_r.jpg" width="41" height="32"></td>
			<td background="images/d_m.jpg">&nbsp;</td>
			<td width="32">
			<img border="0" src="images/d_l.jpg" width="32" height="32"></td>
		</tr>
	</table>
	</form>
</div>


</center>

<?
}elseif (($_GET['go'])==('login')){
$inTwoMonths = 3600 + time();
$adminuser = @mysql_db_query("$dbName", "select *  from admin where  admin_id = '1'") ;
while  ($ab = mysql_fetch_array($adminuser)){
$adminu = $ab['admin_name'];
$adminp = $ab['admin_password'];
}
$loguser= trim($_POST['username']);
$logipass= trim($_POST['password']);
$md5pass = md5($logipass);
if ( $adminp == $md5pass  && $adminu == $loguser ){
 setcookie(adminuser , $loguser, $inTwoMonths);
 setcookie(adminpassword , $md5pass, $inTwoMonths);
 print ("<META HTTP-EQUIV='Refresh' CONTENT='0; url=index.php'>");
 }else{ print("<div align='center'>عفوا اسم المستخدم او كلمة المرور خاطئة</div>");
 print ("<META HTTP-EQUIV='Refresh' CONTENT='1; url=login.php'>");
 }

 }elseif(($_GET['go'])==('logout')){
 $inTwoMonths = 3600 - time();
 setcookie(adminuser , $loguser, $inTwoMonths);
 setcookie(adminpassword , $md5pass, $inTwoMonths);

 print ("<META HTTP-EQUIV='Refresh' CONTENT='0; url=index.php'>");
 }

?>