search
HomePHP LibrariesOther librariesAn exquisite verification code class in php
An exquisite verification code class in php
<?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


Disclaimer

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

Very practical php verification code class, very practical php verification code_PHP tutorialVery practical php verification code class, very practical php verification code_PHP tutorial

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 * *

PHP generates verification code, thumbnail and watermark image class sharing, verification code watermark_PHP tutorialPHP generates verification code, thumbnail and watermark image class sharing, verification code watermark_PHP tutorial

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

Image verification code file sharing written in PHP,Image verification code file sharing written in PHP,

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

Use GD library to do verification code in php, phpgd library verification code_PHP tutorialUse GD library to do verification code in php, phpgd library verification code_PHP tutorial

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

How Do I Link Static Libraries That Depend on Other Static Libraries?How Do I Link Static Libraries That Depend on Other Static Libraries?

13Dec2024

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

How to generate image verification code in php, _PHP tutorialHow to generate image verification code in php, _PHP tutorial

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.

See all articles