A piece of vbs code about verification code judgment should be converted into php code.

Source: Internet
Author: User
Tags php session
For a piece of vbs code about verification code judgment, convert it to php code VBScriptcode & lt; % 'to determine whether the confirmation button is pressed. if so, compare whether the verification code is entered correctly IfRequest. queryString (& quot; submit & quot;) & lt; & gt; & quot; a piece of vbs code for determining the verification code. convert it to php code.
VBScript code
  <% 'Indicates whether the OK button is pressed. If yes, check whether the verification code is entered correctly If Request. queryString ("submit") <> "" Then Dim checkCode, sessionCode checkCode = Trim (Request. queryString ("checkCode") sessionCode = Session ("verifycode") 'the following two statements are used to convert all registration codes to uppercase, so that you can easily enter checkCode = UCase (checkCode) sessionCode = UCase (sessionCode) If checkCode = sessionCode Then Response. redirect ("http://www.hzynh.cn") ''here, after the verification is successful, you can jump to Else Response. write ("script" alert ('verification code error, please enter 'again); script ") End If %>


------ Solution --------------------
PHP code
  
------ Solution --------------------
If (isset ($ _ POST ['submit '])
{
$ CheckCode = Trim ($ _ POST ['checkcode']);
Session_start ();
$ SessionCode = $ _ SESSION ['verifycode'];
Session_destroy ();
$ CheckCode = UCase ($ checkCode );
$ SessionCode = UCase ($ sessionCode );
If ($ checkCode = $ sessionCode)
{
Header ("Location: http://www.hzynh.cn ");
}
Else
{
Echo "script" alert ('verification code error, please input it again '); script ";
}
}
?>


------ Solution --------------------
If you read the php session, you have not enabled the session.
Session_start ();

If you try to read the asp session, sorry, you cannot read 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.