[insert_php]
$CONF = array();
define(‘EXCEL’, 1);

// Default timezone for php date()
date_default_timezone_set(‘America/Los_Angeles’);

// Set encoding for multi-byte string functions
mb_internal_encoding(“UTF-8”);

// Change the path to your full path if necessary
$CONF[‘path’] = ‘.’;

//Database connection
require_once (“{$CONF[‘path’]}/config.php”);
require_once (“{$CONF[‘path’]}/sources/sql/pdo.php”);
$DB = new DB($CONF[‘sql_host’], $CONF[‘sql_username’], $CONF[‘sql_password’], $CONF[‘sql_database’]);

require_once(“{$CONF[‘path’]}/sources/functions.php”);
$error = ”;
$success = ”;

// User login
if (isset($_POST[‘login’]))
{
$DB->bind(“app_id”, $_POST[‘app_id’], PDO::PARAM_INT);
$DB->bind(“password”, md5($_POST[‘password’]));
$app_id = $DB->single(“SELECT id FROM {$CONF[‘sql_prefix’]}_users WHERE id = :app_id AND password = :password”);

if($app_id)
{
$upload = isset($_GET[‘upload’]) ? ‘?upload=1’ : ”;

require_once(“{$CONF[‘path’]}/sources/misc/session.php”);
$session = new session;
$session->create(‘apply’, $app_id, 1);
header(“Location: /apply.php{$upload}”);
exit;
}
else {
$error .= ‘<p class=”message_red”>Application does not exist</p>’;
}
}

// Forgot pass
if (isset($_POST[‘reset’]))
{

$DB->bind(“EMailAddress”, $_POST[‘reset_email’]);
$result = $DB->query(“SELECT id, EMailAddress FROM {$CONF[‘sql_prefix’]}_users WHERE EMailAddress = :EMailAddress”);

if($result)
{
$email = ”;

$subject = ‘Excel Credit: Aircraft Application password reset’;

$body = “We have found the following applications tied to your email address. To continue your application, please login at http://www.aircraftfinancingdirect.com/apply.php using the following credentials.\r\n\r\n”;

foreach($result as $row)
{
$email = $row[‘EMailAddress’];

$password = mt_rand(10000, 200000);

$body .= “Application ID: {$row[‘id’]}\r\n”;
$body .= “Password: {$password}\r\n\r\n”;

$DB->bind(“password”, md5($password));
$DB->bind(“app_id”, $row[‘id’]);
$DB->query(“UPDATE {$CONF[‘sql_prefix’]}_users SET password = :password WHERE id = :app_id”);
}
$body = nl2br($body);

/*
require_once(“{$CONF[‘path’]}/sources/misc/class.phpmailer.php”);
$mail = new PHPMailer;
$mail->IsSMTP(); // Set mailer to use SMTP
$mail->Host = ‘smtp.excelcredit.com’; // Specify main and backup server
$mail->SMTPAuth = true; // Enable SMTP authentication
$mail->Port = 587; // SMTP Port
$mail->Username = ‘boat@excelcredit.com’; // SMTP username
$mail->Password = ‘#$Eci#$14’; // SMTP password
$mail->SMTPSecure = ‘tls’; // Enable encryption, ‘ssl’ also accepted
$mail->CharSet = ‘UTF-8’;

$mail->From = “boat@excelcredit.com”;
$mail->FromName = “Excel Credit”;
$mail->AddAddress(“{$email}”); // Add recipient
$mail->AddReplyTo(“boat@excelcredit.com”, “Excel Credit”); // Name is optional

$mail->WordWrap = 50; // Set word wrap to 50 characters
$mail->IsHTML(true); // Set email format to HTML

$mail->Subject = $subject;
$mail->Body = $body;

if($mail->Send())
{
$success .= ‘<p class=”message_green”>Password reset: We have sent login data to specified email address.</p>’;
}
*/

$headers = ‘MIME-Version: 1.0’ . “\r\n”;
$headers .= ‘Content-type: text/html; charset=UTF-8’ . “\r\n”;
$headers .= “From: Excel Credit <boat@excelcredit.com>\r\n”;

if(mail($email, $subject, $body, $headers))
{
$success .= ‘<p class=”message_green”>Password reset: We have sent login data to specified email address.</p>’;
}
else
{
$error .= ‘<p class=”message_red”>Password reset: There was an error sending the email.</p>’;
}

}
else {
$error .= ‘<p class=”message_red”>Password reset: We could not find such email address.</p>’;
}
}

