duanfa2014 2012-05-09 18:56
浏览 30
已采纳

如何在两个面板中避免“会话中断”

i am a student and i am new in php

i am working on my project

i have two panels in my website (localhost) one is user other is admin

in both panels i hace created sessions on all pages

on user panel:

session_start();
if(!isset($_SESSION['user']))
   header("Location: index.php");

on admin panel:

session_start();
if(!isset($_SESSION['username']))
{
   header("Location: login.php?e=please+login+first");
}

now i have opened both panels and problem is that if i logout from one panel then other panels also logout .

forexample if i logout in user panel as a user then my admin panel session automatically redirect page to login.php when i refresh admin page

is there any way to avoid this or how to avoid this.. please help me. i shall be thankful

here is my logout code

for admin side

<?php
session_start(); 
session_destroy();
header("Location: login.php?e=Logout+successfully");
?>

for user side
<?php
session_start();
session_destroy();
header("Location: index.php?l=Logout+successfully");
}
?>
  • 写回答

3条回答 默认 最新

  • dongrao9436 2012-05-09 18:58
    关注

    Do not destroy the session, but only unset the corresponding key

    unset($_SESSION['user'])

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥15 Oracle中如何从clob类型截取特定字符串后面的字符
  • ¥15 想通过pywinauto自动电机应用程序按钮,但是找不到应用程序按钮信息
  • ¥15 MATLAB中streamslice问题
  • ¥15 如何在炒股软件中,爬到我想看的日k线
  • ¥15 seatunnel 怎么配置Elasticsearch
  • ¥15 PSCAD安装问题 ERROR: Visual Studio 2013, 2015, 2017 or 2019 is not found in the system.
  • ¥15 (标签-MATLAB|关键词-多址)
  • ¥15 关于#MATLAB#的问题,如何解决?(相关搜索:信噪比,系统容量)
  • ¥500 52810做蓝牙接受端
  • ¥15 基于PLC的三轴机械手程序