Yii Framework Forum: assira captcha - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

assira captcha Rate Topic: -----

#1 User is offline   dimis283 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 277
  • Joined: 24-January 09

Posted 12 October 2009 - 02:47 AM

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
'assira'=>array('class'=>'application.extensions.assira.Assira'),

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
			array('verifyCode','assira'),....

 function assira() {
        if (Yii::app()->assira->ValidateAsirraChallenge()==false)
            $this->addError( 'verifyCode','Please select the right photos');
        else
            return true();

    }

I am waiting for suggestions or improvements
[Edit] I had to fix something,so I re-upload the file

Attached File(s)


Posted Image
0

#2 User is offline   dimis283 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 277
  • Joined: 24-January 09

Posted 12 October 2009 - 11:54 AM

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;
 $cs->registerScriptFile(Yii::app()->request->baseUrl.'/js/assira.js'); 

and
<div >
             <script type="text/javascript" src="//challenge.asirra.com/js/AsirraClientSide.js"></script>
            
<script type="text/javascript" src="<?php echo Yii::app()->request->baseUrl; ?>/js/asssiraphotos.js" ></script>
        </div>
at the place of the cats div
You may look also at the php demo
Posted Image
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users