// Logout
if (isset($_GET[‘logout’]) && $_GET[‘logout’] == 1)
{
require_once(“{$CONF[‘path’]}/sources/misc/session.php”);
$session = new session;
$session->delete($_COOKIE[‘Aircraft_sid_apply’]);
header(“Location: /apply.php”);
exit;
}

// Save form
if(isset($_POST[‘save’]) || isset($_POST[‘done’]) && $_POST[‘done’] == 1)
{
$save[‘xml’][‘Applicant’] = $_POST[‘Applicant’];
$save[‘xml’][‘Applicant’][‘fZip’] = $_POST[‘fZip’];
$save[‘xml’][‘Applicant’][‘fZip2’] = $_POST[‘fZip2’];
$save[‘xml’][‘Applicant’][‘fLandlord’] = $_POST[‘fLandlord’];
$save[‘xml’][‘Applicant’][‘fPayment’] = $_POST[‘fPayment’];
$save[‘xml’][‘Applicant’][‘fEmpPhone’] = $_POST[‘fEmpPhone’];
$save[‘xml’][‘Applicant’][‘fEmpExt’] = $_POST[‘fEmpExt’];
$save[‘xml’][‘Applicant’][‘fGross’] = $_POST[‘fGross’];
$save[‘xml’][‘Applicant’][‘fPrevResZip’] = $_POST[‘fPrevResZip’];
$save[‘xml’][‘Applicant’][‘fPRevResZip2’] = $_POST[‘fPRevResZip2’];
$save[‘xml’][‘Applicant’][‘fNRZip’] = $_POST[‘fNRZip’];
$save[‘xml’][‘Applicant’][‘fNRZip2’] = $_POST[‘fNRZip2’];

$save[‘xml’][‘CoApplicant’] = $_POST[‘CoApplicant’];
$save[‘xml’][‘CoApplicant’][‘fCoZip’] = $_POST[‘fCoZip’];
$save[‘xml’][‘CoApplicant’][‘fCOZip2’] = $_POST[‘fCOZip2’];
$save[‘xml’][‘CoApplicant’][‘fCoEmpPhone’] = $_POST[‘fCoEmpPhone’];
$save[‘xml’][‘CoApplicant’][‘fCoEmpExt’] = $_POST[‘fCoEmpExt’];
$save[‘xml’][‘CoApplicant’][‘fCoGross’] = $_POST[‘fCoGross’];
$save[‘xml’][‘CoApplicant’][‘fCONRZip’] = $_POST[‘fCONRZip’];
$save[‘xml’][‘CoApplicant’][‘fCONRZip2’] = $_POST[‘fCONRZip2’];
if(isset($_POST[‘CoApplicant’][‘CoAddress_is_App’]) && $_POST[‘CoApplicant’][‘CoAddress_is_App’] == ‘on’) {
$save[‘xml’][‘CoApplicant’][‘CoAddress_is_App’] = 1;
}
else {
$save[‘xml’][‘CoApplicant’][‘CoAddress_is_App’] = 0;
}

$save[‘xml’][‘Collateral’] = $_POST[‘Collateral’];

$save[‘xml’][‘LoanRequest’] = $_POST[‘LoanRequest’];
$save[‘xml’][‘LoanRequest’][‘fSellerZip’] = $_POST[‘fSellerZip’];
$save[‘xml’][‘LoanRequest’][‘fSellerZip2’] = $_POST[‘fSellerZip2’];

$save[‘xml’][‘TradeIn’] = $_POST[‘TradeIn’];
if(isset($_POST[‘TradeIn’][‘TiNotApplicable’]) && $_POST[‘TradeIn’][‘TiNotApplicable’] == ‘on’) {
$save[‘xml’][‘TradeIn’][‘TiNotApplicable’] = 1;
}
else {
$save[‘xml’][‘TradeIn’][‘TiNotApplicable’] = 0;
}

// Get the return and catch possible errors
$return = apply_save($save[‘xml’]);

if(isset($return[‘not_valid’]))
{
$error .= ‘<p class=”message_red”>’;
foreach($return[‘not_valid’] as $msg)
{
$error .= $msg.'<br />’;
}
$error .= ‘</p>’;

}
else
{
// Logged in user update
if (!isset($return[‘password’]))
{
$success .= ‘<p class=”message_green”><strong>Successfully saved</strong>. <a href=”/apply.php”>Go Back</a></p>’;
}
else
{
$success .= ‘<p class=”message_green”><strong>Successfully saved</strong>. To continue editing your application please login using <strong>Application ID:</strong> ‘.$return[‘id’].’ <strong>Password:</strong> ‘.$return[‘password’].’.</p>’;

if (!isset($return[‘error’]))
{
$success .= ‘<p class=”message_green”>We have also emailed you the login data for future reference.</p>’;
}
else
{
$error .= ‘<p class=”message_red”><strong>Attention</strong>. ‘.$return[‘error’].'</p>’;
}
}
}
}
// Complete send form
if(!isset($_POST[‘save’]) && isset($_POST[‘done’]) && $_POST[‘done’] == 1)
{
$send[‘xml’][‘Applicant’] = $_POST[‘Applicant’];
$send[‘xml’][‘Applicant’][‘Zip’] = $_POST[‘fZip’].$_POST[‘fZip2’];
$send[‘xml’][‘Applicant’][‘EmployerPhone’] = $_POST[‘fEmpPhone’].$_POST[‘fEmpExt’];

$send[‘xml’][‘Applicant’][‘AnnualSalary’] = (strlen($_POST[‘fGross’]) > 0) ? (float)str_replace(‘,’, ”, $_POST[‘fGross’]) * 12 : ”;
$send[‘xml’][‘Applicant’][‘PreviousZip’] = $_POST[‘fPrevResZip’].$_POST[‘fPRevResZip2’];
$send[‘xml’][‘Applicant’][‘NearestRelativeZip’] = $_POST[‘fNRZip’].$_POST[‘fNRZip2’];

$send[‘xml’][‘CoApplicant’] = $_POST[‘CoApplicant’];
$send[‘xml’][‘CoApplicant’][‘CoZip’] = $_POST[‘fCoZip’].$_POST[‘fCOZip2’];
$send[‘xml’][‘CoApplicant’][‘CoEmployerPhone’] = $_POST[‘fCoEmpPhone’].$_POST[‘fCoEmpExt’];
$send[‘xml’][‘CoApplicant’][‘CoAnnualSalary’] = (strlen($_POST[‘fCoGross’]) > 0) ? (float)str_replace(‘,’, ”, $_POST[‘fCoGross’]) * 12 : ”;
$send[‘xml’][‘CoApplicant’][‘CoNearestRelativeZip’] = $_POST[‘fCONRZip’].$_POST[‘fCONRZip2’];
if(isset($_POST[‘CoApplicant’][‘CoAddress_is_App’]) && $_POST[‘CoApplicant’][‘CoAddress_is_App’] == ‘on’) {
$send[‘xml’][‘CoApplicant’][‘CoAddress_is_App’] = 1;
}
else {
$send[‘xml’][‘CoApplicant’][‘CoAddress_is_App’] = 0;
}

$send[‘xml’][‘Collateral’] = $_POST[‘Collateral’];

$send[‘xml’][‘LoanRequest’] = $_POST[‘LoanRequest’];
$send[‘xml’][‘LoanRequest’][‘SellerZip’] = $_POST[‘fSellerZip’].$_POST[‘fSellerZip2’];

$send[‘xml’][‘TradeIn’] = $_POST[‘TradeIn’];
if(isset($_POST[‘TradeIn’][‘TiNotApplicable’]) && $_POST[‘TradeIn’][‘TiNotApplicable’] == ‘on’) {
$send[‘xml’][‘TradeIn’][‘TiNotApplicable’] = 1;
}
else {
$send[‘xml’][‘TradeIn’][‘TiNotApplicable’] = 0;
}

// Get the return and catch possible errors
$xml_result = build_xml($send[‘xml’]);

if(isset($xml_result[‘not_valid’]))
{
$error .= ‘<p class=”message_red”>’;
foreach($xml_result[‘not_valid’] as $msg)
{
$error .= $msg.'<br />’;
}
$error .= ‘</p>’;

}
else
{
require_once(“{$CONF[‘path’]}/sources/misc/session.php”);
$session = new session;
$session->create(‘thank_you’, $send[‘xml’][‘Applicant’][‘EMailAddress’]);
header(“Location: /thank-you.php”);
exit;
}

}
$bigbannerclass = ‘ class=”big-banner1″‘;

