19 error_reporting(E_ALL);
20 ini_set(
'display_errors', 1);
23 require_once
'../securimage.php';
26 $captchaId = (isset($_GET[
'id'])) ? $_GET[
'id'] :
'';
29 if (isset($_GET[
'validate'])) {
31 $input = (isset($_GET[
'input'])) ? $_GET[
'input'] :
'';
36 echo
"<h2>Success</h2>"
37 .
"<span style='color: #33cc00'>The captcha code entered was correct!</span>"
40 echo
"<h2>Incorrect Code</h2>"
41 .
"<span style='color: #f00'>Incorrect captcha code, try again.</span>"
45 }
else if (isset($_GET[
'display'])) {
50 $options = array(
'captchaId' => $captchaId,
51 'no_session' =>
true);
68 <meta http-equiv=
"Content-Type" content=
"text/html;charset=utf-8">
69 <title>Static Captcha Example</title>
72 <h2>Static Captcha Example</h2>
78 <li>Display form with hidden field containing captchaId</li>
79 <li>Display captcha image passing the captchaId to the image</li>
85 Captcha ID: $captchaId<br /><br />
86 <img src=
"{$_SERVER['PHP_SELF']}?display&id=$captchaId" alt=
"Captcha Image" /><br />
88 <form method=
"get" action=
"{$_SERVER['PHP_SELF']}">
89 <input type=
"hidden" name=
"validate" value=
"1" />
90 <input type=
"hidden" name=
"id" value=
"$captchaId" />
92 <input type=
"text" name=
"input" value=
"" />
93 <input type=
"submit" name=
"submit" value=
"Check Captcha" />