ECMall驗證碼問題

1、確認問題:php

輸入下面這個地址:http://你的網址/index.php?app=captcha&876589486app

打開後出現:mt_rand(): max(0) is smaller than min(1) 或者 mt_rand(): max(24) is smaller than min(26) 等類型的錯誤,則能夠採起咱們下面給出的解決方法。編輯器

 

2、問題緣由:this

在PHP 5.3.3版本之前,mt_rand($a, $b)傳入的參數$a和$b兩者沒有數字大小比較的限制,可是自5.3.4版本PHP開始,傳入的參數必須知足$a <= $b,即第一個參數必須小於等於第二次參數。但根據目前ECMall的代碼,會出現$a>$b 的狀況,因此,咱們要避免出現這一狀況。方法

 

3、解決問題:總結

1)打開(注意:不要用記事本打開,要用DW等網頁編輯器打開修改) app/captcha.app.php

$this->_captcha(80, 24);
改成
$this->_captcha(80, 26);co

2)打開 admin/app/captcha.app.php 

$this->_captcha(70, 20);
修改成:
$this->_captcha(70, 26);數字

3)打開 includes/libraries/captcha.lib.php錯誤

把274行中的
$x = mt_rand($font[0]['angle'] > 0 ? cos(deg2rad(90 - $font[0]['angle'])) * $font[0]['zheight'] : 1, $this->width - $widthtotal);
改成:
$x = mt_rand($font[0]['angle'] > 0 ? cos(deg2rad(90 - $font[0]['angle'])) * $font[0]['zheight'] : 0, $this->width - $widthtotal);版本

 

總結:由此能夠看出,此種狀況,通常只是在PHP5.3以上的版本纔會出現,若是你的是PHP5.2.*的版本,不用考慮此解決方法。

相關文章
相關標籤/搜索