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='../inc/ver.php';" />
Process the file after submission. This post.php file
if($_SESSION['ssioner']!=$ssever){ echo("<script>alert('验证码必须由4位数字组成!');history.back();</script>");exit; }
It turns out that it keeps prompting that the verification code must consist of 4 digits, and then prints it out. session:
echo $_SESSION['ssioner']; exit;
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!