dota220141003
2018-08-16 17:15
浏览 92
已采纳

使用登录脚本进行会话时出错

I'm receiving the error Error In Session when I run my login script:

session_start();
if (isset($_POST['login'])) {
    $logusername=$_POST['username'];
    $logpassword=sha1(md5($_POST['password']));
    $redirectLoginSuccess = "dashboard.php";

    $result=mysqli_query($con, "SELECT * FROM users WHERE username='$logusername' AND password='$logpassword'")or die('Error In Session');
    $row=mysqli_fetch_array($result);

    if($result>0){
        $access  = mysqli_fetch_assoc($result,0,'access');
        $userID = mysqli_fetch_assoc($result,0,'id');
        $username = mysqli_fetch_assoc($result,0,'username');
        $name = mysqli_fetch_assoc($result,0,'name');

        //declare two session variables and assign them
        $_SESSION['username'] = $username;
        $_SESSION['userID'] = $userID;
        $_SESSION['name'] = $name;
        $_SESSION['access'] = $access;
    }

        header("Location: " . $redirectLoginSuccess );
}

I receive this error everytime I run the script not sure exactly where the error is. enter image description here

  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

1条回答 默认 最新

相关推荐 更多相似问题