MSV FM

dot.antimicrobial@66.96.161.157: ~ $
Path : /hermes/bosweb/b1705/absoluteresultstechnologies.net/public_html/rameventoftheyear/
File Upload :
Current < : /hermes/bosweb/b1705/absoluteresultstechnologies.net/public_html/rameventoftheyear/email.php

<?php
	session_start();
	
	if(isset($_GET['regID']))
	{
		/*
		$link = mysql_connect('legacymotivation.netfirms.com', 'u70814874', '561ea0')
		    or die('Could not connect: ' . mysql_error());
		mysql_select_db('d60744927') or die('Could not select database');
		
		$sql = 'SELECT * FROM registeryourcaravan WHERE regID = ' . $_GET['regID'];
		$info = mysql_fetch_assoc(mysql_query($sql));
		*/
		
    	$info = unserialize(stripslashes(urldecode($_GET['regID'])));
    	$info['dealer'] = $info['selectedDealer'];
    	  	         
    	include_once('includes.php');       
		if($dealerInfo[$info['dealer']]['eventID'] != "")
		{
			$_GET['promo'] = 'All the Best for 2013';
			$_GET['eventID'] = $dealerInfo[$info['dealer']]['eventID'];
			$_GET['source'] = 'web';
			$_GET['lastName'] = $info['lastname'];
			$_GET['firstName'] = $info['firstname'];
			$_GET['mobilePhone'] = $info['mobile'];
			$_GET['email'] = $info['email'];
			$_GET['address'] = $info['address'];
			$_GET['postalCode'] = $info['postalCode'];
			$_GET['currentVehicleYear'] = $info['years'];
			$_GET['currentVehicleModel'] = $info['makes'] . ' ' . $info['models'];
			$_GET['currentVehicleKM'] = $info['kilometers'];
			$_GET['nextVehicleModel'] = $info['nextVehicle'];
			$_GET['notes'] =  '$' . $info['payment'] . '/mth - ' . $info['monthsRemaining'] . ' Mths Remaining - Worth $' . number_format($info['values']['tradeInLow']) . ' - $' . number_format($info['values']['tradeInHigh']);
			
			$_GET['requiredUpdates'] = array();
			if($info['mobile'] != "") $_GET['requiredUpdates'] = array_merge($_GET['requiredUpdates'],array('mobilePhone'));
			if($info['email'] != "") $_GET['requiredUpdates'] = array_merge($_GET['requiredUpdates'],array('email'));
			if($info['years'] != "") $_GET['requiredUpdates'] = array_merge($_GET['requiredUpdates'],array('currentVehicleYear','currentVehicleModel','currentVehicleKM','email','mainPhone'));
			if($info['nextVehicle'] != "") $_GET['requiredUpdates'] = array_merge($_GET['requiredUpdates'],array('nextVehicleModel'));
			if($info['address'] != "") $_GET['requiredUpdates'] = array_merge($_GET['requiredUpdates'],array('address'));
			if($info['postalCode'] != "") $_GET['requiredUpdates'] = array_merge($_GET['requiredUpdates'],array('postalCode'));
			$_GET['requiredUpdates'] = array_merge($_GET['requiredUpdates'],array('notes'));
			
			include_once('../misc/rsvp.php');
			//include_once('adfEmail.php');
		}	      
		                 
		$_SESSION['registerEmail']['dealerInfo'] = $dealerInfo;
							 
   	include_once('displayUtils.php');        	
		include_once('Emailer/swift_required.php');	
		
		try 
		{			
			$transport = Swift_SmtpTransport::newInstance('server519.appriver.com');
			$mailer = Swift_Mailer::newInstance($transport);

			
			$message = Swift_Message::newInstance($dealerInfo[$info['dealer']]['name'] . " Load Up on Value Sales Event Confirmation");	
			
			// Gift Value	
			$eventDate =  $dealerInfo[$info['dealer']]['eventDate'];
			$gift =  $dealerInfo[$info['dealer']]['gift'];

					switch ($gift)
					{
						case "no":
						case "NO":
						case "none":
						case "NONE":
						$perks = "";			    
						break;
						default:
						$perks = '<br /><br /><b><font style="color:blue;font-size:11pt">EXTRA BONUS: Come in for a test drive on ' . $eventDate . ' and receive ' . $gift .'!</font></b>';
						break;
					 }

// Extra Bonus	
			$extraBonus =  $dealerInfo[$info['dealer']]['bonus'];

					switch ($extraBonus)
					{
						case "no":
						case "NO":
						case "none":
						case "NONE":
						$extra = "";			    
						break;
						case "TV":
						$extra = '<br /><br /><font style="color:blue;font-size:11pt;font-weight:bold;">EVERY REGISTER CUSTOMER RECEIVES A CHANCE TO WIN CANUCKS TICKETS AND A 50" TV !!</font>';		    
						break;
						case "tablet":
						$extra = '<br /><br /><b><font style="color:blue;font-size:11pt">BUY A NEW VEHICLE AND RECEIVE A </b> <span style="color:red">FREE SAMSUNG TABLET</span>!!!</font></b>';
						break;
						case "spin":
						$extra = '<br /><br /><b><font style="color:blue;font-size:11pt">BUY A NEW VEHICLE AND </b> <span style="color:red">Spin For A Free Gas Card for up to $1000 in value</span>!!!</font></b>';
						break;

						default:
//						$extra = '<b>JUST ANNOUNCED:</b> <span style="color:red">$500 HOLIDAY CASH BONUS</span> on qualifing new vehicles!!';
						$extra = '<br /><br /><b><font style="color:blue;font-size:11pt">JUST ANNOUNCED:</b> <span style="color:red">'. $extraBonus .'</span> on qualifing new vehicles!!</font></b>';
						break;
					 }



			if($info['values']['tradeInLow'] != "" && $info['values']['tradeInLow'] != 0)
			 {

			// Black Book Value
			$blackbook = $dealerInfo[$info['dealer']]['blackbook'];
			$bbooke = '<br><br><b>
							 	<font style="font-size:11pt">
							 	According to Canadian Black Book,
							 	</font>
							 	<br>
							 	<font style="font-size:13pt">
							 	Your ' . ucwords($info['years'] . ' ' . $info['makes'] . ' ' . $info['models']) . '  Is Worth <u>$' . number_format($info['values']['tradeInLow']) . ' - $' . number_format($info['values']['tradeInHigh']) . '</u>

							 	</font>

							 	</b>';

					switch ($blackbook)
					{
						case "no":
						case "NO":
						case "none":
						case "NONE":
						$bbook = "";     
						break;
						default:
						$bbook = $bbooke;
					 }
			}
			// NO VOUCHER (see below for attachement at bottom of email)
			$voucher =  $dealerInfo[$info['dealer']]['voucher'];
			$vouche = '<br><br>Your Savings Certificate is attached to this email.<br>Please print and bring with you to the dealership.';

					switch ($voucher)
					{
						case "no":
						case "NO":
						case "none":
						case "NONE":
						$vouch = "";			    
						break;
						default:
						$vouch = $vouche;
						break;
				 }


// BODY OF MESSAGE STARTS HERE

			$body = '
					 <font style="font-size:10pt;font-family:Arial">
					 	Dear ' . $info['firstname'] . ',
					 	<br><br>
					 	Thank you for your registration!' 

						//Black Book Value * Voucher Value * Gift Value * Bonus Value
						. $bbook .  $vouch . $perks . $extra .  
						'<br><br>
				 		<table cellspacing="0" cellpadding="0">
					 	<tr>
					 		<td style="font-size:10pt;font-family:Arial;padding:10px 0px">
					 			
					 			<b>Name:</b> ' . $info['firstname'] . ' ' . $info['lastname'] . '<br>
					 			<b>Email:</b> ' . $info['email'] . '<br>
					 			<b>Mobile:</b> ' . $info['mobile'] . '<br>
					 			<b>Address:</b> ' . $info['address'] . ' ' . $info['postalCode'] . '<br>
					 			<b>Year:</b> ' . $info['years'] . '<br>
					 			<b>Make:</b> ' . $info['makes'] . '<br>
					 			<b>Model:</b> ' . $info['models'] . '<br>
					 			<b>Trim:</b> ' . $info['trims'] . '<br>
					 			<b>Style:</b> ' . $info['styles'] . '<br>
					 			<b>KM:</b> ' . $info['kilometers'] . '<br>
					 			<!-- <b>Trade in Value:</b> '. ($info['values']['tradeInLow'] != "" && $info['values']['tradeInLow'] != 0 ? '$' . number_format($info['values']['tradeInLow']) . ' - $' . number_format($info['values']['tradeInHigh']) : '') . '
					 			<br>-->
					 			<b>Current Payment:</b> ' . $info['payment'] . '<br>
					 			<b>Months Remaining:</b> ' . $info['monthsRemaining'] . '<br>
					 			<b>Interested In:</b> ' . $info['nextVehicle'] . '<br>
					 		</td>
					 	</tr>
					 </table>
					</b>
					<br><br>						

		 			<b>' . $dealerInfo[$info['dealer']]['name'] . '</b><br>

		 			' . $dealerInfo[$info['dealer']]['address'] . '<br><br>

				 </font>

				 <br><br>

				 <font style="font-size:9pt">* Your vehicle may have significant more value based on equipment/trim level. Value is subject to full inspection & appraisal.</font>';
				
			//		}
			//}
	
// END: BODY OF MESSAGE
									
			$_SESSION['registerEmail']['info'] = $info;


//VOUCHER ATTACHED  - Naming the attachment				



	// NO VOUCHER (see below for attachement at bottom of email)
		$voucherjpg = $dealerInfo[$info['dealer']]['voucher'];

					switch ($voucherjpg)
					{
						case "no":
						case "NO":
						case "none":
						case "NONE":
						echo '';
						break;
						default:
							ob_start();
							include('rebateCertificateImage.php');
							$r_contents = ob_get_contents();
							ob_end_clean();

							$attachment = Swift_Attachment::newInstance($r_contents, "Load Up on Value Voucher.jpg", 'image/jpeg');  				
							$message->attach($attachment);
						break;

				 }
	
			$message->setBody($body, 'text/html');
			$message->setTo(array(trim($info['email'])));

			//see dealerEvent.php	

			$message->setBcc(array('dave@absoluteresults.com'));
			$message->setReturnPath('dave@absoluteresults.com');
			$message->setFrom($dealerInfo[$info['dealer']]['email1']);
			
			if($mailer->send($message))
			{
				echo 'true';
			}
			else
			{
				echo 'false';	
			}
			
		} 
		catch (Swift_TransportException $e) 
		{
				echo 'false';	
		} 
		catch (Swift_Message_MimeException $e) 
		{
				echo 'false';	
		}
    }
   
  ?>