I've tried to make one with images, just now, and I'm having a bit of trouble trying to match the codes:
Image.php
PHP Code:
<?php
// load PNG image
$image = imagecreatefrompng("http://forum.ragezone.com/images/captcha_background.png");
// load font
$font = "fonts/Tahoma.ttf";
// add code
/*$code = rand(10, 100);
$code = $code . " " . rand(10, 100);
$code = $code . " " . rand(10, 100);
$code = $code . " " . rand(10, 100);*/
$code = $_GET['code'];
imagefttext($image, 30, 0, 40, 57, null, $font, $code);
// show
header("Content-Type: image/png, html");
imagepng($image);
?>
Index.php (Form)
PHP Code:
<html>
<body>
<?php $image_text = rand(10, 100) . rand(10, 100) . rand(10, 100) . rand(10, 100);
if (isset($_POST['go']))
{
$input_code = $_POST['input_code'];
if ($input_code != $image_text)
{
echo 'You have entered an incorrect code, please try again.<br /><br />';
}
else
{
echo 'Congratulations, code successful!<br /><br />';
}
}
?>
<img src="image.php?code=<?php echo $image_text; ?>">
<FORM METHOD="POST">
<table>
<tr>
<td>
Type in the code from the above image:
</td>
</tr>
<tr>
<td>
<input type="text" name="input_code">
</td>
</tr>
<tr>
<td>
<input type="submit" name="go">
</td>
</tr>
</table>
</FORM>
</body>
</html>