<?php

include 'system/bd.php';
include 'system/cook.php';
include ("system/gzip.php");
include ("system/head1.php");
if(isset($_SESSION['auth']) && $_SESSION['auth']==1){
header ("Location: main.php?");
exit;
}


$login = mysql_real_escape_string($_POST['login']);  
$password = mysql_real_escape_string($_POST['password']);      
if(empty($login) or empty($password)){  
header ("Location: index.php?act=clear1");  
exit;  
}  


$user = mysql_fetch_array(mysql_query("SELECT * FROM `user` WHERE `login`='".$login."' and `password`='".$password."'"));
if(empty($user)){
header ("Location: index.php?act=clear2");
exit;
}

if ($err){  foreach($err as $value){  echo "".$value.""; 
}


exit;
}else{
//if ($user['id']==1 OR $user['id']==2){
$_SESSION['id']=$user['id'];
$_SESSION['login']=$user['login'];
$_SESSION['password']=$user['password'];
$_SESSION['auth']=1;
header ("Location: main.php?");

}


include ("system/foot.php");

?>

