include("includes/functions.php");
dbConnect();
//session_start();
$_SESSION['_checkout'] = true;
if ( count($_POST) ) {
if ( $_POST['paymenttype'] ) {
$_SESSION['paymenttype'] = $_POST['paymenttype'];
}
}
if(isset($_GET['ajax'])){
if ($_GET['ajax']=="true") {
//echo $_SESSION['security_code'];
if( $_SESSION['security_code'] == $_GET['security_code'] && !empty($_SESSION['security_code'] ) ) {
echo "true";
exit;
} else {
echo "false";
exit;
}
}
}
//session_start();
$error = false;
if (!empty($_POST) && isset($_POST['location']) && $_POST['location']=="contactus") {
print_r($_POST);
$fields=array(
"first_name",
"first_name_shipping",
"last_name",
"last_name_shipping",
"address_shipping",
"address",
"city_town",
"city_town_shipping",
"state_shipping",
"state",
"postcode",
"postcode_shipping",
"phone",
"phone_shipping",
"email",
"email_shipping",
"I_Agree_to_the_Terms_Conditions",
"security_code"
);
$required = array(
"first_name",
"first_name_shipping",
"last_name",
"last_name_shipping",
"address_shipping",
"address",
"city_town",
"city_town_shipping",
"state_shipping",
"state",
"postcode",
"postcode_shipping",
"phone",
"phone_shipping",
"email",
"email_shipping",
"I_Agree_to_the_Terms_Conditions",
"security_code"
);
$error_message = "";
foreach ($required as $element) {
if (!isset($_POST[$element]) || $_POST[$element]=="") {
$error = true;
$error_message .= "Please fill in your ".ucwords(str_replace("_"," ",$element)).".
";
}
if (isset($_POST[$element]) && $element == "email_address")
if ($_POST[$element]!=$_POST['email_again']) {
$error = true;
$error_message .= "Your Email Confirmation must match your Email Address.
";
}
}
if (isset($_POST[$element]) && $element == "security_code") {
if( $_SESSION['security_code'] == $_POST['security_code'] && !empty($_SESSION['security_code'] ) ) {
// Captcha matches
unset($_SESSION['security_code']);
} else {
// Captcha does not match
$error = true;
$error_message .= "Your security code must match the supplied image.
";
unset($_SESSION['security_code']);
}
}
if (!$error) {
$email_message="
";
foreach ($fields as $element) {
if (isset($_POST[$element]) && $_POST[$element]!="") {
$email_message .= "".ucwords(str_replace("_"," ",$element)).": ".$_POST[$element]."
";
if ($element=="email_address") $email_message .= "
";
}
}
$email_message.="";
$to = "theshop@singaporecharlie.com.au";
$from = "www.ibuycostumesonline.com.au";
$headers = 'MIME-Version: 1.0' . "\n";
$headers .= 'Content-type: text/html; charset=\"iso-8859-1\"' . "\n";
// Additional headers
$headers .= 'From: '.$from . "\n";
$subject = "Contact Singapore Charlie";
mail($to,$subject,$email_message,$headers, "-f".$from);
}
}
?>
Singapore Charlie
">