<?php

$from_airport = $_REQUEST['from_airport'];
$to_airport = $_REQUEST['to_airport'] ;
$date1 = $_REQUEST['date1'] ;
$class = $_REQUEST['class'] ;
$num_of_pass = $_REQUEST['num_of_pass'] ;
$name = $_REQUEST['name'] ;
$phone = $_REQUEST['phone'] ;
$email = $_REQUEST['email'] ;
$comments = $_REQUEST['comments'] ;

  if (!isset($_REQUEST['email'])) {
    header( "Location: http://www.flybusinesscheap.com/mobile/flightquoteform/flightquoteform.html" );
  }
  elseif ($from_airport=='' || $from_airport=='From Airport or City*' || $to_airport=='' || $to_airport=='To Airport or City*' || $date1==''|| $email=='' || $email=='Your Email*' || $name=='' || $name=='Your Name*' || $phone=='' || $phone=='Your Telephone*' ) {
?>
<!doctype html>
<html lang="us">
<head>
	<meta charset="utf-8">
	<title>Flight Price Quote Request</title>
	<link href="css/cupertino/jquery-ui-1.10.0.custom.css" rel="stylesheet">
	<script src="js/jquery-1.9.0.js"></script>
	<script src="js/jquery-ui-1.10.0.custom.js"></script>
	<script src="js/all-func.js"></script>
	<style>
	body{
		font: 62.5% "Trebuchet MS", sans-serif;
		margin: 50px;
	}
	.demoHeaders {
		margin-top: 2em;
	}
	#dialog-link {
		padding: .4em 1em .4em 20px;
		text-decoration: none;
		position: relative;
	}
	#dialog-link span.ui-icon {
		margin: 0 5px 0 0;
		position: absolute;
		left: .2em;
		top: 50%;
		margin-top: -8px;
	}
	#icons {
		margin: 0;
		padding: 0;
	}
	#icons li {
		margin: 2px;
		position: relative;
		padding: 4px 0;
		cursor: pointer;
		float: left;
		list-style: none;
	}
	#icons span.ui-icon {
		float: left;
		margin: 0 4px;
	}
	.fakewindowcontain .ui-widget-overlay {
		position: absolute;
	}
	.ui-autocomplete {
		max-height: 100px;
		overflow-y: auto;
		/* prevent horizontal scrollbar */
		overflow-x: hidden;
	}
	/* IE 6 doesn't support max-height
	 * we use height instead, but this forces the menu to always be this tall
	 */
	* html .ui-autocomplete {
		height: 100px;
	}

	</style>
</head>
<body style="margin-left:10px;">

<div class="ui-widget">
	<div class="ui-state-error ui-corner-all" style="padding-left:.7em; padding-right:.7em; padding-top:0; padding-bottom:0">
		<p><span class="ui-icon ui-icon-alert" style="float: left; margin-right: .3em; padding-top:.3em;"></span>
		<strong>ERROR MESSAGE:</strong></p>
	</div>
<div style="float:left; padding-top:.3em; padding-right:.3em;">&nbsp;</div>
<p><span style="font-size: 16px;">Please fill up all required fields<br>
&nbsp;denoted with asterisks.</span> <br /><br />
<a href="flightquoteform.html"><button id="button">Click Here & Try Again</button></a>
</p>

<p><span style="font-size: 16px;">You may also call us toll free:</span><br />
<span style="font-size: 20px;"><strong>800-818-2451</strong></span>
</p></div>
</body>
</html>
   
