Home  >  Article  >  Backend Development  >  Solution to invalid php session verification, php session verification_PHP tutorial

Solution to invalid php session verification, php session verification_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 10:15:09960browse

Solution to invalid php verification session, php verification session

The example in this article describes the solution to the invalid PHP session verification. Share it with everyone for your reference. The specific method is as follows:

1. Questions

Today, I struggled for a long time when configuring the apache+php environment. Later, I succeeded, but I found that the verification code image could be generated. During the login verification, I found that the session was empty and had no value.

2. Solution

Environment: apache+php

The program code is as follows:

Copy code The code is as follows:




After submission, process the file post.php file
Copy code The code is as follows:
if($_SESSION['ssioner']!=$ssever){
echo("<script>alert('The verification code must consist of 4 digits!');history.back();</script>");exit;
}

It turns out that it keeps prompting that the verification code must consist of 4 digits, and then prints out the session:

Copy code The code is as follows:

echo $_SESSION['ssioner'];
exit;

It has been empty, so I thought of a session file directory in the php environment configuration. Now we find the php.ini configuration file and find
upload_tmp_dir
Found this directory is
upload_tmp_dir="D:www.jb51.nettp"
I checked my D drive and found that there was only the www.jb51.net file but no tp directory. The problem was found. Then I created a tp directory, restarted apache and found that there was the sess_i40gl0p4hfep5r69j67o1k26d01 file in the tp directory. Then I logged in again. The discovery was successful.

I hope this article will be helpful to everyone’s PHP programming design.

Why is the php session invalid? ?

SESSION_START();
if(isset($_POST['name'])){
$_SESSION['name']='test';
}


Solution to the session verification code and display delay by one digit in php

First you can debug in your project and print out your verification code information in the class. Whether it is consistent with the verification code displayed on the page, generally there will be no problem. Unless you load it multiple times when quoting.
I have written a verification code function before, you can refer to it: Baidu php verification code pooy. You can find the articles I wrote before.




http://www.bkjia.com/PHPjc/906116.html

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/906116.htmlTechArticleSolution to invalid php verification session, php verification session This article explains the solution to invalid php verification session. Share it with everyone for your reference. The specific method is as follows: 1. Ask...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn