<?php //打印上一个session; //echo "上一个session:<b>".$_SESSION["authnum_session"]."</b><br>"; $validate=""; if(isset($_POST["validate"])){ $validate=$_POST["validate"]; echo "您刚才输入的是:".$_POST["validate"]."<br>状态:"; if($validate!=$_SESSION["authnum_session"]){ //判断session值与用户输入的验证码是否一致; echo "<font color=red>输入有误</font>"; }else{ echo "<font color=green>通过验证</font>"; } }
First create a complete verification page, and then open the session on the page first,
Remove the session, so that you can get a new session value every time;
The effect of using seesion is good, It’s also very convenient
All resources on this site are contributed by netizens or reprinted by major download sites. Please check the integrity of the software yourself! All resources on this site are for learning reference only. Please do not use them for commercial purposes. Otherwise, you will be responsible for all consequences! If there is any infringement, please contact us to delete it. Contact information: admin@php.cn
Related Article

12Jul2016
Very practical php verification code class, very practical php verification code. Very practical php verification code class, very practical php verification code This example shares the php verification code class for your reference. The specific content is as follows php /** * * @author Administrator * *

12Jul2016
PHP generates verification codes, class sharing of thumbnails and watermarks, and verification code watermarks. Class sharing for php to generate verification codes, thumbnails and watermarks. Verification code watermark encapsulates a class that can generate verification codes, thumbnails and watermarks. Share it with everyone. phpclass image{ sessio

06Jul2016
Image verification code file sharing written in PHP. Image verification code class file sharing written in PHP, suitable for customized verification code class! php /* * To change this license header, choose License Headers in Project Properties. * To change

12Jul2016
In php, GD library is used for verification code, and phpgd library is used for verification code. Use GD library to do verification code in php, phpgd library verification code php require_once 'string.func.php';//Use GD library to do verification code/** *Add verification text* @param int $type * @param int $length */function

13Dec2024
Linking Static Libraries to Other Static Libraries: A Comprehensive ApproachStatic libraries provide a convenient mechanism to package reusable...

12Jul2016
How to generate image verification code in php. How to generate image verification codes in PHP. This article shares with you how to generate image verification codes in PHP for your reference. The specific content is as follows. First, randomly select a fixed number from the specified character set.


Hot Tools

PHP library for dependency injection containers
PHP library for dependency injection containers

A collection of 50 excellent classic PHP algorithms
Classic PHP algorithm, learn excellent ideas and expand your thinking

Small PHP library for optimizing images
Small PHP library for optimizing images
