我不确定我做错了什么。我以前创建了登录系统,但在这种情况下,既没有传递Session变量也没有重定向页面。代码也没有返回任何错误。
if(isset($_POST['login'])){
$get_pass = $_POST['password'];
$get_pass_md5 = md5(md5("kJKLAD&%12!!".$get_pass."DAFKdkdf^9131*@^"));
$get_email = $_POST['email'];
require('connect.php');
$confirm_email_query = $con->query("SELECT * FROM users WHERE email = '$get_email'");
if($confirm_email_query->rowCount() == 1){
$db_user_info = $confirm_email_query->fetch(PDO::FETCH_OBJ);
$db_password = $db_user_info->password;
if($db_password === $get_pass_md5){
$fname = $db_user_info->fname;
$lname = $db_user_info->lname;
$team_id = $db_user_info->team_id;
$user_id = $db_user_info->user_id;
$privilege = $db_user_info->privilege;
session_start();
session_id(md5(md5($team_id.$fname.$lname)));
$_SESSION['team_id'] = $team_id;
$_SESSION['fname'] = $fname;
$_SESSION['lname'] = $lname;
$_SESSION['user_id'] = $user_id;
$_SESSION['privilege'] = $privilege;
header( 'Location: index.php' ) ;
}
else{
echo "Fatal Error: You have entered an incorrect password.";
}
}
else{
echo "Fatal Error: No such user exists.";
}
}
答案 0 :(得分:0)
在第1行设置session_start()代码或包括include()必须是第1行 验证你的编码,如果是utf-8 ansii或其他,如果没有不同编码的任何包含文件