assira captcha

I make an extension for the assira ’ CAPTCHA’.

I post the demo app.I use the contact form as a demo.

The class is the extensions/assira/assira.php- I put it at config/main.php


I use also 2 js files js/assira.js,asssiraphotos.js as you can see at contact view.

Also ant contactform.php there is the validation rule

public function rules()


		return array(...

// verifyCode needs to be entered correctly


 function assira() {

        if (Yii::app()->assira->ValidateAsirraChallenge()==false)

            $this->addError( 'verifyCode','Please select the right photos');


            return true();


I am waiting for suggestions or improvements

[Edit] I had to fix something,so I re-upload the file

Something more.

At form we must write the onsubmit function and the id

  <?php echo CHtml::beginForm('','post',array('id'=>'mainForm',

'onSubmit'=>'return Asirra_CheckIfHuman(HumanCheckComplete)')); ?>


Also we have to include the javascript files.

 $cs = Yii::app()->clientScript;



<div >

             <script type="text/javascript" src="//"></script>


<script type="text/javascript" src="<?php echo Yii::app()->request->baseUrl; ?>/js/asssiraphotos.js" ></script>


at the place of the cats div

You may look also at the php demo