Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.


how to use Securimage in volt


The question is kind of pointless, assuming you've read the Securimage quick start guide.

// form.volt
<img id="captcha" src="/securimage/securimage_show.php" alt="CAPTCHA Image" />
<input type="text" name="captcha_code" size="10" maxlength="6" />
<a href="#" onclick="document.getElementById('captcha').src = '/securimage/securimage_show.php?' + Math.random(); return false">[ Different Image ]</a>

That being said, if you want to integrate Securimage with Phalcon, you would do something like this:

  1. Register the securimage folder with the class loader
/// loader.php

// ...
// ...
  1. Explicitly start the session in controller action then validate
// MyController.php

// ...
public function formAction() {
   if($this->request->has('captcha_code')) {
      $securimage = new Securimage();
      if($securimage->check($this->request->get('captcha_code')) == false) {
         / Client is probably a bot or clumsy human
// ...