Ecmall Verification Code

Source: Internet
Author: User

I. Confirm the problem:

Enter the following url: http: // your url/index. php? APP = CAPTCHA & 876589486

An error of the following types occurs: mt_rand (): max (0) is smaller than min (1) or mt_rand (): max (24) is smaller than min (26, then we can take the solution below.

 

Ii. cause:

Before PHP version 5.3.3, the parameters $ A and $ B passed in by mt_rand ($ A, $ B) have no limit on the number size comparison, but since PHP version 5.3.4, the input parameter must meet $ A <= $ B, that is, the first parameter must be less than or equal to the second parameter. However, according to the current ecmall code, $ A> $ B may occur, so we should avoid this situation.

 

Iii. Problem Solving:

1) Open the APP/CAPTCHA. App. php (do not use NotePad to open and modify it in DW or another Web Editor)
Set
$ This-> _ CAPTCHA (80, 24 );
Change
$ This-> _ CAPTCHA (80, 26 );

2) Open admin/APP/CAPTCHA. App. php
Set
$ This-> _ CAPTCHA (70, 20 );
To:
$ This-> _ CAPTCHA (70, 26 );

3) Open the replicdes/libraries/CAPTCHA. Lib. php

Set
$ X = mt_rand ($ font [0] ['angle ']> 0? Cos (deg 2rad (90-$ font [0] ['angle ']) * $ font [0] ['zheight']: 1, $ this-> width-$ widthtotal );
Changed:
$ X = mt_rand ($ font [0] ['angle ']> 0? Cos (deg 2rad (90-$ font [0] ['angle ']) * $ font [0] ['zheight']: 0, $ this-> width-$ widthtotal );

 

Conclusion: we can see that this situation is generally only available in php5.3 or later versions. If you are using php5.2. *, you do not need to consider this solution.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.