<?php
error_reporting(0);
if($_POST['submit']){	
	
if($_POST['action_contact']=="send")
   {	

	 $form_check_alert=dynamic_check_form_values(array(
	 "rp--Please select Special Services." => "".$_POST['special_services']."",
	 // "rp--Please select Support Services." => "".$_POST['support_services']."",
	 "rp-2-Please enter your name." => "".$_POST['first_name']."",
	 //"rp-2-Please enter your last name." => "".$_POST['last_name']."",
	 "rp--Please enter contact number." => "".$_POST['mobile']."",	
	 "rp-4-Please enter your email id." => "".$_POST['email']."" ,
	 //"rp--Please enter company name." => "".$_POST['company_name']."",	 
	 //"rp--Please enter phone number." => "".$_POST['phone']."",	
	//"rp--Please enter product name." => "".$_POST['product_name']."", 
	//"rp--Please enter industry type." => "".$_POST['industry_type']."",
	
	 //"rp--Please enter address." => "".$_POST['address']."",
	 // "rp--Please select country." => "".$_POST['country']."",	
	 //"rp--Please enter city." => "".$_POST['city']."",
   
	 
	// "rp--Please enter mobile number." => "".$_POST['mobile']."",
   //  "rp--Please enter state." => "".$_POST['state']."",
    // "rp--Please select country." => "".$_POST['country']."",
   //  "rp-8-Please enter zip code." => "".$_POST['zipcode']."",
	 // "rp--Please upload cv." => "".$_FILES['upload_resume']['name']."",
	//"rp--Please enter product detail." => "".$_POST['productDetail']."",
	   	  "rp--Please enter your comments." => "".$_POST['comments'].""),
		
			  $validation_ans_arr);
		
	if($_POST['security_code']==''){
		$form_check_alert.="<li style='color:red;'>Please Enter Word Verification Code.</li>";}
elseif ($_SESSION['verification_code'] != $_POST['security_code']) {
		$form_check_alert.="<li style='color:red;'>Verification Word Mismatch ... Please try again with correct verification word.</li>";
	}
 
	if(!strlen($form_check_alert)>0){
		
		$_SESSION['verification_code']="";
        $name=ucwords($_POST['first_name']);
	    $email=$_POST['email'];
		//$name=ucwords($personName);
		$special_services=$_POST['special_services'];
		$mobile=$_POST['mobile'];
		$comments=$_POST['comments'];
    /*$msg= "
	<table width='96%' cellspacing='0' cellpadding='2' border='0'>
	 <tr><td>Dear ".$name.",<br/><br/></td></tr>
	 <tr><td>We have received your enquiry. We will contact you very soon.<br /><br />Thanks<br><br>".WEBSITE_NAME." Team</strong></td></tr>
	</table>";*/
    
		$to='homesalon.service11@gmail.com';
		//$to='subashvns@gmail.com';
		
	//$cc=ADMINMAIL_CC;
   // $to1='anshulgoel@kingfishproducts.com';
   // $to2='jagjyot123@gmail.com';
   $ContactPerson='Admin';
   
	$subject1="Enquiry received at ".WEBSITE_NAME;	
	$mess2= "
	<table width='96%' cellspacing='0' cellpadding='2' border='0'>
	<tr><td>Dear ".$ContactPerson.",<br/><br/></td></tr>
	<tr><td>You have received an enquiry. Details are as follows: <br /><br />";
	
	$mess3= "
	<table width='96%' cellspacing='0' cellpadding='2' border='0'>
	<tr><td>Dear ".$name.",<br/><br/></td></tr>
	<tr><td>We have received your enquiry. We will contact you asap.Your Enquiry Details are as follows: <br /><br />";
	$mess1 = '';
	if($special_services)
	$mess1.= "<strong>Special Services</strong> : ".$special_services."<br /><br />";
	

	
	if($name)
	$mess1.= "<strong>Name</strong> : ".$name."<br /><br />";
	

	
	if($email)
	$mess1.= "<strong>Email Id</strong> : ".$email."<br /><br />";
	
	
	
	if($mobile)
	$mess1.= "<strong>Mobile Number</strong> : ".$mobile."<br /><br />";

	if($comments)
	$mess1.= "<strong>Comments</strong>: ".$comments."<br /><br />";
  
    $mess1.= "Thanks<br><br>".WEBSITE_NAME." Team</strong>
 </td></tr>
	</table>"; 
	

	$adminMailmessage=$mess2.$mess1;
	send_email($name,$email,$to,$subject1,$adminMailmessage);
	//send_email($name,$email,$cc,$subject1,$adminMailmessage);
   // send_email($name,$email,$to1,$subject1,$adminMailmessage);
   // send_email($name,$email,$to2,$subject1,$adminMailmessage);
   // send_email($name,$email,$to3,$subject1,$adminMailmessage);
	#---------------user mail-----------------------#
	$userMailmessage=$mess3.$mess1;
	send_email($ContactPerson,$to,$email,$subject1,$userMailmessage);
    $_SESSION['session_message']=$name;
   echo '<meta http-equiv="refresh" content="0;url=thankyou.htm"/>';		  
	//header("location:thank-you.htm");	
	exit;/*Thank You! '.$name.' 
*/
    
    
     } 
else {
    $msg=html_head();
    $msg.=$form_check_alert;
    $msg.=html_foot();
}
}

	
if(@$_POST['action_refer']=="send")
   {

	 $form_check_alert=dynamic_check_form_values(array(
	 "rp-2-Please enter your name." => "".$_POST['your_name']."",
	
	
	 "rp-4-Please enter your email id." => "".$_POST['your_email']."" , 
	 "rp-2-Please enter your friend's name." => "".$_POST['friend_name']."",
	 "rp-4-Please enter your friend's email id." => "".$_POST['friend_email']."" ,
	// "rp--Please enter comments." => "".$_POST['comments'].""
		  ),
		
			  $validation_ans_arr);
			  
			
	
	
	
	/*if($_POST['security_code']==''){
		$form_check_alert.="<li style='color:red;'>Please Enter Word Verification Code.</li>";}
elseif ($_SESSION['verification_code'] != $_POST['security_code']) {
		$form_check_alert.="<li style='color:red;'>Verification Word Mismatch ... Please try again with correct verification word.</li>";
	}*/
   
	if(!strlen($form_check_alert)>0){
		
		//$_SESSION['verification_code']="";
  
		$your_name=ucwords($_POST['your_name']);
	
	    $your_email=$_POST['your_email'];
		$friend_name=ucwords($_POST['friend_name']);
		$friend_email=$_POST['friend_email'];
		
		$industry=$_POST['industry'];
		$mobile=$_POST['mobile'];
		$product_name=$_POST['product_name'];
		$address=$_POST['address'];
		$city=$_POST['city'];
		$state=$_POST['state'];
		$country=$_POST['country'];
		$business=$_POST['business'];
		$zipcode=$_POST['zipcode'];
		$comments=$_POST['comments'];
		
		
		
    
    
    $to=$your_email;
    //$to=ADMINMAIL;
	//$cc=ADMINMAIL_CC;
   // $to1='anshulgoel@kingfishproducts.com';
  
    $admin='Admin';
    
	$page_link=SITE_URL_PATH;
	$subject1='Refer a Friend';
	
	
 $message1.="Hi ".$friend_name.",<br/><br/>".$your_name." has recommended this website, as ".$your_name." thinks you would like it.<br/><br/>To view the website please click on the following link.<br/><br/><a href='".$page_link."' target='_blank'>View Website</a><br/><br/>Regards,<br/><br/>".WEBSITE_NAME." Team"; 

		

	//$adminMailmessage=$mess2.$mess1;
	//send_email($name,$email,$to,$subject1,$adminMailmessage);
	//send_email($name,$email,$cc,$subject1,$adminMailmessage);
   // send_email($name,$email,$to1,$subject1,$adminMailmessage);
   
	#---------------user mail-----------------------#
	$userMailmessage=$message1;
	send_email($admin,$to,$friend_email,$subject1,$userMailmessage);
    $_SESSION['session_message']='This website has been referred to your friend successfully.';
   echo '<meta http-equiv="refresh" content="0;url=refer-a-friend.htm"/>';		  
	//header("location:thank-you.htm");	
	exit;/*Thank You! '.$name.' 
*/
    
    
     } 
	 
else {
    $msg=html_head();
    $msg.=$form_check_alert;
    $msg.=html_foot();
}

}



}