(<form method="post" ...)
<?php session_start(); ?>
<?php require("botdetect.php"); ?>
<link type="text/css" rel="Stylesheet"
href="<?php echo CaptchaUrls::LayoutStylesheetUrl() ?>" />
</head>
[…]
<?php // Adding BotDetect Captcha to the page
$ExampleCaptcha = new Captcha("ExampleCaptcha");
$ExampleCaptcha->UserInputID = "CaptchaCode";
echo $ExampleCaptcha->Html();
?>
<input name="CaptchaCode" id="CaptchaCode" type="text" />
<?php
if ($_POST) {
// validate the Captcha to check we're not dealing with a bot
$isHuman = $ExampleCaptcha->Validate();
if (!$isHuman) {
// TODO: Captcha validation failed, show error message
} else {
// TODO: Captcha validation passed, perform protected action
}
}
?>