By submitting PHP Resources you own, or know of, you'll help us build the largest PHP Resource website on the net. Please double check that your resource doesn't already exist before you submit it!!. We thank you for helping make this a better website.
This package provides the functionality to create Numeral
CAPTCHAs (Completely Automated Public Turing
tests to tell Computers and Humans Apart). Features include:
The package creates numeral CAPTCHAs; due to the
stateless nature of the HTTP protocol, the logic to secure a
webpage using the package must be specifically implemented.
See the usage example
for detailled information.
require_once 'Text/CAPTCHA/Numeral.php';
$num = new Text_CAPTCHA_Numeral;
$operation = $num->getOperation();
/**
* This will print the mathematical operation
* that has been generated by the package.
*/
print $operation;
require_once 'Text/CAPTCHA/Numeral.php';
$numcap = new Text_CAPTCHA_Numeral;
if (isset($_POST['captcha']) && isset($_SESSION['answer'])) {
if ($_POST['captcha'] == $_SESSION['answer']) {
$errors[] = 'Ok... You might be human...';
} else {
$errors[] = 'You are dumb or not human';
}
}
if (!empty($errors)) {
foreach ($errors as $error) {
print "<h1><font color='red'>$error</font></h1><br />";
}
}
print '
<form name="capter" action="index.php?page=liveExample" method="post">
<table>
<tr>
<th>What is this result pilgrim?: '.$numcap->getOperation().'</th>
<td><input type="text" value="" name="captcha" /></td>
</tr>
<tr>
<th/>
<td><input type="submit" value="Let me prove you that I am human!" /></td>
</tr>
</form>
';
$_SESSION['answer'] = $numcap->getAnswer();