View Full Version : help in this image varification code in php

01-25-2009, 03:30 PM
help in this image varification contact form .the form is no working with image varification.
my 2 fiiles are

1) contact.php


if ($_POST["vercode"] != $_SESSION["vercode"] OR $_SESSION["vercode"]=='') {
echo '<strong>Incorrect verification code.</strong><br>Please use your back Button and try again';
} else {
if (isset($_POST['submit'])){


$subject="".$_POST['yourname']." wants you to check this out!";

$mail_from="from: ".$_POST['youremail']." \n";

$mail_from .="Content-Type: text/html; charset=utf-8 \n";

$message="<font size=\"2\" face=\"Verdana\"> <b>".$_POST['friendemail']."</b>,<br />
".$_POST['yourname']." wants you to check this website!!:<br />

<a href=\"http://www.google.com\">google</a> </font>";

$sentmail = mail($to,$subject,$message,$mail_from);

echo "We told your friend!";

echo '<strong>Verification successful.</strong><br>';

<form action="contact.php" method="post">
Your Name:<br />
<input type="input" name="yourname" /><br />
Your Email:<br />
<input type="input" name="youremail" /><br />
Friend name:<br />
<input type="input" name="friendname" /><br />
Friend email:<br />
<input type="input" name="friendemail" /><br /><br />
Enter Code <img src="captcha.php"><input type="text" name="vercode" /><br>
<input type="submit" name="submit" value="Tell Your Friend" />

<?php } ?>

2) captcha.php

$text = rand(10000,99999);
$_SESSION["vercode"] = $text;
$height = 25;
$width = 65;

$image_p = imagecreate($width, $height);
$black = imagecolorallocate($image_p, 0, 0, 0);
$white = imagecolorallocate($image_p, 255, 255, 255);
$font_size = 14;

imagestring($image_p, $font_size, 5, 5, $text, $white);
imagejpeg($image_p, null, 80);

01-25-2009, 03:42 PM
Please edit your post and change the font-size to normal and use
][/COLOR] tag to wrap your code instead.

01-26-2009, 12:35 AM
Please remember to read the stickies, rules (http://www.codingforums.com/rules.htm) and posting guidelines (http://www.codingforums.com/postguide.htm) for this forum. In particular the one about using
tags (http://www.codingforums.com/showthread.php?t=68462) when posting code.