A VBS code that determines the verification code, please turn to PHP code

Source: Internet
Author: User
Tags php session
A VBS code about the verification code, please turn the master into PHP code
VBScript Code
  
   <% ' Determines whether the OK button is pressed, and if pressed, compares the verification code with the correct if Request.QueryString ("Submit") <> "then       Dim checkcode,sessioncode      Checkcode = Trim (Request.QueryString ("Checkcode"))      sessioncode=session ("Verifycode")            ' The following two sentences are used to convert the registration code to all uppercase and can be easily entered by the user      Checkcode=ucase (checkcode)      sessioncode=ucase (sessioncode)      If Checkcode = Sessioncode then               response.redirect ("http://www.hzynh.cn") "Enter the download address here, after verifying the success can jump to the download address      Else              Response.Write ("")       End If End If%>


------Solution--------------------
PHP code
!--? phpif (!empty ($_request[' submit '])) {$checkCo    de = Strtoupper (Trim ($_request[' checkcode '));        $sessionCode = Strtoupper ($_session[' Verifycode ');    if ($checkCode = = $sessionCode) echo ""; else echo "";}? --> 
------Solution--------------------
!--? php
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 "";
}
}
?


------Solution--------------------
If you are reading a PHP session, then you are not enabled session
missing Session_ Start ();

If you try to read the session of the ASP, then I'm sorry, you can't read the
  • 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.