PHP validation Session invalidation workaround _php Tips

Source: Internet
Author: User

The example in this article describes a workaround for PHP validation session invalidation. Share to everyone for your reference. The specific methods are as follows:

I. Problems

Today in the configuration of apache+php environment for a long time, and then succeeded but found that the verification code picture can be generated, in the logon verification found that the session is empty, and there is no value.

Ii. Solutions

Environment: apache+php

The program code is as follows:

Copy Code code 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" >

Processing files After submitting this post.php file
Copy Code code as follows:
if ($_session[' Ssioner ']!= $ssever) {
Echo (' <script>alert (' captcha must consist of 4 digits! '); History.back ();</script> "); exit;
}

The results indicate that the verification code must consist of 4 digits and then print out the session:

Copy Code code as follows:

echo $_session[' Ssioner '];
Exit

has been empty, when I thought of the PHP environment configuration of a session file directory, now we find the php.ini configuration file to find
Upload_tmp_dir
Found this directory is
Upload_tmp_dir= "D:\WWW.JB51.NET\TP"
I check my d disk found only www.jb51.net file and no TP directory, so the problem is found, when I create a TP directory, restart Apache found in the TP directory has sess_i40gl0p4hfep5r69j67o1k26d01 files, The login was successful again.

I hope this article will help you with your PHP program design.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.