<?php
if($_SERVER['HTTP_HOST'] =="localhost"){
	$Database_name		="griffith_elder";
	$Database_hostname	="localhost";
	$Database_username	="root";
	$Database_password	="";
	$siteprojectfolder 	= "/griffith-elder/admin";	
	$siteURL  			= 	'http://'.$_SERVER['HTTP_HOST'].$siteprojectfolder;

}else{
	$Database_name		="demo8_griffith-elder";
	$Database_hostname	="localhost";
	$Database_username	="demo8_griffith_user";
	$Database_password	="r2_,.c=+xkRc";
	//$siteprojectfolder 	= "/admin";	
	$siteprojectfolder 	= "/griffith-elder/admin";
	$siteURL  			= 	'https://'.$_SERVER['HTTP_HOST'].$siteprojectfolder;

}


//////// ajax file direct call restrictions //////

$ajax_cu = $_SERVER['REQUEST_URI'];
$ajax_query_str = parse_url($ajax_cu, PHP_URL_QUERY);
parse_str($ajax_query_str, $ajax_query_params);
if (empty($_SERVER['HTTP_X_REQUESTED_WITH']) || strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) !== 'xmlhttprequest') {
	$block_pages_values=array("ajax_actions"); // add another page if needed
    if (in_array($ajax_query_params['page'], $block_pages_values)){
		//die("Invalid URL");
        if(!isset($_SESSION['user_id']) && $_SESSION['user_id']==''){
			$loginPage = "$siteURL"."/index.php?l=2";
			header("Location: $loginPage");
			exit;
		} 
    } 
}

/// in $block_pages_values array we can add multiple page to restrict direct access of ajax file ////
/// if admin is loged in he will be able to see the result else page will redirect to login screen  /////
//////// ajax file direct call restrictions//////


include('database.class.php');
$db = new database($Database_name, $Database_hostname, $Database_username, $Database_password);

$conn = mysqli_connect($Database_hostname, $Database_username, $Database_password, $Database_name);
mysqli_query($conn,'set SESSION sql_mode=""');


$encTAG = "[GRIFF_]";

// menus' fixed ids
$top_menu_id 		= 16;
$left_menu_id 		= 17;
$right_menu_id 		= 20;
$bottom_menu_id 	= 20;

$table_field_list=array(
                    'job'=>array('email','invoice_email','phone_no','landline_phone_no'),
                    'organisation_management'=>array('email','phone_no','landline_phone_no')
                    );
?>