 <?php
 $email=trim($_REQUEST['email']);
$key=trim($_REQUEST['key']);

if($key ==1)
{
	if($email !='')
	{
	$content="$email"."\n";
	$myFile = "unsub.txt";
	$fh = fopen($myFile, 'a') or die("Your Email-ID, $email has been noted for unsubscription. It will take 48 hours to process your request. Thank you for using our service.");
	fwrite($fh,$content);
	fclose($fh);
	
	echo "Your Email-ID, $email has been noted for unsubscription. It will take 48 hours to process your request. Thank you for using our service.";
	}
}
if($key ==2)
{ 
 
$firstname=$_REQUEST["firstname"];
$lastname=$_REQUEST["lastname"];
$email=$_REQUEST["email"];
$newsletter=$_REQUEST["newsletter"];
$dob=($_REQUEST['dob']);
$path = "subscribe/".date('Y-m-d').".txt";
$stringData = $firstname."|". $lastname ."|". $email ."|". $newsletter ."|". $dob ."\n";
$fp = fopen($path,"a+");
fwrite($fp,$stringData);
fclose($fp);
echo "Thanks for subscribing to our service.";


	if($email !='')
	{
		

   
     $to = $_POST['email'];
	 $subject = "Verify your subscription";
	 $message = "Hello $firstname,
	

You recently requested an email subscription to easywayhealthy.com We can't
wait to send the updates you want via email, so please click the following
link to activate your subscription immediately:

http://easywayhealthy.com/confirm.php

(If the link above does not appear clickable or does not open a browser
window when you click it, copy it and paste it into your web browser's
Location bar.)

--
This message was sent to you by easywayhealthy.com(easywayhealthy.com)
You received this message because you requested a subscription to the feed,
Update from easywayhealthy.com
If you received this in error, please disregard. Do not reply directly to
this email.
";

	 
	mail($email, $subject, $message, null,'-feasywayhealthy.com<healthtips@easywayhealthy.com>');
	 //mail($email,$subject,$message,$headers);

     }
}

?>