PHP code example of ahead4 / captcha
1. Go to this page and download the library: Download ahead4/captcha library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
ahead4 / captcha example snippets
use Gregwar\Captcha\CaptchaBuilder;
$builder = new CaptchaBuilder;
$builder->build();
$builder->save('out.jpg');
header('Content-type: image/jpeg');
$builder->output();
<img src=" echo $builder->inline();
// Example: storing the phrase in the session to test for the user
// input later
$_SESSION['phrase'] = $builder->getPhrase();
if($builder->testPhrase($userInput)) {
// instructions if user phrase is good
}
else {
// user phrase is wrong
}