este es el codigo
<?php
/*--------------------------------------------------------------------------------------------------------
Start Captcha Code Session
--------------------------------------------------------------------------------------------------------*/
session_start();
if(isset($_POST['submit']))
{
if(empty($_SESSION['woow_code'] ) ||
strcasecmp($_SESSION['woow_code'], $_POST['woow_code']) != 0)
{
//Note: the captcha code is compared case insensitively.
//if you want case sensitive match, update the check above to
// strcmp()
$errors .= $alertcode;
}
}
/*--------------------------------------------------------------------------------------------------------
Set the AJAX Messages
--------------------------------------------------------------------------------------------------------*/
$errormessage = 'Oops! There seems some problem occurs..!';
$hiddenfield = "You filled in the hiddenfield! Are you human? Please try again!";
$emptyname = 'We are sure that you have a name!';
$emptymail = 'We need your email address!';
$emptysubject = 'What is your subject?';
$emptymessage = 'Please do not send us a blank email!';
$emptycode = 'Please ENTER the Captcha Code!';
$alertname = 'Please enter your name using only the standard alphabet!';
$alertmail = 'Please enter your email in this format: <i>
[email protected]</i>.';
$alertsubject = 'Please enter your subject using only the standard alphabet!';
$alertcode = 'Wrong Code, Please Try Again!';
$thanks = 'Your message has been sent and we will contact you as soon as possible. Thank you..!';
/*--------------------------------------------------------------------------------------------------------
Begin AJAX contact form validation
--------------------------------------------------------------------------------------------------------*/
//Setting used variables.
$alert = '';
$pass = 0;
// Sanitizing the data.
function clean_var($variable) {
$variable = strip_tags(stripslashes(trim(rtrim($variable))));
return $variable;
}
//Validate input data.
if ( empty($_REQUEST['last']) ) {
if ( empty($_REQUEST['name']) ) {
$pass = 1;
$alert .= "<li>" . $emptyname . "</li>";
} elseif ( ereg( "[][{}()*\\^$|+`~!@#%&+_+-+?+/]", $_REQUEST['name'] ) ) {
$pass = 1;
$alert .= "<li>" . $alertname . "</li>";
}
if ( empty($_REQUEST['mail']) ) {
$pass = 1;
$alert .= "<li>" . $emptymail . "</li>";
} elseif ( !eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$", $_REQUEST['mail']) ) {
$pass = 1;
$alert .= "<li>" . $alertmail . "</li>";
}
if ( empty($_REQUEST['subject']) ) {
$pass = 1;
$alert .= "<li>" . $emptysubject . "</li>";
} elseif ( ereg( "[][{}()*+.\\^$|]", $_REQUEST['subject'] ) ) {
$pass = 1;
$alert .= "<li>" . $alertsubject . "</li>";
}
if ( empty($_REQUEST['message']) ) {
$pass = 1;
$alert .= "<li>" . $emptymessage . "</li>";
}
//If error, print the error messages.
if ( $pass==1 ) {
echo "<script>$(\".message\").hide(\"slow\").show(\"slo w\").animate({opacity: 1.0}, 3000).hide(\"slow\"); </script>";
echo "" . $errormessage . "";
echo "<ul>";
echo $alert;
echo "</ul>";
// If the input data is valid.
} elseif (isset($_REQUEST['message'])) {
//Send email.
$EmailTo = "
[email protected]"; //Your email address
$EmailFrom = Trim(stripslashes($_POST['name']));
$Subject = Trim(stripslashes($_POST['subject']));
$Name = Trim(stripslashes($_POST['name']));
$Email = Trim(stripslashes($_POST['mail']));
$Message = Trim(stripslashes($_POST['message']));
$headers .= "From: $Email" . "\r\n";
$Body = "";
$Body .= "Name: ";
$Body .= $Name;
$Body .= "\n";
$Body .= "Email: ";
$Body .= $Email;
$Body .= "\n";
$Body .= "Subject: ";
$Body .= $Subject;
$Body .= "\n";
$Body .= "Message: ";
$Body .= $Message;
$Body .= "\n";
$success = mail($EmailTo, $Subject, $Body, $headers);
//Success message.
echo "<script>$(\".message\").hide(\"slow\").show(\"slo w\").animate({opacity: 1.0}, 5000).hide(\"slow\"); $(':input').clearForm() </script>";
echo $thanks;
die();
echo "<br/><br/>" . $message;
}
} else {
echo "<script>$(\".message\").hide(\"slow\").show(\"slo w\"); </script>";
echo $hiddenfield;
}
?>