From 985272db6a30836f3e15e78d09c5e35aee3fd0fa Mon Sep 17 00:00:00 2001 From: Li Heng Date: Thu, 26 Dec 2013 09:08:35 +0000 Subject: [PATCH] =?UTF-8?q?=E9=AA=8C=E8=AF=81=E7=A0=81=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=E5=B0=81=E8=A3=85!?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/module/Helpers/Captcha.php | 14 ++++++++++---- application/module/Users/Local.php | 4 +--- 2 files changed, 11 insertions(+), 7 deletions(-) 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(); }