Home > Backend Development > PHP Problem > PHP method to determine session failure

PHP method to determine session failure

藏色散人
Release: 2023-03-17 10:20:02
Original
2040 people have browsed it

php method to determine session failure: 1. Open the "php.ini" configuration file and find "upload_tmp_dir"; 2. Create a tp directory; 3. Restart apache; 4. Log in again.

PHP method to determine session failure

The operating environment of this tutorial: Windows 7 system, PHP version 8.1, Dell G3 computer.

php method to determine session invalidation

php method to verify session invalidation

1. Problem

Today I struggled for a long time when configuring the apache php environment. Later, I succeeded but 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:

The 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 The code of this post.php file

is as follows:

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 out the session:

The code is as follows:

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

has always 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
Copy after login

and find that this directory is

upload_tmp_dir="D:\www.phpstudy.net\tp"
Copy after login

I checked my D drive and found that there was only the www.phpstudy.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 tried again. The login was found to be successful.

Recommended learning: "PHP Video Tutorial"

The above is the detailed content of PHP method to determine session failure. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
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
Latest Issues
Session
From 1970-01-01 08:00:00
0
0
0
session
From 1970-01-01 08:00:00
0
0
0
session login information
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template