0) { $search = array('\\', '[', ']', '-', '$', '.', '*', '(', ')', '?', '+', '^', '{', '}', '|', '/'); $replace = array('\\\\', '\[', '\]', '\-', '\$', '\.', '\*', '\(', '\)', '\?', '\+', '\^', '\{', '\}', '\|', '\/'); $regExp .= str_replace($search, $replace, $limitExtraChars); } if ( (strlen($regExp) > 0) && (strlen($value) > 0) ){ if (preg_match('/[^' . $regExp . ']/', $value)) { return false; } } if ( (strlen($value) == 0) && ($optional === kOptional) ) { return true; } elseif ( (strlen($value) >= $low) && ($mode == kStringRangeFrom) ) { return true; } elseif ( (strlen($value) <= $high) && ($mode == kStringRangeTo) ) { return true; } elseif ( (strlen($value) >= $low) && (strlen($value) <= $high) && ($mode == kStringRangeBetween) ) { return true; } else { return false; } } function CheckNumeric($value, $low, $high, $mode, $optional) { if ( (strlen($value) == 0) && ($optional === kOptional) ) { return true; } elseif (!is_numeric($value)) { return false; } elseif ( ($value >= $low) && ($mode == kNumberRangeFrom) ) { return true; } elseif ( ($value <= $high) && ($mode == kNumberRangeTo) ) { return true; } elseif ( ($value >= $low) && ($value <= $high) && ($mode == kNumberRangeBetween) ) { return true; } else { return false; } } function CheckEmail($email, $optional) { if ( (strlen($email) == 0) && ($optional === kOptional) ) { return true; } elseif ( preg_match("/^([\w\!\#$\%\&\'\*\+\-\/\=\?\^\`{\|\}\~]+\.)*[\w\!\#$\%\&\'\*\+\-\/\=\?\^\`{\|\}\~]+@((((([a-z0-9]{1}[a-z0-9\-]{0,62}[a-z0-9]{1})|[a-z])\.)+[a-z]{2,6})|(\d{1,3}\.){3}\d{1,3}(\:\d{1,5})?)$/i", $email) == 1 ) { return true; } else { return false; } } function CheckDateFormat($value, $optional) { if ( (strlen($value) == 0) && ($optional === kOptional) ) { return true; } $year = substr($value, '6', '4'); $month = substr($value, '3', '2'); $day = substr($value, '0', '2'); if ( ( @checkdate($month, $day, $year) ) && (strlen($value) == 10) ) { return true; } else { return false; } } if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) { $clientIP = $_SERVER['HTTP_X_FORWARDED_FOR']; } else { $clientIP = $_SERVER['REMOTE_ADDR']; } $FTGname = DoStripSlashes( $_POST['name'] ); $FTGaddress = DoStripSlashes( $_POST['address'] ); $FTGcountry = DoStripSlashes( $_POST['country'] ); $FTGtelephone = DoStripSlashes( $_POST['telephone'] ); $FTGemail = DoStripSlashes( $_POST['email'] ); $FTGarrival_date = DoStripSlashes( $_POST['arrival_date'] ); $FTGdeparture_date = DoStripSlashes( $_POST['departure_date'] ); $FTGno_adult = DoStripSlashes( $_POST['no_adult'] ); $FTGno_child = DoStripSlashes( $_POST['no_child'] ); $FTGpreferences = DoStripSlashes( $_POST['preferences'] ); $validationFailed = false; # Fields Validations if (!CheckString($FTGname, 2, 100, kStringRangeBetween, kNo, kNo, kNo, '', kMandatory)) { $FTGErrorMessage['name'] = 'Name'; $validationFailed = true; } if (!CheckString($FTGaddress, 3, 200, kStringRangeBetween, kNo, kNo, kNo, '', kMandatory)) { $FTGErrorMessage['address'] = 'Address'; $validationFailed = true; } if (!CheckString($FTGcountry, 2, 100, kStringRangeBetween, kNo, kNo, kNo, '', kMandatory)) { $FTGErrorMessage['country'] = 'Country name'; $validationFailed = true; } if (!CheckString($FTGtelephone, 6, 15, kStringRangeBetween, kNo, kYes, kYes, '()-+', kMandatory)) { $FTGErrorMessage['telephone'] = 'Phone number'; $validationFailed = true; } if (!CheckEmail($FTGemail, kMandatory)) { $FTGErrorMessage['email'] = 'Email address'; $validationFailed = true; } if (!CheckDateFormat($FTGarrival_date, kMandatory)) { $FTGErrorMessage['arrival_date'] = 'Date in correct format'; $validationFailed = true; } if (!CheckDateFormat($FTGdeparture_date, kMandatory)) { $FTGErrorMessage['departure_date'] = 'Departure date in correct format'; $validationFailed = true; } if (!CheckNumeric($FTGno_adult, 1, 100, kNumberRangeBetween, kMandatory)) { $FTGErrorMessage['no_adult'] = 'Correct number of adults'; $validationFailed = true; } if (!CheckNumeric($FTGno_child, 0, 100, kNumberRangeBetween, kMandatory)) { $FTGErrorMessage['no_child'] = 'Correct number of childrens'; $validationFailed = true; } # Include message in error page and dump it to the browser if ($validationFailed === true) { $errorPage = '
Errors found: Please Enter
'; $errorList = @implode(", \n", $FTGErrorMessage); $errorPage = str_replace('', $errorList, $errorPage); echo $errorPage; } if ( $validationFailed === false ) { # Email to Form Owner $emailSubject = FilterCChars("Reservation Request from $FTGemail"); $emailBody = "Name : $FTGname\n" . " Address : $FTGaddress\n" . " Country : $FTGcountry\n" . " Telephone : $FTGtelephone\n" . " Email : $FTGemail\n" . " Arrival Date : $FTGarrival_date\n" . " Departure Date : $FTGdeparture_date\n" . " Number of adult : $FTGno_adult\n" . " Number of children : $FTGno_child\n" . " Preferences : $FTGpreferences\n" . ""; $emailTo = 'vanghat@gmail.com'; $emailFrom = FilterCChars("noreply@ruraltraveller.com"); $emailHeader = "From: $emailFrom\n" . "MIME-Version: 1.0\n" . "Content-type: text/plain; charset=\"UTF-8\"\n" . "Content-transfer-encoding: 8bit\n"; mail($emailTo, $emailSubject, $emailBody, $emailHeader); # Include message in the success page and dump it to the browser $successPage = 'Request recived successfully. It will be reviewed soon.'; unset ($_SESSION); echo $successPage; } }//end of else } if(( $validationFailed === true )||(!isset($_POST['submit']))) { ?>
Enter Booking Information
Name* :
Address* :
Country* :
Telephone Number* :
E-Mail :
Arrival Date :
Departure Date :
Number Of Adults :
No Of children :
Preferences / Details
of Services Required
:
Validation Code* :


Can't read the image? click here to refresh