diff --git a/application/module/Helpers/Captcha.php b/application/module/Helpers/Captcha.php index dc61b759..bd91224e 100644 --- a/application/module/Helpers/Captcha.php +++ b/application/module/Helpers/Captcha.php @@ -6,6 +6,7 @@ class Captcha extends \Zend_Controller_Plugin_Abstract public $captcha; private $sessionName = "captcha"; + private $imgDir = "images/captcha"; function __construct($db = NULL) { @@ -16,20 +17,25 @@ class Captcha extends \Zend_Controller_Plugin_Abstract { $this->captcha = new \Zend_Captcha_Image(array( 'captcha' => 'Image', - 'wordLen' => 4, + 'wordLen' => 6, 'fontsize'=>16, 'width' => 100, 'height' => 38, 'dotNoiseLevel'=>2, 'lineNoiseLevel'=>1, 'timeout' => 300, - 'font' => '../data/fonts/ggbi.ttf', - 'imgDir' => 'vdimg/', - 'imgUrl' => '/vdimg', + 'font' => '../data/fonts/ggbi.ttf', + 'imgDir' => $this->imgDir, + 'imgUrl' => '/images/captcha', )); } public function setCaptcha(){ + if(!is_dir($this->imgDir)) + { + mkdir($this->imgDir); + } + $this->captcha->generate(); $_SESSION[$this->sessionName] = $this->captcha->getWord(); $url = $this->captcha->getImgUrl() diff --git a/application/module/Users/Local.php b/application/module/Users/Local.php index f08d6a91..91f552c4 100644 --- a/application/module/Users/Local.php +++ b/application/module/Users/Local.php @@ -26,10 +26,8 @@ class Local extends \Zend_Controller_Plugin_Abstract $this->db = $db; } - $this->config = \Zend_Registry::get('config'); + $this->config = \Zend_Registry::get('6config'); -# $Listener = new ReferenceListener(); -# @$this->events()->attachAggregate($Listener); $this->table = new \Helpers\Table(); }