Home > php教程 > PHP开发 > body text

Solution to invalid php session verification

高洛峰
Release: 2016-12-24 09:35:49
Original
1173 people have browsed it

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

1. Problem

I spent a long time configuring the apache+php environment today. 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:

<input name="username" type="text" class="input" id="username">
<input name="password" type="password" class="input" id="password">
<input name="ver" type="text" class="input1" id="ver" size="5">
<img src="../inc/ver.php" onclick="this.src=&#39;../inc/ver.php&#39;;" />
Copy after login

Process the file after submission. This post.php file

if($_SESSION[&#39;ssioner&#39;]!=$ssever){
echo("<script>alert(&#39;验证码必须由4位数字组成!&#39;);history.back();</script>");exit;  
}
Copy after login

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

echo $_SESSION[&#39;ssioner&#39;];
exit;
Copy after login

has always been empty, so I thought of a session file directory configured in the php environment. Now we find the php.ini configuration file and find
upload_tmp_dir
and find that this directory is
upload_tmp_dir="D:www.php. cntp"
I checked my D drive and found that there was only the www.php.cn file but no tp directory, so the problem was found. So I created a tp directory, restarted apache and found that there was the sess_i40gl0p4hfep5r69j67o1k26d01 file in the tp directory, so Logged in again and found success.


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

For more articles related to solutions to invalid PHP session verification, please pay attention to the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
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
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template