<?
include("../../includes/common.php");

if($ADMIN_ID > 0){
	header ("Location: ".($r==""?"./index.php":$r));
	exit;
}

/*PAGE TITLE*/

$r = trim($_POST['r']!=""?$_POST['r']:$_GET['r']);
$login = trim($_POST['login']!=""?$_POST['login']:$_GET['login']);

if(isset($_POST["login"])){
	$user_id = CheckPartnerLoginData($_POST['login'],$_POST['pass']);
	
	if($user_id>0){
		$remember = $_POST['remember']==1?true:false;
		MakePartnerLogin($user_id,$remember);
		header ("Cache-Control: no-cache, must-revalidate");
		header ("Location: ".(!$r?"./index.php":$r));
		exit;
	}
	else{
		$error = "Партнер не найден";
	}
}

$smarty->assign('r',$r);
$smarty->assign('login',$login);
$smarty->assign('error',$error);
$smarty->assign('remember',$remember);
$smarty->display('partner_login.tpl');
?>