Let me take a look at what is wrong and how to lose it is to show the input error-php Tutorial

Source: Internet
Author: User
Let me see where the error is and how the input error is displayed.










03. php
Session_start ();
Function a ($ type, $ length, $ clear ){
$ Nums = range (0, 9 );
$ Xxzm = range ('A', 'z ');
$ Dxzm = range ('A', 'z ');
$ Igorne = array ('0', 'O', '1', 'L ');
$ Chars = array ();
If ($ type = 1)
$ Chars = $ nums;
If ($ type = 2)
$ Chars = array_merge ($ nums, $ xxzm );
If ($ type = 3)
$ Chars = array_merge ($ nums, $ xxzm, $ dxzm );
If ($ clear = true)
$ Chars = array_diff ($ chars, $ igorne );
$ Keys = array_rand ($ chars, $ length );
$ Code = "";
Foreach ($ keys as $ key)
$ Code = $ code. $ chars [$ key];
Return $ code;

}

$ Yzm = a (3,5, true );
$ _ SESSION ['yzm'] = $ yzm;
Echo $ yzm;
?>


Reply to discussion (solution)

You can print $ _ SESSION ['yzm'] and $ _ POST ['check'] at the beginning of the program file and the code segment that receives and submits it. then you will know the problem.

Require ('03. php'); // Generate a verification code and save it to $ _ SESSION
$ Checkstr = $ _ SESSION ['yzm']; // use the $ _ SESSION variable to obtain the verification code on the EX4_14_image.php page.
Always run later. Obviously, only the latest settings are obtained.

How can we change it?

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.