MSV FM

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

<?php 
	include_once('includes.php'); 
	include_once('displayUtils.php'); 

	
	$bbLink = 'http://xml.canadianblackbook.com/XMLWebServices/service?&account=absolute_xml&key=Dgje48Sw39&schemaVersion=3.0&';
	
	$lists = array('years','makes','models','trims','styles');
	
	if(isset($_GET['getList']))
	{
		$curKey = array_search($_GET['getList'],$lists);
 		
   		if($_GET['getList'] == 'years')
   		{
			$xml = simplexml_load_file($bbLink . 'command=' . $_GET['getList']);
   			$list = $xml->response->years->year;
   			
   			if($list == '') exit;
   		}
   		else if($_GET['getList'] == 'makes')
   		{
			$xml = simplexml_load_file($bbLink . 'year=' . $_GET['year'] . '&command=' . $_GET['getList']);
			$list = $xml->response->makes->make;
   			if($list == '') exit;
		}
   		else if($_GET['getList'] == 'models')
   		{
			$xml = simplexml_load_file($bbLink . 'year=' . $_GET['year'] . '&make=' . urlencode($_GET['make']) . '&command=' . $_GET['getList']);
			$list = $xml->response->models->model;
   			if($list == '') exit;
		}
   		else if($_GET['getList'] == 'trims')
   		{
			$xml = simplexml_load_file($bbLink . 'year=' . $_GET['year'] . '&make=' . urlencode($_GET['make']) . '&model=' . urlencode($_GET['model']) . '&command=' . $_GET['getList']);
			$list = $xml->response->trims->trim;
		}
   		else if($_GET['getList'] == 'styles')
   		{
			$xml = simplexml_load_file($bbLink . 'year=' . $_GET['year'] . '&make=' . urlencode($_GET['make']) . '&model=' . urlencode($_GET['model']) . '&trim=' . urlencode($_GET['trim']) . '&command=' . $_GET['getList']);
			$list = $xml->response->styles->style;
		}
   		
   		$html = '<select id="' . $_GET['getList'] . '" name="' . $_GET['getList'] . '"' . ($curKey < (count($lists)-1) ? ' onChange="getList(\'' .  $lists[$curKey+1] . '\')"' : '') . '>';
   		
   		if(count($list) > 1) $html .= '<option value=""></option>';
   		if($list == '') $html .= '<option value="">None</option>';
   		
   		foreach($list as $item)
   		{
   			$html .= '<option value="' . $item . '">' . $item . '</option>';
   		}
   		$html .= '</select>';
   		?>
   		document.getElementById('<?= $_GET['getList'] ?>Div').innerHTML = '<?= ajaxHTML($html) ?>';
   		<?php
   		
   		for($i = ($curKey+1); $i < count($lists); $i++)
   		{
	   		?>
	   		document.getElementById('<?= $lists[$i] ?>Div').innerHTML = '';
	   		<?php
   		}
   		
   		if(($curKey < (count($lists)-1)) && count($list) == 1)
   		{
	   		?>
	   		getList('<?= $lists[$curKey+1]?>');
	   		<?php   			
   		}
   		
   		exit;
	}
	
	if(isset($_GET['submitList']))
	{
		unset($_SESSION['registration']['customer']);
		unset($_SESSION['registration']['tradeIn']);
		foreach($_GET as $key => $val)
		{
			if(in_array($key,array('firstname','lastname','email','mobilePhone','postalCode'))) $_SESSION['registration']['customer'][$key] = $val;
			else $_SESSION['registration']['tradeIn'][$key] = $val;
		}
		$xml = simplexml_load_file($bbLink . 'kilometers=' . ereg_replace("[^0-9]", "", $_SESSION['registration']['tradeIn']['kilometers']) . '&year=' . $_SESSION['registration']['tradeIn']['years'] . '&make=' . urlencode($_SESSION['registration']['tradeIn']['makes']) . '&model=' . urlencode($_SESSION['registration']['tradeIn']['models']) . '&trim=' . urlencode($_SESSION['registration']['tradeIn']['trims']) . '&style=' . urlencode($_SESSION['registration']['tradeIn']['styles']) . '&command=priceVehicle');
		$list = $xml->response->vehicles->vehicle->values;
		$_SESSION['registration']['tradeIn']['values'] = get_object_vars ($list);
			
		?>
		document.getElementById('emailFrame').src = 'http://ar.absoluteresults.com/greatestautosale2013/cbbEmail.php?regID=<?= urlencode(serialize($_SESSION['registration'])) ?>';
		document.getElementById('testDiv').innerHTML = '';
		<?php
		exit;		
	}
