<? @session_start();
require_once('../connect/connect.php'); 
include_once('../lib/lib.php');

if (isset($_POST['log']) && ($_POST['pass'])) 
{
$log=anti($_POST['log']);
$pass=anti($_POST['pass']);

$MM_redirectLoginSuccess = "global.php";
$MM_redirectLoginFailed = "index.php";
  	
$r = mysql_query("SELECT * FROM admin WHERE  log='".$log."' AND pass='".$pass."'"); 
$nr = mysql_num_rows($r);
$rr = mysql_fetch_array($r);
	if ($nr>0) 
	{
	$_SESSION['ID_Glob'] = md5($_SERVER['REMOTE_ADDR']);
	echo "<HTML><HEAD><meta http-equiv='Refresh' charset='utf-8' content='0; URL=".$MM_redirectLoginSuccess."'></HEAD></HTML>";
	}   
	else 
	{
	echo "<HTML><HEAD><meta http-equiv='Refresh' charset='utf-8' content='0; URL=".$MM_redirectLoginFailed."'></HEAD></HTML>";
	}
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Вход</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" href="../style/template_adm.css" type="text/css"/>
</head>

<body>
<table><tr><td class="td">
<form name="form1" method="POST" action="">
<table>
	<tr>
		<td align="right" width="150">
  		login
		<td>    
    	<input name="log" type="text" size="20" >

	<tr>
		<td align="right" >
		password
		<td>
    	<input name="pass" type="password" size="20" >

	<tr>
		<td align="right" >
    	<input class="submit" type="submit" name="Submit" value="Войти">
		<td>

</table>
</form>
</table>
</body>
</html>
