validate(); } // Save Data In Session $form_step1->accept($GLOBALS['renderer']); $_SESSION['form1_smarty'] = $GLOBALS['renderer']->toArray(); $_SESSION['form1_data'] = $form_step1->exportValues(); $_SESSION['form1_html'] = $form_step1->toFrozenHtml(); // Send Mail if ($call_validate) { form_secured_export(1, $validate_ok); } // If Validation Failed if (!$validate_ok) { HTTP_Session::updateIdle(); HTTP_Session::pause(); // Add Submit Button $form_step1->addElement('submit', 'btnSubmit1', 'Begin', array('class' => 'btn', 'id' => 'btnSubmit1')); // Display Form $form_step1->accept($GLOBALS['renderer']); $GLOBALS['smarty']->assign('invalid_item', $form_step1->_validate_err); $GLOBALS['smarty']->assign('invalid_msg', $form_step1->_validate_msg); $GLOBALS['smarty']->assign('form', $GLOBALS['renderer']->toArray()); $GLOBALS['smarty']->assign('kw', urlencode($_SESSION['referer']['kw'])); $GLOBALS['smarty']->assign('ps', urlencode($_SESSION['referer']['program_search'])); if ( ($_SESSION['referer']['cam'] == "privacy") || ($_SERVER['PHP_SELF'] == "/privacy-policy.html")) { $GLOBALS['smarty']->display('privacy-policy.html'); } elseif ( ($_SESSION['referer']['cam'] == "terms") || ($_SERVER['PHP_SELF'] == "/terms-and-conditions.html")) { $GLOBALS['smarty']->display('terms-and-conditions.html'); } elseif ( ($_SESSION['referer']['cam'] == "how") || ($_SERVER['PHP_SELF'] == "/how-it-works.html")) { $GLOBALS['smarty']->display('how-it-works.html'); } elseif ( ($_SESSION['referer']['cam'] == "contacts") || ($_SERVER['PHP_SELF'] == "/contact-us.html")) { $GLOBALS['smarty']->display('contact-us.html'); } elseif ( ($_SESSION['referer']['cam'] == "about") || ($_SERVER['PHP_SELF'] == "/about-us.html")) { $GLOBALS['smarty']->display('about-us.html'); } elseif ( ($_SESSION['referer']['cam'] == "axa") || ($_SERVER['PHP_SELF'] == "/axa-life-insurance.html")) { $GLOBALS['smarty']->assign('brand',"AXA"); $GLOBALS['smarty']->display('brand-life-insurance.html'); } else { $GLOBALS['smarty']->display('all_form_step1.html'); } return false; // do not continue to next form } return true; // continue to next form } function form_step2($call_validate) { ///////////////////////////////////////////////////////////////// // Redirect to iframe ///////////////////////////////////////////////////////////////// // If Special Case /* if ($_SESSION['form1_data']['car_clear'] == '3') { // Close Session HTTP_Session::updateIdle(); HTTP_Session::pause(); // Show Payday Quiddy return form_step2_iframe(); //return form_step2_loan_list(); // sorry.html } */ ///////////////////////////////////////////////////////////////// // Form step 2 ///////////////////////////////////////////////////////////////// $form_step2 = new HTML_Quickform_Insurance('frmTest', 'post', $GLOBALS['options']); // Validate $validate_ok = false; if ($call_validate) { $validate_ok = $form_step2->validate(); } // Save Data In Session $form_step2->accept($GLOBALS['renderer']); $_SESSION['form2_smarty'] = $GLOBALS['renderer']->toArray(); $_SESSION['form2_data'] = $form_step2->exportValues(); $_SESSION['form2_html'] = $form_step2->toFrozenHtml(); // Send Mail if ($call_validate) { form_secured_export(2, $validate_ok, $show_pic); } // If Validation Failed if (!$validate_ok) { HTTP_Session::updateIdle(); HTTP_Session::pause(); // Add Submit Button $form_step2->addElement('submit', 'btnSubmit2', 'Get Quote', array('class' => 'btn', 'id' => 'btnSubmit2')); // Display Form $form_step2->accept($GLOBALS['renderer']); $partner = ($_SESSION['form1_data']['application_type'] == 'You & Your Partner') ? 'true' : ''; $GLOBALS['smarty']->assign('invalid_item', $form_step2->_validate_err); $GLOBALS['smarty']->assign('invalid_msg', $form_step2->_validate_msg); $GLOBALS['smarty']->assign('form', $GLOBALS['renderer']->toArray()); $GLOBALS['smarty']->assign('partner', $partner); $GLOBALS['smarty']->assign('kw', urlencode($_SESSION['referer']['kw'])); $GLOBALS['smarty']->assign('ps', urlencode($_SESSION['referer']['program_search'])); if ( ($_SESSION['referer']['cam'] == "axa") || ($_SERVER['PHP_SELF'] == "/axa-life-insurance.html")) { $GLOBALS['smarty']->assign('brand',"AXA"); $GLOBALS['smarty']->display('brand-life-insurance_step2.html'); } else { $GLOBALS['smarty']->display('all_form_step2.html'); } return false; // do not continue to next form } /* $result = $_SESSION['tch_result']; if ( ($result['tch_appSuccess'] == 0) && ($result['errorCode'] == 1109) ) { if ($result['errorField'] == "x_C1HomeTel") { $validate_ok = false; //$GLOBALS['smarty']->assign('phone_error',"Sorry - Phone Number Not Registered On Network.\nPlease ensure you've entered a valid Phone Number."); $GLOBALS['smarty']->assign('invalid_item','home_phone'); $GLOBALS['smarty']->assign('invalid_msg','Sorry - Phone Number Not Registered On Network.\nPlease ensure you have entered a valid Phone Number.'); $form_step2->addRule('home_phone', 'Sorry - Phone Number Not Registered On Network.\nPlease ensure you have entered a valid Phone Number.','lettersonly'); // Add Submit Button $form_step2->addElement('submit', 'btnSubmit2', '', array('class' => 'btn')); // Assign Additional Smarty Data $form_step2->accept($GLOBALS['renderer']); $GLOBALS['smarty']->assign('form', $GLOBALS['renderer']->toArray()); $GLOBALS['smarty']->display('all_form_insurance_step2.html'); return false; } if ($result['errorField'] == "x_C1MobilePhoneNo") { $validate_ok = false; //$GLOBALS['smarty']->assign('phone_error',"Sorry - Mobile Phone Number Not Registered On Network.\nPlease ensure you've entered a valid Mobile Phone Number."); $GLOBALS['smarty']->assign('invalid_item','mobile_phone'); $GLOBALS['smarty']->assign('invalid_msg','Sorry - Mobile Phone Number Not Registered On Network.\nPlease ensure you have entered a valid Mobile Phone Number.'); $form_step2->addRule('mobile_phone', 'Sorry - Mobile Phone Number Not Registered On Network.\nPlease ensure you have entered a valid Mobile Phone Number.','lettersonly'); // Add Submit Button $form_step2->addElement('submit', 'btnSubmit2', '', array('class' => 'btn')); // Assign Additional Smarty Data $form_step2->accept($GLOBALS['renderer']); $GLOBALS['smarty']->assign('form', $GLOBALS['renderer']->toArray()); $GLOBALS['smarty']->display('all_form_insurance_step2.html'); return false; } } */ return true; // continue to next form } function form_step3($call_validate) { $GLOBALS['smarty']->assign('kw', urlencode($_SESSION['referer']['kw'])); $GLOBALS['smarty']->assign('ps', urlencode($_SESSION['referer']['program_search'])); $GLOBALS['smarty']->display('thankyou.html'); return true; // continue to next form } function form_step2_redirect() { header('Location: http://slicenet.theslice.co.uk/z/15304/CD1154/'); exit(); } function form_step2_iframe() { header('Location: ' . $config_http . 'unsecured_loan.php'); exit(); } function form_step2_loan_list() { header('Location: ' . $config_http . 'sorry.html'); exit(); } function get_step() { // Get Form Step From Session $form_step_session = isset($_SESSION['form_step']) ? $_SESSION['form_step'] : 0; // Get Form Step From Submit Button $form_step_submit = 0; if (isset($_REQUEST['btnSubmit1'])) { $form_step_submit = 1; } if (isset($_REQUEST['btnSubmit2'])) { $form_step_submit = 2; } $result = 0; $result = max($result, min($form_step_session, $form_step_submit)); HTTP_Session::set('form_step', $result); return $result; } function form_secured_export($form_id, $validate_ok) { // Get Export Type Variables $opened = false; $lastform = false; $completed = false; $validated = $validate_ok; if (($form_id == 0) && ($validated)) { $opened = true; } elseif (($form_id == 2) && (!$validated)) { $lastform = true; } elseif (($form_id == 2) && ($validated)) { $completed = true; } // Export Type $export_type = ""; $export_type_short = ""; if ($opened) { $export_type .= ' [OPENED]'; $export_type_short .= "OPENED"; } elseif ($completed) { $export_type .= ' [COMPLETED]'; $export_type_short .= "COMPLETED"; } else { $export_type .= ' FormID ' . $form_id; $export_type_short .= 'F' . $form_id; if ($validated) { $export_type .= ' [VALIDATED]'; $export_type_short .= "-VALID"; } else { } } // Application $application = ""; if ($form_id == 2) { $application = 'Accountancy'; } else { $application = 'Accountancy'; } // Save File if ($GLOBALS['file_save']) { // Subject $subject = $GLOBALS['file_dir'] . date("Ymd-His") . '-' . session_id() . '-' . $application . '-' . $export_type_short . '.html'; // HTML $html = ''; switch($form_id) { case 2: $html = $_SESSION['form2_html'] . $html; case 1: $html = $_SESSION['form1_html'] . $html; } $html = $_SESSION['referer']['HTML'] . $html; $html = '' . '' . $html . ''; // Save File ex_file2($form_id, $validated, $html, $subject); } // Send TCH if ($GLOBALS['tch_send']) { foreach ($GLOBALS['tch_configs'] as $tch_config) { if ($tch_config['enabled'] == true) { if ($completed) { $url = "https://paddockmedia.leadspediatrack.com/post.do"; $lp_offer_id = "13"; $lp_campaign_id = "5bf3d9a478564"; //'ip_address' => $_SESSION['IPAddress'] //'lp_test' => '1', //'your_name' => $_SESSION['form2_data']['name'], $full_name = $_SESSION['form2_data']['first_name'] . " " . $_SESSION['form2_data']['last_name']; $lead_data = array('lp_offer_id' => $lp_offer_id, 'lp_campaign_id' => $lp_campaign_id, 'your_name' => $full_name, 'first_name' => $_SESSION['form2_data']['first_name'], 'last_name' => $_SESSION['form2_data']['last_name'], 'phone_home' => $_SESSION['form2_data']['home_phone'], 'email_address' => $_SESSION['form2_data']['email'], 'annual_turnover' => $_SESSION['form1_data']['annual_turnover'], 'company' => $_SESSION['form1_data']['company_name'], 'monthly_transactions' => $_SESSION['form1_data']['monthly_transaction'], 'payroll_required' => $_SESSION['form1_data']['payroll_required'], 'employees' => $_SESSION['form1_data']['number_of_employees'], ); // Subject $subject_file = date("Ymd-His") . '-' . session_id() . '-' . $application . '-' . $export_type_short; $subject_mail = $tch_config['mail_subject']; if ($tch_config['mail_light'] == false) { $subject_mail .= 'UK Lead SI ' . session_id(); } else { $subject_mail .= ' IP ' . $_SESSION['referer']['IP']; } $subject_mail .= ' ' . $application . $export_type; $Success = ex_paddock($lead_data, $url, $subject_file, $tch_config['file_configs'], $subject_mail, $tch_config['mail_configs']); } } } } // Send Mail if ($GLOBALS['mail_send']) { foreach ($GLOBALS['mail_configs'] as $mail_config) { if ($mail_config['enabled'] == true) { if (($opened && $mail_config['send_opened']) || ($lastform && $mail_config['send_lastform']) || ($completed && $mail_config['send_completed']) || ((!$opened) && $validated && $mail_config['send_validated']) || ((!$opened) && (!$validated) && $mail_config['send_invalidated'])) { // Subject $subject = $mail_config['subject']; if ($mail_config['light'] == false) { $subject .= ' SI ' . session_id(); } else { $subject .= ' IP ' . $_SESSION['referer']['IP']; } $subject .= ' ' . $application . $export_type; // HTML $html = ''; switch($form_id) { case 2: $html = $_SESSION['form2_html'] . $html; case 1: $html = $_SESSION['form1_html'] . $html; } if ($mail_config['light'] == false) { $html = $_SESSION['referer']['HTML'] . $html; } else { $html = "IP: " . $_SESSION['referer']['IP'] . "
" . $html; } $html = '' . '' . $html . ''; // Send Mail ex_mail2($mail_config['from'], $mail_config['to'], $html, $subject); } } } } // Send SMS if ($GLOBALS['sms_send']) { foreach ($GLOBALS['sms_configs'] as $sms_config) { if ($sms_config['enabled'] == true) { if (($opened && $sms_config['send_opened']) || ($lastform && $sms_config['send_lastform']) || ($completed && $sms_config['send_completed']) || ((!$opened) && $validated && $sms_config['send_validated']) || ((!$opened) && (!$validated) && $sms_config['send_invalidated'])) { // Subject $subject = $sms_config['subject'] . ' ' . $application . ' ' . $export_type_short; $subject .= ($Success) ? ' [Submited]' : ' [Not Submited]'; // Text $txt = 'IP:' . $_SESSION['referer']['IP']; //$txt = 'A:' . $_SESSION['form1_data']['ld_amount'] . ' ' . 'P:' . $_SESSION['form1_data']['ld_purpose'] ; if ($sms_config['light'] == false) { $txt .= ' KW1:' . $_SESSION['referer']['program_search'] . ' KW2:' . $_SESSION['referer']['kw'] ; //' SID:' . $_SESSION['referer']['session_id']; } // Send Mail ex_sms2($sms_config['from'], $sms_config['to'], $txt, $subject); } } } } } ?>