我每次访问索引页时都会在我的代码中出现此错误,当我尝试登录时,它会转到主页但是一切都是空的,就好像会话没有注册电子邮件地址一样。这是我的代码:
的index.php
<?php
session_start();
include("includes/config.php");
if(isset($_POST['login'])){
$email = mysqli_real_escape_string($connection,$_POST['email']);
$pass = mysqli_real_escape_string($connection,$_POST['pass']);
$pass = md5($pass);
$get_user = "SELECT * FROM members WHERE user_email='$email' AND user_pass='$pass'";
$run_user = mysqli_query($connection,$get_user);
$check = mysqli_num_rows($run_user);
if($check==1){
$_SESSION['user_email']=$email;
$rows_check = mysqli_fetch_array($run_user);
$activate = $rows_check['activate'];
if($activate == 0){
echo "<script>window.open('lock_out.php','_self')</script>";
}
if($activate == 1){
echo "<script>window.open('home.php','_self')</script>";
$stat = 1;
$update = "UPDATE members SET online='$stat' WHERE user_email='$email'";
$run_update = mysqli_query($connection,$update);
}
} else {
echo "<script>alert('Password or email is not correct!')</script>";
echo "<script>window.open('index.php','_self')</script>";
}
}
?>
home.php
<?php
session_start();
include("includes/config.php");
include("includes/functions.php");
if(!isset($_SESSION['user_email'])){
header("Location: index.php");
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1.0" />
<meta name="keywords" content="date, dating, chat, friends, meet friends, online chat, meet people, frum, chatroom, articles" />
<meta name="description" content="meet new people from arount the world and engage in exciting chat. chat in forums and chatrooms and play free games" />
<title>My home page</title>
<link type="text/css" rel="stylesheet" href="css/home_styles.css" media="all"/>
</head>
<body>
<h3>WELCOME USER</h3>
</body
</html>