search
Homephp教程PHP开发Solution to invalid php session verification

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="/static/imghwm/default1.png"  data-src="../inc/ver.php"  class="lazy"   onclick="this.src=&#39;../inc/ver.php&#39;;" / alt="Solution to invalid php session verification" >

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;  
}

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;

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!

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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!