Customizing the Save Message event to work with textCAPTCHA?
This is an open discussion with 2 replies, filed under General.
Search
I’m still pretty stuck on this… Can anyone give me a hand?
I’ve only had a brief look but you might try something like
protected function __trigger(){ $answer = $_POST['answer']; $captcha = $_POST['captcha1']; if(md5(strtolower($answer))==$captcha){ include(TOOLKIT . '/events/event.section.php'); } else { $result = new XMLElement(self::ROOTELEMENT); $result->setAttribute('result', 'error'); $result->appendChild(new XMLElement('message', __('The Captcha text you've entered was incorrect..'))); $result->appendChild(buildFilterElement('textcaptcha', 'failed')); } return $result; }
Create an account or sign in to comment.
I’m working on a little side project due to having a regular request from my clients to implement some manner of spam protection. I’m looking for a method that could work on sites of all sizes and the best option I’ve found is the textCAPTCHA.
The problem is, I’m having trouble integrating it.
The XSLT I’m using for my page is:
Towards the end you can see where I iterate through the returned XML and generate the MD5 answers to test against. The problem is, I’m having an issue getting the test part working and my guess is I have to make changes in the
event.save_message.php
file, right?I tried changing the default trigger function to this:
But I’m getting not success or fail response so I’m not sure what’s going on. Also, my PHP is almost non-existant so I’m pretty much guessing.
Can anyone point me in the right direction?