<form method="POST" action="contact.php"> Fields marked (*) are required <p>Name:* <br> <input type="text" name="Name"> <p>Telephone:<br> <input type="text" name="Telephone"> <p>Email:<br> <input type="text" name="Email"> <p>Message:* <br> <textarea name="Message"></textarea> <p><input type="submit" name="submit" value="Submit"> </form> <p>
the php process code is this:
// get posted data into local variables
$EmailFrom = "visitor";
$EmailTo = "someone@yahoo.com";
$Subject = "website inquiry";
$Name = Trim(stripslashes($_POST['Name']));
$Telephone = Trim(stripslashes($_POST['Telephone']));
$Email = Trim(stripslashes($_POST['Email']));
$Message = Trim(stripslashes($_POST['Message']));
// validation
$validationOK=true;
if (Trim($Name)=="") $validationOK=false;
if (Trim($Message)=="") $validationOK=false;
if (!$validationOK) {
print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">";
exit;
}
// prepare email body text
$Body = "";
$Body .= "Name: ";
$Body .= $Name;
$Body .= "\n";
$Body .= "Telephone: ";
$Body .= $Telephone;
$Body .= "\n";
$Body .= "Email: ";
$Body .= $Email;
$Body .= "\n";
$Body .= "Message: ";
$Body .= $Message;
$Body .= "\n";
// send email
$success = mail($EmailTo, $Subject, $Body, "From: <$EmailFrom>");
// redirect to success page
if ($success){
print "<meta http-equiv=\"refresh\" content=\"0;URL=ok.htm\">";
}
else{
print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">";
}
?>
and i want to integrate this captcha code which i will call ver.php:
<?php
session_start();
$image = imagecreatefrompng('img_ver.png');
$text = sha1(rand(0,9999));
$new_text = substr($text, 17, 6);
$_SESSION['img_ver'] = $new_text;
imagestring($image, 5, 25, 8, $new_text, 0xcccccc);
// $gaussian = array(array(1.0, 2.0, 1.0), array(2.0, 4.0, 2.0), array(1.0, 2.0, 1.0));
//imageconvolution($image, $gaussian, 10, 0);
header('Content-Type: image/png');
imagepng($image, null, 9);
?>
Any input is very much appreciated. Thanks!
This post has been edited by mobius19: 03 August 2009 - 06:24 PM

New Topic/Question
Reply




MultiQuote





|