<?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
25Jul2016
php verification code class php verification code
13Jan2017
Yesterday in a Q group, the group leader posted a demo of using ASP.NET to implement verification code. I downloaded it and ran it normally. The img tag on the page successfully called a general handler and displayed the Chinese verification code image, although it was a little bit It's blurry, but it can be seen that there are four Chinese characters on it. The background of the picture is white, there are noise lines behind it, and the border is black.
12Jul2016
Verification code class, php verification code class. Verification code class, php verification code class. Familiar with related image processing functions, simple verification code class 1 // code class 2 class ValidateCode { 3 private $charset = 'abcdefghkmnprstuvwxyzABCDEFGHKMNP
18Apr2018
This article mainly introduces the use of PHP to implement the verification code class. It has certain reference value. Now I share it with you. Friends in need can refer to it.
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