<?php  
}
else {
// enter path to your counter file, leave alone if 
// it is in the same directory as the script. 
$counter_file = "./counter.cnt";

// confirmation number alpha prefix.  This is here in the 
// event that you have multiple forms you can distinguish the
// numbers based on this entry.  For example, in the default 
// below the conf. number would look something like: TS-40032.
// The TS might tell you this is a Tech Support message. 
$pre_conf_f = "OWF-";
$pre_conf_c = "TC-";
$pre_conf_p = "TP-";

// get the counter number 
$count_file = fopen("$counter_file", "r");
while (!feof($count_file)) 
{
$number = fread($count_file, 1024);
}
$conf_no = "$pre_conf_f$number";
fclose($count_file);
// Got the counter number, now move on. 

// Open the counter and increase the number by one. 
$fileopen = fopen("$counter_file", "w");
flock($fileopen, LOCK_EX);
$new_number = ($number + 1);
fwrite($fileopen, "$new_number");
fclose($fileopen);
// Finnished with the math!

$message="

Quote Request Confirmation
Reference Number: ".$conf_no."

CONTACT INFO:

Name: ".$name."
Telephone: ".$phone."
Email: ".$email."

FLIGHT DETAILS:

From: ".$from_airport."
To: ".$to_airport."
Depart Date: ".$date1."
Class: ".$class."
Number of Passengers: ".$num_of_pass."
Comments: ".$comments."

Thank you! You will be contacted by our representative.

Sent via FBC-mobile.

";
$message = stripslashes($message);
mail("info@flybusinesscheap.com","QUOTE REQUEST $conf_no",$message,"From: $name");
$message2 = stripslashes($message);
mail("$email","Online Request Confirmation $conf_no",$message,"From: flybusinesscheap.com");
?>

<!-- This is the content of the Thank you page, be careful while changing it -->
<!doctype html>
<html lang="us">
<head>
	<meta charset="utf-8">
	<title>Flight Price Quote Request</title>
	<link href="css/cupertino/jquery-ui-1.10.0.custom.css" rel="stylesheet">
	<script src="js/jquery-1.9.0.js"></script>
	<script src="js/jquery-ui-1.10.0.custom.js"></script>
	<script src="js/all-func.js"></script>
	<style>
	body{
		font: 62.5% "Trebuchet MS", sans-serif;
		margin: 50px;
	}
	.demoHeaders {
		margin-top: 2em;
	}
	#dialog-link {
		padding: .4em 1em .4em 20px;
		text-decoration: none;
		position: relative;
	}
	#dialog-link span.ui-icon {
		margin: 0 5px 0 0;
		position: absolute;
		left: .2em;
		top: 50%;
		margin-top: -8px;
	}
	#icons {
		margin: 0;
		padding: 0;
	}
	#icons li {
		margin: 2px;
		position: relative;
		padding: 4px 0;
		cursor: pointer;
		float: left;
		list-style: none;
	}
	#icons span.ui-icon {
		float: left;
		margin: 0 4px;
	}
	.fakewindowcontain .ui-widget-overlay {
		position: absolute;
	}
	.ui-autocomplete {
		max-height: 100px;
		overflow-y: auto;
		/* prevent horizontal scrollbar */
		overflow-x: hidden;
	}
	/* IE 6 doesn't support max-height
	 * we use height instead, but this forces the menu to always be this tall
	 */
	* html .ui-autocomplete {
		height: 100px;
	}

	</style>
</head>
<body style="margin-left:10px;">

<div class="ui-widget">
	<div class="ui-state-highlight ui-corner-all" style="padding-left:.7em; padding-right:.7em; padding-top:0; padding-bottom:0">
		<p><span class="ui-icon ui-icon-info" style="float: left; margin-right: .3em; padding-top:.3em;"></span>
		<strong>THANK YOU!</strong></p>
	</div>

<div style="float:left; padding-top:.3em; padding-right:.3em;">&nbsp;</div>
<p><span style="font-size: 16px;">Your Reference Number: <br />
<strong><?php echo $conf_no; ?></strong></span></p>

<p><span style="font-size: 12px;">Our Luxury Travel Specialists<br>
will process your request and<br>
contact you as soon as possible.</span> <br />

<p><span style="font-size: 12px;">You may also call us toll free:</span><br />
<span style="font-size: 20px;"><strong>800-818-2451</strong></span>
</p></div>
</body>
</html>

<?php
}
?>