$title = ‘Apply online For Aircraft | Jet Loans And Financing’;
$page = ‘apply’;

include(‘head.php’);
[/insert_php]

<body>
<div class=”header-holder”>
<div class=”rays”>
<div class=”header-area”>

&nbsp;<div id=”main”>
<div class=”main-area”>

<!– ***************** – START Title Bar – ***************** –>
<div class=”tools”>
<div class=”holder”>
<div class=”frame”>
<h1>Aircraft Loan Application Forms</h1>

<p class=”breadcrumb”><a href=”./”>Aircraft Loans</a><span class=’current_crumb’>Online and Offline Applications </span></p></div><!– end frame –>

</div><!– end holder –>
</div><!– end tools –>
<!– ***************** – END Title Bar – ***************** –>
<div class=”main-holder”>

<h1 class=”line_height_fix”>[insert_php] echo $title;[/insert_php]</h1>

[insert_php]
$login_ok = 0;
if (isset($_COOKIE[‘Aircraft_sid_apply’]))
{
require_once(“{$CONF[‘path’]}/sources/misc/session.php”);
$session = new session;
list($type, $app_id) = $session->get($_COOKIE[‘Aircraft_sid_apply’]);

if($type == ‘apply’)
{
$login_ok = 1;
}

}

if($login_ok)
{
require_once(“{$CONF[‘path’]}/sources/misc/session.php”);
$session = new session;
list($type, $app_id) = $session->get($_COOKIE[‘Aircraft_sid_apply’]);

$DB->bind(“app_id”, $app_id, PDO::PARAM_INT);
$row = $DB->row(“SELECT * FROM {$CONF[‘sql_prefix’]}_users WHERE id = :app_id”);

echo ‘<p class=”message_blue”><strong>Editing application id ‘.$row[‘id’].’:</strong> <a href=”/apply.php?logout=1″>Logout</a></p>’;
}
else
{
[/insert_php]
<div class=”message_blue”>
<div style=”float:right;width:230px;background: #fff;padding:5px 5px 0px 5px; border-radius: 5px;text-align: center;” id=”loginbutbox”>
<a class=”ka_button small_button small_coolblue” id=”showlogin” href=”#”><span>Login</span></a><br />
<p>WHEN RETURNING FROM PREVIOUSLY SAVED SESSION</p>

</div>
<div style=”display:none;” id=”loginbox”>
<h4>Continue from last time</h4>
<form action=”/apply.php[insert_php] echo isset($_GET[‘upload’]) ? ‘?upload=1’ : ”; [/insert_php]” method=”post” id=”login”>
<input type=”hidden” name=”login” value=”1″ />
<div class=”one_third”>
<label for=”app_id”>Application ID:</label>
<input name=”app_id” id=”app_id” type=”text” class=”in1″ />
</div>
<div class=”one_third”>
<label for=”password”>Password:</label>
<input name=”password” id=”password” type=”password” class=”in1″ />
</div>
<div class=”one_fifth_last”><a href=”#” class=”ka_button medium_button medium_coolblue” id=”reset”><span>Forgot Password</span></a> <a href=”javascript:{}” onclick=”document.getElementById(‘login’).submit();” class=”ka_button medium_button medium_coolblue”><span>Login</span></a></div>

</form>
</div>
<script type=”text/javascript”>
jQuery(function($) {

$( “#showlogin” ).click(function() {
$( “#loginbox” ).show( “slow” );
$( “#loginbutbox” ).hide();

});

});
</script>

<div class=”one_third”>Our online Aircraft Loan Credit Application is secured with a 256-Bit encryption. Once you complete your application and provide the required documentation, it will be reviewed by a Loan Officer and a credit decision will be made. You will then be contacted by a Loan Officer who will review the decision with you.</div>
</div>

[insert_php]
}

// Error and success messages
echo $success.$error;

// Show form only when not sending save or done
if(!isset($_POST[‘done’]) && !isset($_POST[‘save’]))
{
[/insert_php]

<form action=”/apply.php” method=”post” id=”apply_form” class=”custom_apply_form” enctype=”multipart/form-data”>

<div id=”apply_save”><input type=”submit” name=”save” value=”” /></div>

<div id=”wizard”>

<h3 class=”line_height_fix”>Applicant</h3>
[insert_php] include(‘steps/step1.php’);[/insert_php]

<h3 class=”line_height_fix”>Previous Residence (if current is less than 3 years)</h3>
[insert_php] include(‘steps/step2.php’);[/insert_php]

<h3 class=”line_height_fix”>Nearest Relative NOT living with you</h3>
[insert_php] include(‘steps/step3.php’);[/insert_php]

<h3 class=”line_height_fix”>Co-Applicant</h3>
[insert_php] include(‘steps/step4.php’);[/insert_php]

<h3 class=”line_height_fix”>Nearest Relative or your Co-Applicant NOT living with your Co-Applicant</h3>
[insert_php] include(‘steps/step5.php’);[/insert_php]

<h3 class=”line_height_fix”>Loan Details</h3>
[insert_php] include(‘steps/step6.php’);[/insert_php]

<h3 class=”line_height_fix”>Aircraft Details</h3>
[insert_php] include(‘steps/step7.php’);[/insert_php]

<h3 class=”line_height_fix”>Seller Details</h3>
[insert_php] include(‘steps/step8.php’);[/insert_php]

<h3 class=”line_height_fix”>Trade In Details</h3>
[insert_php] include(‘steps/step9.php’);[/insert_php]

<h3 class=”line_height_fix”>Personal Financial Statement</h3>
[insert_php] include(‘steps/step10.php’);[/insert_php]

</div>

<input type=”hidden” name=”done” value=”1″>
</form>

[insert_php] } [/insert_php]
<!– ***************** – END content – ***************** –>
</div><!– end main-holder –>
</div><!– main-area –>

[insert_php] include(“footer.php”);[/insert_php]
<script src=”/js/validate.js”></script>
<script src=”/js/jquery.steps.js”></script>
<script src=”/js/jquery.tooltipster.min.js”></script>

<script src=”/js/upload/vendor/jquery.ui.widget.js”></script>
<script src=”/js/upload/tmpl.min.js”></script>
<script src=”/js/upload/load-image.min.js”></script>
<script src=”/js/upload/canvas-to-blob.min.js”></script>
<script src=”/js/upload/jquery.blueimp-gallery.min.js”></script>
<script src=”/js/upload/jquery.iframe-transport.js”></script>
<script src=”/js/upload/jquery.fileupload.js”></script>
<script src=”/js/upload/jquery.fileupload-process.js”></script>
<script src=”/js/upload/jquery.fileupload-image.js”></script>
<script src=”/js/upload/jquery.fileupload-audio.js”></script>
<script src=”/js/upload/jquery.fileupload-video.js”></script>
<script src=”/js/upload/jquery.fileupload-validate.js”></script>
<script src=”/js/upload/jquery.fileupload-ui.js”></script>

<script type=”text/javascript”>
var l = [insert_php] echo $login_ok ? ‘true’ : ‘false’; [/insert_php];
var s = [insert_php] echo (isset($_GET[‘upload’]) && $_GET[‘upload’] == 1) ? 10 : 0; [/insert_php];
</script>
<script src=”/js/apply.js?version=1.0.1″></script>

<!–[if (gte IE 8)&(lt IE 10)]><script src=”/js/upload/cors/jquery.xdr-transport.js”></script><![endif]–>

</body>
</html>
[insert_php]
# close the connection
$DB = null;
[/insert_php]