PHP sessions are invalid. they cannot be written to any other files.

Source: Internet
Author: User
PHP sessions are invalid. they cannot be written to any other files.
 Incorrect account or password!";}}?>Background management page
 
 


The code above is very simple, but the SESSION has never been written. I don't know why !!


Reply to discussion (solution)

$ _ SESSION ['login _ status'] = "oko"; // The value is a = sign.

You have a try

Modified code

If (isset ($ _ POST ['sub']) {
Require "./config. php ";
If ($ _ POST ['login _ name'] = $ admin_name & $ _ POST ['login _ pwd'] = $ admin_pwd ){
$ _ SESSION ['login _ status'] = "oko"; // Here you have an additional "="
} Else {
Echo"Incorrect account or password!";
}
} Else {
Session_start (); // session_start (); run it once and put it at the beginning of the code.
}
?>


Background management page


If ($ _ SESSION ['login _ status']! = "Oko "){
Var_dump ($ _ SESSION ['login _ status']); // This location is always NULL.
?>

} Else {
Echo "ll ";
Var_dump ($ _ SESSION ['login _ status']); // print this location
}
?>



$ _ SESSION ['login _ status'] = "oko"; // The value is a = sign.

= No. Error

Okay, I admit it...

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.