[英]session problem in php between two panels
hy I have created two panels first is members panel and second is admin panel. Hy我创建了两个面板,第一个是成员面板,第二个是管理面板。 In these two panels, I have created a session file in those panels. 在这两个面板中,我在这些面板中创建了一个会话文件。
but when I logged in into members panel and without log out from this panel, I go to admin panel it does not ask any username or password it's taken me to direct index page. 但是当我登录到会员面板而没有从此面板退出时,我转到管理面板,它不会询问任何用户名或密码,而是将我带到索引页面。
members panel : 成员小组:
<?php
include('db.php');
session_start();
$user_check = $_SESSION['login_user'];
$ses_sql = mysqli_query($conn,"select email from outlet where email = '$user_check' ");
$row = mysqli_fetch_array($ses_sql,MYSQLI_ASSOC);
$login_session = $row['email'];
if(!isset($_SESSION['login_user'])){
header("location:login.php");
}
?>
Admin Panel : 管理面板 :
<?php
include('db.php');
session_start();
$user_check = $_SESSION['login_user'];
$ses_sql = mysqli_query($conn,"select email from admin where email = '$user_check' ");
$row = mysqli_fetch_array($ses_sql,MYSQLI_ASSOC);
$login_session = $row['email'];
if(!isset($_SESSION['login_user'])){
header("location:login.php");
}
?>
You need to store admin or member flag in a session. 您需要在会话中存储管理员或成员标志。 And them apply condition on it 他们适用条件
if($_SESSION['user_type'] == 'admin') {
header('location:admin.php');
} else {
header('location:member.php');
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.