".
"The server this script is hosted on is using PHP Version $php_version. ".
"Upgrade your server to PHP 5.2 and try again.";
array_push($errors, $php_error);
}else{
$php_check = 'good';
}
//======================================================================//
// ! CGI FIX
//======================================================================//
// Some hosts (was it GoDaddy?) complained without this
@ini_set('cgi.fix_pathinfo', 0);
//======================================================================//
// ! PHP 5.3 will complain without this
//======================================================================//
if(ini_get('date.timezone') == '') date_default_timezone_set('GMT');
// ! -- LOAD REQUIRED CLASSES
@require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR .'files/formsnap/formsnap.php');
//=============================================================//
// ! - CONFIGURE SETTINGS
//=============================================================//
// ! -- GENERAL
$ydfs_settings = array(); // to hold all of our settings variables
$ydfs_settings['debug'] = false; // true or false
$ydfs_settings['base_id'] = 'stacks_in_0_page2'; // stacks id for this base
$ydfs_settings['from_email'] = 'thomsons.motorfactors@gmail.com';
$ydfs_settings['from_name'] = 'name';
$ydfs_settings['reply_to_item'] = str_replace('#', '', 'email'); // must be field name
$subject_key = str_replace('#', '', 'carreg');
$ydfs_settings['subject'] = (isset($_POST['form'][$subject_key]) ? $_POST['form'][$subject_key] : 'Web Form Submission');
// ! -- RECIPIENTS // comma delimited
$ydfs_settings['to'] = 'thomsons.motorfactors@gmail.com'; // To
$ydfs_settings['cc'] = ''; // Cc
$ydfs_settings['bcc'] = ''; // Bcc
$ydfs_settings['date'] = date('r');
$ydfs_settings['encoding_method'] = 'quoted-printable'; // base64, 7bit, 8bit
$ydfs_settings['encoding_charset'] = 'utf-8';
$ydfs_settings['word_wrap'] = "50";
$ydfs_settings['success_redirect'] = false; // true or false
$ydfs_settings['success_url'] = '';
$ydfs_settings['error_redirect'] = false; // true or false
$ydfs_settings['error_url'] = '';
// ! -- RECEIPT
$ydfs_settings['send_receipt'] = false; // true or false
$ydfs_settings['receipt_prefix'] = 'Re: '; // precedes the receipt email subject
$ydfs_settings['receipt_attachments'] = false; // true or false
// ! --SECURITY
$ydfs_settings['allowed_file_types'] = "doc|xls|pdf|jpg|jpeg|png|gif|zip|rar|gz";
$ydfs_settings['use_captcha'] = ""; // true or false
$ydfs_settings['recaptcha_public_key'] = (('' != '') ? '' : '6LcJG8ESAAAAAH8FTVf0Sq8ePv8ienj8iGW7woC2' );
$ydfs_settings['recaptcha_private_key'] = (('' != '') ? '' : '6LcJG8ESAAAAAOt0toc-1mWqvlj7uTn9KkWkSVjp');
$ydfs_settings['max_attachment_size'] = 10;
$ydfs_settings['max_attachment_size_bytes'] = $ydfs_settings['max_attachment_size'] * 1024; // Covert KB to bytes value
$ydfs_settings['email_filter_regexp'] = '/\r|\n|to:|cc:|bcc:|to:|cc:|bcc:/i';
// ! -- MySQL PREFS
$ydfs_settings['save_to_mysql'] = false; // true or false
$ydfs_settings['do_not_send'] = false; // true or false
$ydfs_settings['mysql_host'] = '';
$ydfs_settings['mysql_db'] = '';
$ydfs_settings['mysql_user'] = '';
$ydfs_settings['mysql_password'] = '';
$ydfs_settings['mysql_table'] = '';
// ! -- SMTP
$ydfs_settings['use_smtp'] = false;
$ydfs_settings['smtp_host'] = '';
$ydfs_settings['smtp_port'] = '25';
$ydfs_settings['smtp_auth'] = false; // (bool)
$ydfs_settings['smtp_username'] = '';
$ydfs_settings['smtp_password'] = '';
$ydfs_settings['smtp_debug'] = '1';
$ydfs_settings['smtp_secure'] = false; // (bool)
$ydfs_settings['smtp_secure_prefix'] = 'SSL';
// ! -- MESSAGE STRINGS
$ydfs_settings['error_title'] = 'Error!';
$ydfs_settings['error_message'] = 'Oops! An Error Occurred';
$ydfs_settings['success_title'] = 'Success!';
$ydfs_settings['success_message'] = 'Message Sent Successfully!';
$ydfs_settings['captcha_failed'] = 'Security Test Failed';
$ydfs_settings['file_too_big'] = 'Maximum File Size Exceeded.';
$ydfs_settings['file_not_allowed'] = 'File Type Not Allowed.';
$ydfs_settings['required_field_alert'] = 'One or More Required Field(s) are Missing.';
$ydfs_settings['invalid_email'] = 'Invalid Email.';
$ydfs_settings['ok_button'] = 'OK';
$ydfs_settings['redirect_message'] = 'Redirecting...';
// ! -- EMAIL TEMPLATES
$ydfs_settings['email_template'] = 'Thomsons Motor Factors web form
From: #name# Car Reg: #carreg# Email Address: #email# Message: #message# Contact numbers: #contact# ';
$ydfs_settings['receipt_template'] = ' Thank you for your message. We will be in touch soon.';
$ydfs_output='{"result":"fail", "msg":"'.$ydfs_settings['error_message'].'(001)"}'; // init
//=====================================================//
// ! - POST SUBMITTED
//=====================================================//
if(
isset($_POST['ydfs_stacks_id']) && $_POST['ydfs_stacks_id'] == 'stacks_in_0_page2'
&& ( (!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest' )
|| ( $_POST['ydfs_xmlhttprequest'] == 'iesux' && preg_match('/(?i)msie [1-9]/',$_SERVER['HTTP_USER_AGENT'])))
):
$fs = new Formsnap;
$fs->settings = $ydfs_settings;
//=====================================================//
// ! - SECURITY CHECKS
//=====================================================//
// SPAM checking. If the "comment" form field has been filled out,
// send back to form asking to remove content and exit the script.
if ($_POST['rellikmaps']) {
array_push($errors, 'Please remove content from the last textarea before submitting the form again. This is to protect against SPAM abuse.') ;
}
//=====================================================//
// ! - SECURITY QUESTION
//=====================================================//
// Validate Security question
if (isset($_POST['security_answer']) && $ydfs_settings['use_security_question'] ) {
if(strtolower($_POST['security_answer']) != strtolower($ydfs_settings['security_answer']))
array_push($errors, $ydfs_settings['security_wrong_answer']) ;
}
//=====================================================//
// ! - CAPTCHA & VALIDATION
//=====================================================//
// ! -- reCAPTCHA CHECK
# was there a reCAPTCHA response?
if(array_key_exists('recaptcha_challenge_field', $_POST))
{
// !-- reCAPTCHA TEST
$recaptcha_result = $fs->recaptchaCheckAnswer();
if ( $recaptcha_result != 'good')
{
array_push($errors, $ydfs_settings['captcha_failed']);
}
unset($recaptcha_result);
}
// ! -- CHECK REQUIRED FIELDS
$required = $fs->checkRequiredFields();
if($required != 'good')
{
array_push($errors, $ydfs_settings['required_field_alert']);
}
// ! -- REPLY EMAIL VALIDATION
if(!$fs->validateEmail($_POST['form'][$ydfs_settings['reply_to_item']])){
array_push($errors, 'Reply-To Item "'.$ydfs_settings['reply_to_item'].'" has a value of "'.$_POST['form'][$ydfs_settings['reply_to_item']].'" which is an invalid email format. This usually happens when you assign the incorrect Item Name to the Reply-To Item setting.');
}
//=====================================================//
// ! FILTER INPUT FOR HACK ATTEMPTS
//=====================================================//
if(!empty($ydfs_settings['email_filter_regexp'])) {
foreach ($_POST['form'] as $key => $value)
{
$newValue = preg_replace( $ydfs_settings['email_filter_regexp'] ,'***',$value);
$_POST['form'][$key] = $newValue;
}
}
//=====================================================//
// ! - ATTACHMENTS
//=====================================================//
// process any attachments if present...
$files = $fs->processAttachments();
if( $files != 'good' )
array_push($errors, $files);
//=====================================================//
// ! - CUSTOM CODE
//=====================================================//
// Insert custom PHP code here...
//=====================================================//
// ! - PROCESS
//=====================================================//
if (!$errors)
{
// process form...
$fs->processForm();
}
$ydfs_output = $fs->getOutput($errors, $required);
endif; // if POSTED
$ob_contents = ob_get_contents();
ob_end_clean();
if(!empty($ob_contents)) {
$ydfs_output = json_encode(array('result'=>'fail', 'msg'=>htmlspecialchars($ob_contents)));
}
?>
FormSnap Alert!
If you are seeing this, then you are likely viewing this stack in the RapidWeaver preview mode OR you have published this page as something other than the required .php page type. Fix this and republish for the stack to function properly.