Thanks, that was it I believe!
Maybe you could help me with my captcha script then? I've installed a simple script I got from here
It basically just asks a math question, but I can't seem to get past the validation! Even when I just print the variable out, it's a different number....
Here is the code:
<?php
session_start();
ini_set("SMTP","mail.server.com");
ini_set("smtp_port","25");
ini_set('sendmail_from', 'mail@server.com');
$EmailTo = "mail@gmail.com";
$Subject = "Web Contact";
$Name = Trim(stripslashes($_POST['Name']));
$Interests = Trim(stripslashes($_POST['select1']));
$Email = Trim(stripslashes($_POST['Email']));
$Message = Trim(stripslashes($_POST['Message']));
$CAPTCHA = $_REQUEST['CAPTCHA'];
echo "captcha value:" . $_SESSION['CAPTCHA'];
exit;
switch ( $Interests ) {
case "General Information":
$EmailTo = "mail@gmail.com";
break;
case "Acupuncture":
$EmailTo = "mail@gmail.com";
break;
case "Massage Therapy":
$EmailTo = "mail@gmail.com";
break;
case "Cranio-Sacral Therapy":
$EmailTo = "mail@gmail.com";
break;
default:
$EmailTo = "mail@gmail.com";
} // switch
// validation
/*$validationOK=true;
if (!$validationOK) {
print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">";
exit;
}*/
if (empty($Name) || empty($Email) || empty($Message)) {
?>
<html>
<head><title>Error</title></head>
<body>
<h1>Error</h1>
<p>
Oops, it appears you forgot to enter either your
email address, name, company or phone number. Please press the BACK
button in your browser and try again.
</p>
</body>
</html>
<?php
}
elseif ($_SESSION['CAPTCHA'] != strip_tags($_POST['CAPTCHA']) ) {
//elseif ($_SESSION['CAPTCHA'] != $CAPTCHA) {
?>
<html>
<head><title>Error</title></head>
<body>
<h1>Error</h1>
<p>
Oops, it appears you got the math question wrong, or you are a robot. Please press the BACK
button in your browser and try again.
</p>
</body>
</html>
<?php
}
else {
// prepare email body text
$Body = "";
$Body .= "Name: ";
$Body .= $Name;
$Body .= "\n";
$Body .= "Interests: ";
$Body .= $Interests;
$Body .= "\n";
$Body .= "Email: ";
$Body .= $Email;
$Body .= "\n";
$Body .= "Message: ";
$Body .= $Message;
$Body .= "\n";
// send email
//$success = mail($EmailTo, $Subject, $Body, "From: <$Email>");
mail($EmailTo, $Subject, $Body, "From: <$Email>");
// redirect to success page
if ($success){
print "<meta http-equiv=\"refresh\" content=\"0;URL=contactthanks.html\">";
}
else{
print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">";
}}
?>
and the field on the form is like this:
<label>Verification:</label><img src="/captcha.php" /><input type="text" name="CAPTCHA" class="captcha"/>