<?php
error_reporting(0);
if (substr_count($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip')) ob_start("ob_gzhandler"); else ob_start();
session_start();
session_cache_limiter('private');
$cache_limiter 	= session_cache_limiter();
session_cache_expire(60);
$cache_expire 	= session_cache_expire(); 
date_default_timezone_set('Asia/Manila'); 
$CURRENT_DATE 	= date('Y-m-d H:i:s');
include_once('../config/minho.php');
include_once('../config/autoloadClass.php');
$autoload	 	=	new autoloadClass(); 
$users			=	new userClass();
$usertype 		= 	"";
if(isset($_POST['email']) && isset($_POST['pass'])){
$email			= isset($_POST['email']) ? htmlentities(addslashes(strip_tags(trim($_POST['email'])))) : ""; 
$password		= isset($_POST['pass']) ? htmlentities(addslashes(strip_tags(trim($_POST['pass'])))) : ""; 
$url = ""; 
$output = $users->checkUserAccess($email,$password);
if($output==true){
	$url = "index";
	$out = true;
	$details	=	array();
	$details 	=	$users->getUserDetails($email);
	$_SESSION['danvillee_userid'] 		= $details['Id'];
	$_SESSION['danvillee_firstname']		= $details['FirstName'];
	$_SESSION['danvillee_lastname'] 		= $details['LastName'];
	$_SESSION['danvillee_username']	 	= $details['Username'];
	$_SESSION['danvillee_email']	 		= $details['EmailAddress'];
	$_SESSION['danvillee_user_type']	 	= $details['UserType'];
	$_SESSION['danvillee_project']	 	= "Villa Belissa Subdivision";
	$_SESSION['danvillee_project_venue'] = "San Jose Del Monte Bulacan";
	$_SESSION['danvillee_log'] 			= "yes";
}else{
	$url = "index";
	$out = false;
} 
$resultArr 						= array();
$resultArr['output']	  		= $out; 
$resultArr['path']		  		= $url; 
echo json_encode($resultArr);
}
exit();
ob_end_flush();