<?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['danvilles_userid'] 		= $details['Id'];
	$_SESSION['danvilles_firstname']		= $details['FirstName'];
	$_SESSION['danvilles_lastname'] 		= $details['LastName'];
	$_SESSION['danvilles_username']	 	= $details['Username'];
	$_SESSION['danvilles_email']	 		= $details['EmailAddress'];
	$_SESSION['danvilles_user_type']	 	= $details['UserType'];
	$_SESSION['danvilles_project']	 	= "Danville S";
	$_SESSION['danvilles_project_venue'] = "San Jose Del Monte Bulacan";
	$_SESSION['danvilles_log'] 			= "yes";
}else{
	$url = "index";
	$out = false;
} 
$resultArr 						= array();
$resultArr['output']	  		= $out; 
$resultArr['path']		  		= $url; 
echo json_encode($resultArr);
}
exit();
ob_end_flush();