Changeset 3047 for trunk/application
- Timestamp:
- 07/11/2008 07:14:01 AM (5 months ago)
- Files:
-
- 1 modified
-
trunk/application/controllers/examples.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/application/controllers/examples.php
r3043 r3047 178 178 new Profiler; 179 179 180 // Ban bots after 10 invalid responses 180 // Load Captcha library 181 $captcha = new Captcha; 182 183 // Ban bots (that accept session cookies) after 50 invalid responses 181 184 // Be careful not to ban real people though! Set the threshold high enough. 182 if ( Captcha::invalid_response_count() >9)185 if ($captcha->invalid_count() > 49) 183 186 exit('Bye! Stupid bot.'); 184 187 … … 187 190 { 188 191 // User has not given three valid responses yet 189 if ( Captcha::valid_response_count() < 3)192 if ($captcha->valid_count() < 3) 190 193 { 191 // Valid response has been submitted192 if (Captcha::valid _response($this->input->post('captcha_response')))194 // Captcha::valid() is a static method that can be used as a Validation rule also 195 if (Captcha::valid($this->input->post('captcha_response'))) 193 196 { 194 197 echo '<p style="color:green">Good answer!</p>'; … … 208 211 209 212 // Don't show Captcha anymore after three or more valid responses 210 if ( Captcha::valid_response_count() < 3)213 if ($captcha->valid_count() < 3) 211 214 { 212 215 echo '<p>'; 213 echo Captcha::factory()->render(); // Shows the Captcha challenge (image/riddle/etc)216 echo $captcha->render(); // Shows the Captcha challenge (image/riddle/etc) 214 217 echo '</p>'; 215 218 echo form::input('captcha_response');
