Nicht mehr ganz neu hier
Hallo Freunde,
Habe mal wieder ein kleines Problem. Setze gerade eine Seite auf aus einem Template. Jetzt meine Frage wie und was muss ich eingeben damit der Captcha Code zu sehen ist im Kontaktformular und wo setzte ich das ein das ich dann eine E-Mail bekomme wenn mir einer eine Nachricht schreibt???
sendmail.php
Danke schon mal...
Venusfalle
Habe mal wieder ein kleines Problem. Setze gerade eine Seite auf aus einem Template. Jetzt meine Frage wie und was muss ich eingeben damit der Captcha Code zu sehen ist im Kontaktformular und wo setzte ich das ein das ich dann eine E-Mail bekomme wenn mir einer eine Nachricht schreibt???
sendmail.php
Code:
<?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>name@example.com</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 ( empty($_REQUEST['woow_code']) ) {
$pass = 1;
$alert .= "<li>" . $emptycode . "</li>";
} elseif (($_POST['woow_code']) != $_SESSION['woow_code']) {
$pass = 1;
$alert .= "<li>" . $alertcode . "</li>";
}
//If error, print the error messages.
if ( $pass==1 ) {
echo "<script>$(\".message\").hide(\"slow\").show(\"slow\").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 = "YOURNAME@YOURSITE.COM"; //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(\"slow\").animate({opacity: 1.0}, 5000).hide(\"slow\"); $(':input').clearForm() </script>";
echo $thanks;
die();
echo "<br/><br/>" . $message;
}
} else {
echo "<script>$(\".message\").hide(\"slow\").show(\"slow\"); </script>";
echo $hiddenfield;
}
?>
Danke schon mal...
Venusfalle