Glowsticks .co.uk Competition
COMPETITION # 12
WANT TO WIN A GLOW PARTY ON US?
SIMPLY ANSWER THE QUESTION BELOW TO GO INTO A DRAW
COMPETITION QUESTION
What has the girl got in her hands on the Party Pack page?
A) Dog & duck
B) Flashing wand
C) Glow cup & glow straw
D) Glow frisbee
COMPETITION
Please correct it and try again.";
$message_missingInfo = "Oops! We can't send your entry without the highlighted information.";
$message_serverError = "Sorry! We had a problem and couldn't send your entry.
Please try again.";
$message_pleaseConfirm = "Please check the box to be entered into the competition prize draw.";
/* labels config */
$label_email = "Your email address";
$label_subject = "Message Subject";
$label_name = "Your name";
$label_message = "Your Answer";
$label_send = "Send";
$label_requiredInfo = "This information is required to send your competition entry";
$label_confirm = "I agree to be entered into the competition prize draw
and subscribed to the monthly e-mail newsletter. (you can unsubscribe at any time)";
/* email processing here */
function check_email($email) {
// First, we check that there's one @ symbol, and that the lengths are right
if (!ereg("^[^@]{1,64}@[^@]{1,255}$", $email)) {
// Email invalid because wrong number of characters in one section, or wrong number of @ symbols.
return false;
}
// Split it into sections to make life easier
$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;
}
if (($_SERVER['REQUEST_METHOD'] == 'POST')&&($_REQUEST['action'] == 'send')){
/* If the method is POST, error-check and send the message */
$_message = $_POST['message'];
$from_name = $_POST['name'];
if ( check_email($_POST['email']) ) {
$from_email = $_POST['email'];
} else {
$from_email = $_POST['email'];
$address_error = true;
};
if ( isset ( $_POST['subject'] ) ) {
$subject = $_POST['subject'];
} else {
$subject = $defaultSubject;
};
if (($from_email != '')&&($_message != '')&&($from_name != '')){
if (! $address_error) {
if(($showConfirmCheckbox && isset($_POST['confirm']))||($showConfirmCheckbox == false)){
/* attempt to send the message */
$sendmail_path = "/usr/sbin/sendmail -oi -t";
$from = $from_name."<".$from_email.">";
if (@mail($mail_to,$subject_pre.$subject.$subject_post, $_message, "From: $from\nX-Mailer: PHP/ . $phpversion()", "-f $from")){
$msg = $message_sent;
$recook_form= false;
} else {
$msg = $message_serverError;
$recook_form = true;
// recook the send data into the form so people can try again easily.
}; //sending the email
} else {
$recook_form = true;
$msg = $message_pleaseConfirm;
};
} else {
$msg = $message_emailError;
$recook_form = true;
};
} else {
if (($from_name == '')||($message == '')){
$msg = $message_missingInfo;
};
$recook_form = true;
// recook the send data into the form so people can try again easily.
};//Checking the form contents
} else {
};//method is not POST
?>
Customer Comments
