<?php
error_reporting('E_ALL');
/*                                                                        	*
 * This script is for handling all the tasks related to email for PPC pages.*
 *                                                                        	*
 *                                                                        	*/
session_start();

/*																						
 * INCLUDING SUPPORT FILES 																																				
 */

$errmessage = ""; 
if($_POST) 
{      
	$reffer_url     = $_SERVER['HTTP_REFERER'];	
	$remote_addr    = $_SERVER['REMOTE_ADDR'];	
	$name 			= $_POST['name'];
	$email 			= $_POST['email'];
	$phone 			= $_POST['phone'];
	$message 		= $_POST['message'];

    if (empty($name)) 
    {
        $errmessage .= "Name is required<br />";
    }

    if (empty($email)) 
    {
        $errmessage .= "Email is required<br />";
    } 
    if (empty($phone)) {
        $errmessage .= "Phone Number is required<br />";
    }	

    // user email message
	$user_message = 'Dear ' . stripslashes($name) . ',<p style="margin-bottom:15px;">Thank You for submitting your query. We will get back to you shortly.</p>
			<table width="100%" border="0" cellspacing="0" cellpadding="5" style="border: solid 10px #EFEFEF;">
			  <tbody>
				<tr>
				  <td></td>
				  <td><h2 style="margin-top:15px; padding:0px;">Hire Your Perfect Employee, with Zero Recruitment Cost!</h2></td>
				  <td></td>
				</tr>
				<tr>
				  <td></td>
				  <td valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
				  <tbody>
					<tr>
					  <td width="69%"><p style="padding:10px; padding-top:0px; margin:0px; margin-bottom:15px;  font-family:arial;"> Hiring a new employee is a painful process! Not only is it an expensive process (a recent article by Forbes magazine calculated that, on average, an American company spends $3300 to recruit just one employee) but it is also a time-intensive and laborious exercise that distracts you from your mission critical projects.</p>
					   <p style="padding:10px; margin-bottom:15px; font-family:arial;">Watch the video below to see how with VirtualEmployee.com you say goodbye to all of your recruitment costs and headaches. How our robust 21 man strong recruitment team, with a combined 89 years of cross-domain recruitment experience, does all the leg work for you at zero cost!</p>
					   <p style="padding:10px 0px; margin-bottom:5px;  font-family:arial;">The best part about our service is that it is completely risk free! Interview and assign tests to the candidates we put forward. If you do not like any of the candidates, no problem; there is no obligation on you to hire any of them. We do not take any fee, so you have nothing to lose by reviewing our candidates, but a lot to gain potentially (this is only the first of the many advantages of hiring Virtual Employees!)</p></td>
					  <td width="31%" valign="top"> <p style="margin:0px; float:left; padding-right:10px;"><a href="https://www.youtube.com/watch?v=5gKNdScT-HY&amp;feature=youtu.be" style="float:left;" target="_blank"><img src="http://www.virtualemployee.com/wp-content/themes/smartstart/images/mail-video.png"></a></p></td>
					</tr>
				  </tbody>
				</table>
				</td>
				  <td></td>
				</tr>
				<tr>
				  <td></td>
				  <td></td>
				  <td></td>
				</tr>
			  </tbody>
			</table>
			<br/>
			<br/>
			<p>Additionally, if you would like to speak with our representative please feel free  to call us at any time on the numbers given below.</p>
			<p>US - (+1) 877 697 8006<br />
			  UK - (+44)  203 478 5941<br />
			  AUS - (+61)  280 733 418<br />
			  India - (+91)  120 662 8501<br>
			  Canada - (+1)  416 915 8941</p>
			<p>
			<br/><br/><br/>
			Best Regards,<br/><br/>
			Virtual Employee Team</p>
			<p><b>Form Preview</b></p>';
      // Admin message     
      $message = '<table width="700" border="0" cellspacing="0" cellpadding="0">
                        <tr>
                            <td bgcolor="#8ECCF0">
                                <table width="700" border="0" cellpadding="3" cellspacing="1" style="font:12px Arial, Helvetica, sans-serif;">
                                    <tr>
                                        <td colspan="2" align="center" bgcolor="#1B8DD1" style="color:#ffffff; font-weight:bold; font-size:18px; line-height:30px;">VirtualEmployee.com - Get Started Form</td>
                                    </tr>
                                    <tr>
                                        <td colspan="2" align="center" bgcolor="#8ECCF0" style="font-weight:bold; font-size:14px;">General Information</td>
                                    </tr>
                                    <tr>
                                        <td bgcolor="#E0F0F8"><strong>Name:</strong></td>
                                        <td bgcolor="#E0F0F8">' . stripslashes($name) . '</td>
                                    </tr>
                                    <tr>
                                        <td bgcolor="#E0F0F8"><strong>Contact Number:</strong></td>
                                        <td bgcolor="#E0F0F8">' . stripslashes($phone) . '</td>
                                    </tr>
                                    <tr>
                                        <td bgcolor="#E0F0F8"><strong>Email:</strong></td>
                                        <td bgcolor="#E0F0F8">' . stripslashes($email) . '</td>
                                    </tr>
                                    <tr>
                                        <td bgcolor="#E0F0F8"><strong>Message:</strong></td>
                                        <td bgcolor="#E0F0F8">' . stripslashes($message) . '</td>
                                    </tr>                                  
									<tr>
                                        <td bgcolor="#E0F0F8"><strong>URL:</strong></td>
                                        <td bgcolor="#E0F0F8">' . $reffer_url . '</td>
                                    </tr>   
									<tr>
                                        <td bgcolor="#E0F0F8"><strong>IP:</strong></td>
                                        <td bgcolor="#E0F0F8">' . $remote_addr . '</td>
                                    </tr> 
									
                                    <tr>
                                        <td bgcolor="#E0F0F8">&nbsp;</td>
                                        <td bgcolor="#E0F0F8">&nbsp;</td>
                                    </tr>
                                </table>
                            </td>
                        </tr>
                    </table>';
            
            ######### START SENDING EMAIL TO THE USER #########
            
            $headers 		 = 'MIME-Version: 1.0' . "\r\n";
            $headers 		.= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
            $headers 		.= 'From: info@virtualemployee.co.in' . "\r\n";
            $subject  		 = "How Virtual Employee Gets You Your Perfect Employee ";
            $subject_admin   = "Received a new contact request: VirtualEmployee.Co.in";
            $main_message 	 = $user_message . $message;

		
		   $userEmail = mail($email, $subject, $main_message, $headers, "-f hr@virtualemployee.com");
					
            ######### END SENDING EMAIL TO THE USER #########
            
         
            
            ######### START SENDING EMAIL TO THE VE #########    
            $customFrom = $email;
            $headers 	= 'MIME-Version: 1.0' . "\r\n";
            $headers 	.= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
            $headers 	.= 'From: ' . $customFrom . "\r\n";
	       $to = 'hr@virtualemployee.com';
           $main_message = $message;
            
			
		    $adminEmail = mail($to, $subject_admin, $main_message, $headers, "-f hr@virtualemployee.com");
			if($adminEmail)
			{
				echo 1; exit;
				}else
				{
					echo 0; exit;
					}		
            ######### END of SENDING EMAIL TO THE VE #########    
            //header('location: /' . $redirect_to);
            
}
?>
