PHP session is not valid, how to write not in, in other files are used very well.
Session_Start ();
if (Isset ($_post[' Sub ')) {
Require "./config.php";
if ($_post[' login_name ']== $admin _name && $_post[' login_pwd ']== $admin _pwd) {
$_session[' Login_status ']== "Oko";
}else{
echo " wrong account or password!";
}
}
?>
Background Management page
if ($_session[' Login_status ']!= "Oko") {
Var_dump ($_session[' login_status ');//This place is always null
?>
}else{
echo "LL";
}
?>
Code as above, very simple, but the session has not been written in, do not know what the reason!!
------Solution--------------------
$_session[' Login_status '] ="Oko"; Assignment is a = sign
------Solution--------------------
The modified code
if (Isset ($_post[' Sub ')) {
Require "./config.php";
if ($_post[' login_name ']== $admin _name && $_post[' login_pwd ']== $admin _pwd) {
$_session[' Login_status ']= "Oko";//This place you have a "="
}else{
echo "
wrong account or password!";
}
}else{
Session_Start ();//session_start (); run once, and put it in the front of the code
}
?>
<title>Background Management page</title>
if ($_session[' Login_status ']!= "Oko") {
Var_dump ($_session[' login_status ');//This place is always null
?>
}else{
echo "LL";
Var_dump ($_session[' login_status ');//You can print this place.
}
?>