@,;:\.\\\"\[]";
$atom = "$valid_chars+";
$quoted_user='(\"[^\"]*\")';
$word = "($atom|$quoted_user)";
$user_pat = "^$word(\.$word)*$";
$ip_domain_pat='^\[([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\]$';
$domain_pat = "^$atom(\.$atom)*$";
if (eregi($mail_pat, $email, $components)) {
$user = $components[1];
$domain = $components[2];
// validate user
if (eregi($user_pat, $user)) {
// validate domain
if (eregi($ip_domain_pat, $domain, $ip_components)) {
// this is an IP address
for ($i=1;$i<=4;$i++) {
if ($ip_components[$i] > 255) {
$valid_address = false;
break;
}
}
} else {
// Domain is a name, not an IP
if (eregi($domain_pat, $domain)) {
/* domain name seems valid, but now make sure that it ends in a valid TLD or ccTLD
and that there's a hostname preceding the domain or country. */
$domain_components = explode(".", $domain);
// Make sure there's a host name preceding the domain.
if (sizeof($domain_components) < 2) {
$valid_address = false;
} else {
$top_level_domain = strtolower($domain_components[sizeof($domain_components)-1]);
// Allow all 2-letter TLDs (ccTLDs)
if (eregi('^[a-z][a-z]$', $top_level_domain) != 1) {
$tld_pattern = '';
// List of authorized TLDs
$tlds = array("com","edu","gov","int","mil","net","org","aero","biz","coop","info","museum","name","pro");
foreach($tlds as $tld) {
// TLDs should be 3 letters or more
if (eregi('^[a-z]{3,}$', $tld) == 1) {
$tld_pattern .= '^' . $tld . '$|';
}
}
// Remove last '|'
$tld_pattern = substr($tld_pattern, 0, -1);
if (eregi("$tld_pattern", $top_level_domain) == 0) {
$valid_address = false;
}
}
}
} else {
$valid_address = false;
}
}
} else {
$valid_address = false;
}
} else {
$valid_address = false;
}
return $valid_address;
}
if($_POST['cmd'] == "sendmail") {
$country = trim(strip_tags($_POST['country']));
$citySelect = trim(strip_tags($_POST['citySelect']));
$city = trim(strip_tags($_POST['city']));
$outDay = trim(strip_tags($_POST['outDay']));
$outMonthYear = trim(strip_tags($_POST['outMonthYear']));
$nights = trim(strip_tags($_POST['nights']));
$people = trim(strip_tags($_POST['people']));
$preferredHotel = trim(strip_tags($_POST['preferredHotel']));
$firstName = trim(strip_tags($_POST['firstName']));
$surname = trim(strip_tags($_POST['surname']));
$email = trim(strip_tags($_POST['email']));
$telephone = trim(strip_tags($_POST['telephone']));
$groupType = trim(strip_tags($_POST['groupType']));
$groupAge = trim(strip_tags($_POST['groupAge']));
$preferredRoom = trim(strip_tags($_POST['preferredRoom']));
$budgetCur = trim(strip_tags($_POST['budgetCur']));
$budget = trim(strip_tags($_POST['budget']));
$comments = trim(strip_tags($_POST['comments']));
if($country == "") {
$errors .= "¤ Please select a country\\n";
}
if($citySelect == "" && $city == "") {
$errors .= "¤ Please select or input a city\\n";
}
if($outMonthYear == "") {
$errors .= "¤ Please select a month and year\\n";
}
if($nights == "") {
$errors .= "¤ Please input number of nights\\n";
}
if($email == "") {
$errors .= "¤ Please input your Email\\n";
} else if(!validate_email($email)) {
$errors .= "¤ Email is not valid\\n";
}
if(!$errors) {
$eol = "\r\n";
# Common Headers
$headers .= 'From: '.$email.$eol;
$headers .= 'Reply-To: '.$email.$eol;
$headers .= 'Return-Path: '.$email.$eol;
$headers .= 'Content-type: text/html; charset=iso-8859-1'.$eol;
// $headers .= "Message-ID: <".time()." contactform@".$_SERVER['SERVER_NAME'].">".$eol;
$headers .= "X-Mailer: PHP v". phpversion(); // These two to help avoid spam-filters
$subject = "Submitted special offer enquiry form at Hotel-Barcelona.com";
$message = "< SUBMITTED FROM SPECIAL OFFER ENQUIRY FORM AT HOTEL-BARCELONA.COM > ";
$message .= "Country: '".$country."' ";
$message .= "Selected city: '".$citySelect."' ";
$message .= "City (input): '".$city."' ";
$message .= "In date: '".$outDay." ".$outMonthYear."' ";
$message .= "Number of Nights: '".$nights."' ";
$message .= "Number of People: '".$people."' ";
$message .= "Preferred Hotel: '".$preferredHotel."' ";
$message .= "First name: '".$firstName."' ";
$message .= "Surname: '".$surname."' ";
$message .= "E-mail: '".$email."' ";
$message .= "Telephone: '".$telephone."' ";
$message .= "Group type: '".$groupType."' ";
$message .= "Group age: '".$groupAge."' ";
$message .= "Preferred Room: '".$preferredRoom."' ";
$message .= "Budget per Person: '".$budgetCur." ".$budget."' ";
$message .= "Comments: '".$comments."' ";
$message .= "[EMAIL: ".$email." ; IP: ".$_SERVER['REMOTE_ADDR']." ; HOST: ".gethostbyaddr($_SERVER['REMOTE_ADDR'])." ]";
// mail("espersen@onindo.com", $subject, $message, $headers);
mail("res@hotel-barcelona.com", $subject, $message, $headers);
mail("silvia@iberia-hotels.com", $subject, $message, $headers);
mail("support@iberia-hotels.com", $subject, $message, $headers);
// mail("hoteladvice@hotmail.com", $subject, $message, $headers);
mail("hotelbarcelona.com@gmail.com", $subject, $message, $headers);
$errors = "";
$success = "Thank you for your request!\\n\\nWe will get back to you shortly!";
} else {
$errors = "Please correct following errors:\\n\\n".$errors;
}
}
?>
Special Offer Enquiry Form - Hotel Barcelona & Barcelona Hotels Reservations Online
Special Offer Enquiry Form
Email us your requirements and get great offers back, often some of these cannot be published for hotels to offer rate parity or they cannot be advertised.
A large selection of offers, complete the form below.
So what next?
A member of our team will receive your enquiry and respond within 24 hours
You will receive one or more offers of accommodation according to your budget and requirements
Thank you for using Hotel-Barcelona.com !
'."\n";
echo ' alert("'.$errors.$success.'");'."\n";
echo ' '."\n";
}
?>