<?php
/* require_once('Zend/Loader.php');
Zend_Loader::registerAutoload();
*/
class UtilityController extends CustomControllerAction
{
public function captchaAction()
{
$session = new Zend_Session_Namespace('captcha');
// check for existing phrase in session
$phrase = null;
if (isset($session->phrase) && strlen($session->phrase) > 0)
$phrase = $session->phrase;
$captcha= new Utility_Captcha();
$fontpath= Zend_Registry::get('config')->paths->data . '/'.'VeraBd.ttf';
$captcha->init($fontpath);
// write the phrase to session
$session->phrase = $captcha->getPhrase();
// disable auto-rendering since we're outputting an image
$this->_helper->viewRenderer->setNoRender();
header('Content-type: image/png');
header("Expires:");
header("Pragma: no-cache");
echo $captcha->getCAPTCHA();
$captcha->destroy();
}
}
?>