Solution for php validating that session is invalid
- 2021-07-26 07:02:10
- OfStack
In this paper, an example is given to explain the solution of php verifying session invalid. Share it for your reference. The specific methods are as follows:
1. Problems
Today, I tossed for a long time when configuring apache+php environment. Later, I succeeded, but I found that the verification code picture can be generated. When I logged in for verification, I found that session was empty and had no value.
2. Solutions
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';" />
Post-submission processing file post. php file
if($_SESSION['ssioner']!=$ssever){
echo("<script>alert(' The verification code must be defined by the 4 Bit number composition !');history.back();</script>");exit;
}
The results show that the 1 direct prompt verification code must be composed of 4 digits, and then print out session:
echo $_SESSION['ssioner'];
exit;
1 straight empty, then I thought of session environment configuration 1 session file directory, now we find php. ini configuration file found
upload_tmp_dir
Found that this directory is
upload_tmp_dir="D:\www.ofstack.com\tp"
I checked my D disk 1 and found that there were only www. ofstack. com files but no tp directory, so the problem was found. When I created an tp directory, I restarted apache and found that there were sess_i40gl0p4hfep5r69j67o1k26d01 files in tp directory.
I hope this article is helpful to everyone's PHP programming.