#####################################################################################
$recepients[] = "pepsiworld.ph@gmail.com";
$recepients[] = "contact_us@pepsiworld.com.ph";
#####################################################################################
session_start();
function check_email_address($email) {
if (!ereg("^[^@]{1,64}@[^@]{1,255}$", $email)) {
return false;
}
$email_array = explode("@", $email);
$local_array = explode(".", $email_array[0]);
for ($i = 0; $i < sizeof($local_array); $i++) {
if (!ereg("^(([A-Za-z0-9!#$%&'*+/=?^_`{|}~-][A-Za-z0-9!#$%&'*+/=?^_`{|}~\.-]{0,63})|(\"[^(\\|\")]{0,62}\"))$", $local_array[$i])) {
return false;
}
}
if (!ereg("^\[?[0-9\.]+\]?$", $email_array[1])) { // Check if domain is IP. If not, it should be valid domain name
$domain_array = explode(".", $email_array[1]);
if (sizeof($domain_array) < 2) {
return false; // Not enough parts to domain
}
for ($i = 0; $i < sizeof($domain_array); $i++) {
if (!ereg("^(([A-Za-z0-9][A-Za-z0-9-]{0,61}[A-Za-z0-9])|([A-Za-z0-9]+))$", $domain_array[$i])) {
return false;
}
}
}
return true;
}
$successful = false;
if(!empty($_POST)){
$serverSecurityCode = $_SESSION['security_code'];
$inputSecurityCode = $_POST['securityCode'];
$errors = "";
$firstName = $_POST['firstName'];
$lastName = $_POST['lastName'];
$street = $_POST['street'];
$province = $_POST['province'];
$country = $_POST['country'];
$postalCode = $_POST['postalCode'];
$email = $_POST['email'];
$confirmEmail = $_POST['confirmEmail'];
$number = $_POST['number'];
$comments = $_POST['comments'];
if($_POST['firstName']=="" || $_POST['lastName']=="" || $_POST['email']=="" || $_POST['confirmEmail']=="" || $_POST['comments']=="")
$errors .= "Make sure that you have filled up all required fields.
";
if($_POST['email']!=$_POST['confirmEmail'])
$errors .= "The email addresses that you entered did not match!
";
else if(!check_email_address($email))
$errors .= "The email addresses that you entered is invalid.
";
if($serverSecurityCode!=$inputSecurityCode)
$errors .= "You have entered the wrong security code.
";
if($errors == ""){
$successful = true;
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= "From: contact_us@pepsiworld.com.ph\r\n";
$headers .= "Reply-To: $email\r\n";
$extraParams = "";
$body = "