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

$bp="../";
if($_GET['bp'])
$bp=$_GET['bp'];

$MM_redirectLoginSuccess = "edit_akk.php";
$action = $_SERVER['PHP_SELF'];


if ((isset($_REQUEST["MM_logn"])) && ($_REQUEST["MM_logn"] == "logn")) 
{
	if ((!empty($_REQUEST['email'])) && (!empty($_REQUEST['pass']))) 
	{
	$email=trim(anti($_REQUEST['email']));
	$pass=trim(anti($_REQUEST['pass']));
	
  	$r_log = mysql_query("SELECT * FROM akk WHERE  email='".$email."' and pass='".$pass."'"); 
  	$n_log = mysql_num_rows($r_log);
  	$rr_log = mysql_fetch_array($r_log);
  	if ($n_log>0) 
  		{
    	$_SESSION['ID_P']=array(
		1=>$rr_log['id_akk'], 
		2=>md5($_SERVER['REMOTE_ADDR']),
		3=>$rr_log['contakt']
		);
		header ("Location: ".$MM_redirectLoginSuccess);
  		} 
  	else 
  		{
		$err = 'Неверный email или пароль<br><a class="iframe" href="logpass_zab.php">Забыли пароль?</a>';
		}
	} 
}

?>
<!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">
<meta name="robots" content="nofollow" />
<link rel="stylesheet" href="../style/style.css" type="text/css">
<link rel="stylesheet" type="text/css" href="../style/jquery.fancybox.css" media="screen" />

<script type="text/javascript" charset="utf-8" src="../js/jquery-1.4.4.min.js"></script>
<script type="text/javascript" src="../js/jquery.easing.1.3.js"></script>
<script type="text/javascript" src="../js/jquery.fancybox-1.2.1.pack.js"></script>
<script type="text/javascript" src="../js/fancy.js"></script>

</head>

<body>
<table width=100%>
	<tr height=64>
		<td width=64>
		<img border=0 src="<?=$bp?>icon/8.gif">
		<td align=center><h3>Вход</h3>
	<tr>
	<td colspan=2>
<?
if($err) echo "<p><font color=red>".$err."</font></p>";
?>


<form name="form1" method="POST" action="<?=$action?>">
<table>
	<tr>
		<td align="right" width="150">
  		email
		<td>    
    	<input name="email" 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="Войти">
		<input type="hidden" name="MM_logn" value="logn">
		<td>

</table>
</form>
</table>

</body>
</html>
