Changeset 3017

Show
Ignore:
Timestamp:
07/09/2008 04:12:17 PM (5 months ago)
Author:
Geert
Message:

Follow-up to r3016. Forgot to commit the example. Oops.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/application/controllers/examples.php

    r2593 r3017  
    168168                // Yay! 
    169169                echo '{execution_time} ALL DONE!'; 
     170        } 
     171 
     172        /** 
     173         * Demontrates how to use the Captcha library. 
     174         */ 
     175        public function captcha() 
     176        { 
     177                // Form submitted 
     178                if (isset($_POST['captcha_answer'])) 
     179                { 
     180                        // Note: Captcha::valid() can be used in conjunction with the Validation library too 
     181                        echo (Captcha::valid($_POST['captcha_answer'])) ? 'Good answer!' : 'Wrong answer!'; 
     182                } 
     183 
     184                // Show form 
     185                echo form::open(); 
     186                echo '<p>'; 
     187                echo Captcha::factory()->render(); // <-- shows the Captcha challenge (image/riddle/etc) 
     188                echo '</p>'; 
     189                echo form::input('captcha_answer'); 
     190                echo form::submit(array('value' => 'Check')); 
     191                echo form::close(); 
    170192        } 
    171193