The question is kind of pointless, assuming you've read the Securimage quick start guide.
// form.volt
<form>
<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>
</form>
That being said, if you want to integrate Securimage with Phalcon, you would do something like this:
- Register the securimage folder with the class loader
/// loader.php
// ...
$loader->registerDirs([
<PUBLIC_DIR>.'/securimage/',
]);
// ...
- Explicitly start the session in controller action then validate
// MyController.php
// ...
public function formAction() {
$this->session->start();
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
}
}
}
// ...