FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


CAPTCHA help!





sathiyasri
Hello,

I have a chaptcha code for my form, and its not working. all it does is output five black boxes. below are the codes i use

This is verification.php

PHP Code:

Quote:
<?php
header("Content-type: image/jpeg");

$im = imagecreate(12,16);
$white = imagecolorallocate($im,255,255,255);
$black = imagecolorallocate($im,0,0,0);

$new_string = $_GET[code];
$new_string = substr($new_string,17,6);
$new_string = $new_string[$_GET[p]];

imagefill($im,0,0,$black);
imagestring($im,3,3,1,$new_string,$white);
imagejpeg($im);
imagedestroy($im);
?>


and this is what i put in the form

PHP Code:

Quote:
<fieldset>
<legend>Image Verification</legend>
<?php
for ( $p = 0; $p <= 5; $p++ ) {
echo "<img src='script/verification.php?code=$v&p=$p'>";
}
?>
<input type="text" name="verification" size="16" maxlength="6" class="form"><br>
</fieldset>
hexkid
In the form, $v must be at least 22 characters long.
If it's 16 or less, in the image script, the line
Quote:
Code:
$new_string = substr($new_string, 17, 6);

will assign an empty string to $new_string.
manum
r u sure that GD is properly installed at your server!!!
Related topics
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.