<?php
require_once("sendEmail.src");
//$startdate	=	date("Y-m-d");
//$enddate	=	date("Y-m-d");
if(isset($_REQUEST["verif_box"]))
{	
	$verif_box = $_REQUEST["verif_box"];
	if(md5($verif_box).'a4xn' == $_COOKIE['tntcon'])
	{	
			/*$from_name  = $_POST['Guest_Name'];# Sender Name 
			//$from_email = (isset($_POST['Email'])?$_POST['Email']:'Enquiry');# Sender Email  
			$from_email	=	$_POST['Email'];
			$to_name    = "Admin";# Recipient Name  
			$to_email   = $_POST['recipient'];#  utpalkantkumar3@yahoo.com   Recipient Email
			
			$subject    = $_POST['subject'];# Email Subject  */
			
			$SQL="Following is the Enquiry from Website.\n";# Text Portion 
			$HTMSQL="<HTML><HEAD></HEAD><BODY>Following is the Enquiry from Website.<br/><br/>";
			
			$SQL="Following Enquiry Form filled in Your Website.\n";
			$HTMSQL="<HTML><HEAD></HEAD><BODY>Following Enquiry Form filled in Your Website.<BR>";
			
			foreach ($_POST as $key=>$value) 
			{ 
				if (($key!="submit_x")&&($key!="submit_y")&&($key!="compulsoryfields")&&($key!="recipient")&&($key!="redirect")&&($key!="subject")&&($key!="verif_box")) // everything except record ID,title,submit 
					{ 
					
						if($key == "From_Date")
							{
								$key1	=	str_replace('_',' ',$key);
								$calculatedate = $value;
	 							$from_formatedate	=	date("d-M-Y", strtotime($calculatedate));
								$SQL.="$key1 : $from_formatedate \n";
								$HTMSQL.="$key1 : $from_formatedate <br/>";
							}
						else if($key == "To_Date")
							{
								$key1	=	str_replace('_',' ',$key);
								$calculatedate1 = $value;
	 							$To_FormateDate	=	date("d-M-Y", strtotime($calculatedate1));
								$SQL .="$key1 : $To_FormateDate \n";
								$HTMSQL .="$key1 : $To_FormateDate <br/>"; 
							}
						else
							{
								$key1	=	str_replace('_',' ',$key);
								$SQL.="$key1 : $value \n";
								$HTMSQL.= "$key1 : $value <br/>";
							}
					}	 
			}
			$text_message 	= $SQL;
			$html_message 	= $HTMSQL ;
			$attachment   	= "";
			$subject    	= $_POST['subject'].' - CountrySideFarm.in';# Email Subject  */
			
			$from_name  	= $_POST['Guest_Name'];	
			$from_email		= "admin@countrysidefarm.in"; //$_POST['Email_Id'];
			
// 			$to_email 		= "countrysidefarm@gmail.com";
            $to_email       ="shubhamworkmails11@gmail.com";    
			$to_name		= "admin";
			
			sendmail ($from_name, $from_email, $to_name, $to_email, $subject, $text_message, $html_message, $attachment); 
			
			//$to_email1 		= "palamit1006@gmail.com";
			//sendmail ($from_name, $from_email, $to_name, $to_email1, $subject, $text_message, $html_message, $attachment);
			/*
			$from_name  = "admin"; 	
			$from_email	= "admin@countrysidefarm.in";
			
			$to_email = $_POST['Email_Id'];# Sender Name
			$to_name	=	$_POST['Guest_Name'];# Sender Name
			
			sendmail ($from_name, $from_email, $to_name, $to_email, $subject, $text_message, $html_message, $attachment);
			*/
			
// 			die();
			
			$redirect = $_POST['redirect'];
			header("Location:$redirect");
	}
 	else
		{
			$errmsg = "<font face='Arial' size='3' color='red'><b>Please Enter Correct Code in the Verify Box!</b></font>";
			include("contact_us.htm");
		}	
}
else
	{
		$errmsg = "<font face='Arial' size='3' color='red'><b>Please Enter Correct Code in the Verify Box.</b></font>";
		include("contact_us.htm");
	}		
?>
