Beispiel #1
0
 public function getVerify()
 {
     $_tmps = array();
     Wind::import('LIB:utility.verifycode.PwGDCode');
     $_tmps = $this->_config['content.type'];
     $_key = array_rand($_tmps, 1);
     switch ($_tmps[$_key]) {
         case '1':
         case '2':
         case '3':
         case '5':
             PwGDCode::$verifyLength = $this->_config['content.length'];
             PwGDCode::$verifyType = $_tmps[$_key];
             PwGDCode::$verifyWidth = $this->_config['width'];
             PwGDCode::$verifyHeight = $this->_config['height'];
             break;
         case '4':
             $askAnswer = $this->_getVerifyCalculate();
             PwGDCode::$verifyType = $_tmps[$_key];
             PwGDCode::$askCode = $this->_config['content.showanswer'] ? $askAnswer['ask'] . '(' . $askAnswer['answer'] . ')' : $askAnswer['ask'];
             PwGDCode::$answerCode = $askAnswer['answer'];
             PwGDCode::$verifyWidth = $this->_config['width'];
             PwGDCode::$verifyHeight = $this->_config['height'];
             break;
         case '6':
             $askAnswer = $this->_getVerifyAsk();
             //PwGDCode::$verifyWidth = 300;
             PwGDCode::$verifyType = $_tmps[$_key];
             PwGDCode::$askCode = $this->_config['content.showanswer'] ? $askAnswer['ask'] . '(' . $askAnswer['answer'] . ')' : $askAnswer['ask'];
             PwGDCode::$answerCode = $askAnswer['answer'];
             PwGDCode::$verifyWidth = $this->_config['width'];
             PwGDCode::$verifyHeight = $this->_config['height'];
             break;
         default:
             PwGDCode::$verifyLength = 4;
             PwGDCode::$verifyType = 3;
             PwGDCode::$verifyWidth = $this->_config['width'];
             PwGDCode::$verifyHeight = $this->_config['height'];
             break;
     }
     $this->_getGDRandType();
     if (!PwGDCode::init()) {
         return false;
     }
     $this->_saveVerifyCode();
     if ($this->_config['type'] == 'image') {
         PwGDCode::outputImage();
     } else {
         PwGDCode::outputFlash();
     }
 }