<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Form protected with captcha</title>
</head>
<body>
<?php
if ($_POST) {
session_start();
if (md5(strtolower($_REQUEST['code'])) == $_SESSION['code']) {
echo "Correct code";
}
else {
echo "Wrong code";
}
}
else {
?>
<form method="post">
<p><img src="captcha.php" /></p>
<p>Code:<br /><input type="text" name="code" maxlength="6" /> <input type="submit" value="Submit" /></p>
</form>
<?php } ?>
</body>
</html>