$ _SESSION ['foo']没有定义尽管它应该是

时间:2017-12-26 00:17:36

标签: php indexing isset

这真烦人,我不明白... Icheck the Isset然后我分配了veraialbe ..但是我接下来的检查,尽管可靠的应该设置它然后不...而且为什么if(!isset($ _ SESSION ['foo']如果没有veriable / index,我没有得到它,那就是整个点(!isset aint it ..无论如何,看看我的代码。)任何人都明白为什么不设置这个..谢谢..

SESSION [ '的loggedIn'] 问题

        if ($_SESSION['homepage']='001') {$_SESSION['message']==$_SESSION['message']; unset($_SESSION['homepage']);} // if message comes from anything other than the login post

        (!isset($_SESSION['homepage'])) { $_SESSION['message']==$_SESSION['message']}; // if message comes from anything other than the login post

        if (isset($_SESSION['loggedin'])) {$_SESSION['loggedin']=$_SESSION['loggedin'];} else {$_SESSION['loggedin=']='000';} 

if(!isset($ _ SESSION ['loggedin'])){$ _SESSION ['loggedin'] ='000';}

        if (!isset($_SESSION['message'])) { $_SESSION['message']='Please Log into an Account';}



if (isset($_POST['email'])) {
unset($_POST['email']);
unset($_POST['confirmemail']);
unset($_POST['password']);
unset($_POST['confirmpassword']);
}
    else
    if (isset($_POST['email'])) {
    unset($_POST['email']);
    unset($_POST['confirmemail']);
    unset($_POST['password']);
    unset($_POST['confirmpassword']);
    }
        else
        if (isset($_POST['confirmemail'])) {
        unset($_POST['email']);
        unset($_POST['confirmemail']);
        unset($_POST['password']);
        unset($_POST['confirmpassword']);
        }
            else
            if (isset($_POST['confirmpassword'])) {
            unset($_POST['email']);
            unset($_POST['confirmemail']);
            unset($_POST['password']);
            unset($_POST['confirmpassword']);
            };


          ........THROWS index not defined here......
if (!isset($_SESSION['loggedin'])) 
{$_SESSION['loggedin']=='000'; 
$_SESSION['message'] = 'You are NOT Logged into your account <br> Please Log in';}

1 个答案:

答案 0 :(得分:0)

    if ($_SERVER["REQUEST_METHOD"] == "POST") {

        if ($_SESSION['homepage']='001') {$_SESSION['message']==$_SESSION['message']; unset($_SESSION['homepage']);} // if message comes from anything other than the login post

        (!isset($_SESSION['homepage'])) { $_SESSION['message']==$_SESSION['message']}; // if message comes from anything other than the login post

        if (isset($_SESSION['loggedin'])) {$_SESSION['loggedin']=$_SESSION['loggedin'];} else {$_SESSION['loggedin=']='000';} 

        if (!isset($_SESSION['message'])) { $_SESSION['message']='Please Log into an Account';}

    } else { $_SESSION['loggedin=']='000'; $_SESSION['message']='Please Log into an Account'; }



if (isset($_POST['email'])) {
unset($_POST['email']);
unset($_POST['confirmemail']);
unset($_POST['password']);
unset($_POST['confirmpassword']);
}
    else
    if (isset($_POST['email'])) {
    unset($_POST['email']);
    unset($_POST['confirmemail']);
    unset($_POST['password']);
    unset($_POST['confirmpassword']);
    }
        else
        if (isset($_POST['confirmemail'])) {
        unset($_POST['email']);
        unset($_POST['confirmemail']);
        unset($_POST['password']);
        unset($_POST['confirmpassword']);
        }
            else
            if (isset($_POST['confirmpassword'])) {
            unset($_POST['email']);
            unset($_POST['confirmemail']);
            unset($_POST['password']);
            unset($_POST['confirmpassword']);
            };



if (!isset($_SESSION['loggedin'])) 
{$_SESSION['loggedin']='000'; 
$_SESSION['message'] = 'You are NOT Logged into your account <br> Please Log in';}

我= =而不是=。加上我添加了支票,如果发布。感谢您的回顾。