Yii Framework Forum: [Behavior] - Yii Framework Forum

Jump to content

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

[Behavior] Aii Anti Spam Behavior Rate Topic: -----

#1 User is offline   aztech 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 206
  • Joined: 12-December 08
  • Location:Poland

Posted 15 November 2010 - 08:37 AM

This behavior is designed to use as anti-spam solution e.g. for comments model. The basis of this solution is to use hidden fields in form and check if they are empty during validation. This is because most of spam-bots fill all fields in form. Real users doesn't :) Second anti-spam solution is checking how long form is filled by submitter. Robots fills form really quick, while user need for that at least 1-2 seconds. Measuring time between creating model and saving it gives us answer if we are dealing with form filled by reals user of spam-bot.

Note, aim of this behavior is to avoid using captcha, as it isn't user friendly solution and it is not so good as it should be in spam filtering. Off course you can use this extension together with captcha to strengthen your anti-spam mechanism.

Links
If you have any interesting solution I can add to this extension do not hesitate to write here.

Attached File(s)


I'm not complete idiot... some parts are missing!
0

#2 User is offline   benomatis 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 1
  • Joined: 27-November 13

Posted 27 November 2013 - 08:44 AM

I know this is quite old, but I'm quite new to Yii and I was wondering if you could help me solve this.

I tried to implement this behavior on a basic (and recent, v1.1.14) Yii installation, and added it to the standard ContactForm as is (obviously changing the path) however it failed with the following error:

Event "ContactForm.onBeforeSave" is not defined.


The error goes away by adding replacing BeforeSave with onBeforeSave and then AfterSave with onAfterSave (as that was the next error coming up) in AiiAntiSpamBehavior, however I don't think it's doing anything.

Also, could you please clarify the intended usage of the field in emptyFieldsConfig? Is this supposed to be an existing field that's going to be hidden by this extension or am I supposed to make up a field name that the behavior will then create dynamically? I tried it with an existing field, but after doing the above changes, my email field was still present (was not hidden).

Additionally submitTimeConfig also has a field, and the comment says "field where error message should be displayed", so I'm guessing that would have to be a different field than the above, one that's actually not hidden, am I correct?

Thanks in advance!
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