?>
<html>
	<head>
		<script src="scripts/ajax.js" language="javascript"></script>
		<script>
			function getList(val)
			{
				htmlStr = 'cbb.php?getList=' + val;
				var arr = new Array('years','makes','models','trims','styles');
				var arr2 = new Array('year','make','model','trim','style');
				for (var i = 0; i < arr.length; i++) 
				{
				  var temp = '';
				  if(document.getElementById(arr[i]) != undefined)  temp=encodeURIComponent(document.getElementById(arr[i]).value);
				  htmlStr = htmlStr + '&' + arr2[i] + '=' + temp;
				}
				
				ajax_do(htmlStr);
				
			}
			function submitList()
			{				
				htmlStr = 'cbb.php?submitList=';
				var arr = new Array('firstname','lastname','email','mobilePhone','postalCode','years','makes','models','trims','styles','kilometers');
				for (var i = 0; i < arr.length; i++) 
				{					
					if(arr[i] != 'trims' && document.getElementById(arr[i]).value == "") 
					{
						alert('Please complete all the fields to get your trade-in value.\nThank you.');
						return false;
					}
					var temp = '';
					if(document.getElementById(arr[i]) != undefined)  temp=encodeURIComponent(document.getElementById(arr[i]).value);
					htmlStr = htmlStr + '&' + arr[i] + '=' + temp;
				}
				
				document.getElementById('submitButton').value = 'Please wait...';
				document.getElementById('submitButton').disabled = true;
				
				ajax_do(htmlStr);
			}
			
			function emailSent()
			{
				if(document.getElementById('emailFrame').src != "")
				{
					alert('Thank you for your submission.\nPlease check your email for details.');
					document.getElementById('submitButton').disabled = false;
					document.getElementById('submitButton').value = 'Submit';
					parent.$.fancybox.close();
				}
			}
			
		</script>
		<style>
			.formTbl {height:100px}
			.formTbl td,.formTbl th {font-family:arial;padding-right:20px;height:23px;text-align:left}
		</style>
	</head>
	<body>
		<table cellspacing="0" cellpadding="0" class="formTbl">
			<tr>
				<td colspan="2" style="padding-bottom:20px;font-size:11pt">
					<b>Get your Canadian Black Book<sup>&reg;</sup> appraisal for your vehicle.</b>
					<br>
					Begin by selecting the year of your vehicle.
				</td>
			</tr>
			<tr>
				<td style="vertical-align:top;width:350px">
					<table cellspacing="0" cellpadding="0" class="formTbl">
						<tr>
							<th>First Name</th>
							<td><input type="text" style="width:200px" id="firstname" name="firstname" value="<?= $_SESSION['registration']['customer']['firstname'] ?>"></td>
						</tr>
						<tr>
							<th>Last Name</th>
							<td><input type="text" style="width:200px" id="lastname" name="lastname" value="<?= $_SESSION['registration']['customer']['lastname'] ?>"></td>
						</tr>
						<tr>
							<th>Email</th>
							<td><input type="text" style="width:200px" id="email" name="email" value="<?= $_SESSION['registration']['customer']['email'] ?>"></td>
						</tr>
						<tr>
							<th>Mobile Phone</th>
							<td><input type="text" style="width:200px" id="mobilePhone" name="mobilePhone" value="<?= $_SESSION['registration']['customer']['mobilePhone'] ?>"></td>
						</tr>
						<tr>
							<th>Postal/Zip Code</th>
							<td><input type="text" style="width:200px" id="postalCode" name="postalCode" value="<?= $_SESSION['registration']['customer']['postalCode'] ?>"></td>
						</tr>
					</table>
				</td>
				<td>
					<table cellspacing="0" cellpadding="0" class="formTbl">
						<tr>
							<th>Year</th>
							<td style=""><div id="yearsDiv" style="display:inline"></div></td>
						</tr>
						<tr>
							<th>Make</th>
							<td><div id="makesDiv" style="display:inline"></div></td>
						</tr>
						<tr>
							<th>Model</th>
							<td><div id="modelsDiv" style="display:inline"></div></td>
						</tr>
						<tr>
							<th>Trim</th>
							<td><div id="trimsDiv" style="display:inline"></div></td>
						</tr>
						<tr>
							<th>Style</th>
							<td><div id="stylesDiv" style="display:inline"></div></td>
						</tr>
						<tr>
							<th>KM</th>
							<td><input type="text" style="width:100px" id="kilometers" name="kilometers"></td>
						</tr>
					</table>
				</td>
			</tr>
		</table>
		<br><br>
		<center>
			<input type="button" id="submitButton" style="font-size:20pt;padding:10px;" value="Submit" onClick="submitList()">
		</center>
		<iframe id="emailFrame" height="0" width="0" frameborder="0" onload="emailSent()"></iframe>
		<div id="testDiv"></div>
		
		<script>
			getList('years');
		</script>
	</body>
</html>