Dedecms5.7 solution to not display verification code in the background

Source: Internet
Author: User
Comments: Today, my friend asked me that the verification code cannot be displayed when dedecms5.7 is installed locally and on the server. Generally, this is rare. generally, it is about server settings, there is also a temporary directory permission issue Dede background verification code is not displayed or abnormal in three cases, the following analysis one by one Dede background verification code is not displayed a Dede background verification code is not displayed

Today, my friend asked me that he could not display the verification code when dedecms5.7 was installed on the local server and the server. this is rare. generally, it is caused by server settings and temporary directory permissions.

The Dede background verification code is not displayedThere are three possible situations:

Dede background verification code not shown in scenario 1


Dede background verification code is not displayed. case 2

Dede background verification code not displayed case 3

General solution-cancel the background verification code function

The PHP file source cannot be modified because no verification code is available in the background.

Method 1:

Open dede/login. php and find the following code:

If ($ validate = ''| $ validate! = $ Svali) & preg_match ("/6/", $ safe_gdopen )){

ResetVdValue ();

ShowMsg ('verification code is incorrect! ', 'Login. php );

Exit;

}

Replace the first line with if (false ){

Solve the problem. go directly to the background without entering the verification code.

Method 2

Open data/safe/inc. safe. config. php

Delete 6 from code $ safe_gdopen = '1, 2, 3, 4, 5, 6, 7 ';.

Dede background verification code not shown in case 1 analysis

The verification code requires the GD Library. check whether your environment has enabled the GD Library.

Dede background verification code not displayed case 2 analysis

The verification code only shows the background and does not show letters

Open the verification code generation file Include/vdimgck. php

Find

For ($ I = 0; $ I <$ rndcodelen; $ I ++)

{

$ Bc = mt_rand (0, 1 );

$ Rndstring [$ I] = strtoupper ($ rndstring [$ I]);

$ C_fontColor = $ fontColor [mt_rand (0, 4)];

$ Y_pos = $ I = 0? 4: $ I * ($ font_size + 2 );

$ C = mt_rand (0, 15 );

@ Imagettftext ($ im, $ font_size, $ c, $ y_pos, 19, $ c_fontColor, $ font_file, $ rndstring [$ I]);

$ Lastc = $ rndstring [$ I];

}

The Imagettftext () function is not successfully executed. as a result, the verification code only displays the background and no letters.

The specific cause is the incorrect font file path. Solution

1. check whether the font file in include/data/fonts/is ggbi. ttf by default.

2 Add the following to the line for ($ I = 0; $ I <$ rndcodelen; $ I ++ ):

$ Font_file = str_replace ("\", "/", $ font_file );

That is, replace the backslash in the path of the font file with the slash, because we know that the backslash has the conversion character function,

$ Font_file: \ appserv \ www system error. the backslash is used as an escape character. as a result, $ font_file is not a path. Therefore, the Imagettftext () function always returns an error.

Add $ font_file = str_replace ("\", "/", $ font_file );

Dede background verification code not displayed case 3 analysis

The Include/data/words/words.txt file does not exist.

Solution 1 copy one

2. find the code 'word _ type' => (int) $ safe_codetype, // 1: Number 2: English 3: word

Change to 'Word _ type' => 1 (or 2). the verification code is a number or an English

The Dede background verification code is not displayed in all cases.

If it can be displayed and then the verification code is canceled, you can try overwriting the data and include directories.

Related Article

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.