<?php 
include_once('libs/main.php');
$categoryObj = new category();
if(isset($_POST['action_sub']) && $_POST['action_sub'] == 'email_sub'){
	 $gallerysData = new stdClass();
	 $gallerysData->email_address 		= $_POST['email'];
	 $gallerysData->status 		= 1;
	 $gallerysData->created 		= date('Y-m-d H:i:s');
	 
	 $categoryObj->emailSubScriberAdd($gallerysData);
	 
	 $to = $_POST['email'];
	$subject = "Thank you for subscribe with us.";
	$message = "Hello Guest,<br><br>
		Thank you for your subscribtion.<br><br><br>
		Regards,<br>".SITE_NAME;
	 $headers = "MIME-Version: 1.0" . "\r\n";
	$headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";
	
	// More headers
	$headers .= 'From: <'.SUPPORT_EMAIL.'>' . "\r\n";
	//$headers .= 'Cc: '. ADMIN_EMAIL . "\r\n";
	
	mail($to,$subject,$message,$headers);

	 echo "Thank you for subscribe with us.";
	 
  }
  
if(isset($_POST['action_sub']) && $_POST['action_sub'] == 'fc_contact_sub'){
	$gallerysData = new stdClass();
	
	$gallerysData->name = $_POST['name'];
	$gallerysData->email_address = $_POST['email'];
	$gallerysData->contact_no = $_POST['phoneno'];
	$gallerysData->subject = $_POST['subject'];
	$gallerysData->message = $_POST['message'];
	$gallerysData->from = $_POST['page_from'];
	$gallerysData->created = date('Y-m-d H:i:s');
	$categoryObj->emailContactAdd($gallerysData);
	$subjectAdmin = "Inquiry Generated from Contact Us page with below details.";
	$subject = "Thank you for your inquiry.";
	$to = SUPPORT_EMAIL;
	$from = $_POST['email'];
	
	if($_POST['page_from'] == 'popup_book_show'){
		$subjectAdmin = "Inquiry Generated from Book A Showing with below details.";	
	}else if($_POST['page_from'] == 'popup_quote'){
		$subjectAdmin = "Inquiry Generated from Get A Quote with below details.";
	}
	
	$messageAdmin = "Please find below details for Inquiry,<br><br>
	Name: ".$_POST['name']."<br>
	Email: ".$_POST['email']."<br>
	Contact No: ".$_POST['phoneno']."<br>
	Subject: ".$_POST['subject']."<br>
	Message: ".$_POST['message']."<br><br><br><br>
		Regards,<br>".SITE_NAME;
	 $headersAdmin = "MIME-Version: 1.0" . "\r\n";
	$headersAdmin .= "Content-type:text/html;charset=UTF-8" . "\r\n";
	
	// More headers
	$headersAdmin .= 'From: <'.SUPPORT_EMAIL.'>' . "\r\n";
	//$headers .= 'Cc: '. ADMIN_EMAIL . "\r\n";
	
	mail($to,$subjectAdmin,$messageAdmin,$headersAdmin);
	mail($from,$subject,$messageAdmin,$headersAdmin);
	
	echo "Thank you for contact with us.";
}
  
?>