<?php
/*
EXAMPLE FILE FOR CAPTCHA2 CLASS
ver 0.9
*/
require ('captcha.class.php');
$ob = new Captcha();
if (isset ($_POST['guess'])) {
$txtguess = $_POST['txtGuess'];
// this way you can do the verification
if ($ob->verifyCaptcha($txtguess))
echo "<br />These are identical";
else
echo "<br />Opps! Try again";
}
// create a default captcha (6, 'png', true)
$ob->createCaptcha();
// create a captcha (png format with lines display and with length of 6)
// $ob->createCaptcha(6, 'png', true);
// create a captcha (jpeg format with lines display and with length of 10)
// $ob->createCaptcha(10, 'jpeg', true);
// create a captcha (png format without lines display and with length of 6)
// $ob->createCaptcha(6, 'png', false);
?>
<html>
<head></head>
<body>
<br />
<!-- display the captcha previously generated-->
<?php echo $ob->showCaptcha(); ?>
<form method="post" action="example.php">
<input type="text" name="txtGuess" id="txtGuess">
<input type="submit" value="Verify" name="guess">
</form>
</body>
</html>
|