plz建议我......
我的项目有3个部门。 paginetion,ctp,machine 当用户登录后,登录后会进入各自的部门页面。 但是当我在浏览器上的不同选项卡上打开两个登录时。网页自动更改用户登录。
for ex--如果我登录分页部门。在一个选项卡上,并在浏览器的另一个选项卡上使用ctp dept登录,然后将分页部门的数据加载到ctp部门,并将ctp的用户更改为分页用户。
下面是我的登录代码
<?php
$usermaster = new usermaster;
if(isset($_POST['login']))
{
$city = make_safe($_POST['city']);
$username = make_safe($_POST['username']);
$password = make_safe($_POST['password']);
$result = $usermaster->select($usermaster->table,'',"username='$username' AND password='$password' AND city='$city'",'');
if(count($result))
{
$_SESSION ['Auth']['id'] = $result['id'];
$_SESSION['Auth'] = $result[0];
unset($_SESSION['Auth']['password']);
$_SESSION['city'] = $_REQUEST['city'];
if($_SESSION['Auth']['department'] == 'Pagination')
{
header ("Location: main.php");
exit;
}
else
if($_SESSION['Auth']['department'] == 'CTP')
{
header ("Location: ctp_final.php");
exit;
}
else
if($_SESSION['Auth']['department'] == 'Machine')
{
header ("Location: machine_final.php");
exit;
}
else
if($_SESSION['Auth']['department'] == 'LocalAdmin')
{
header ("Location: city_report.php");
exit;
}
}
else
{
$_SESSION['message1'] = "Wrong user Name or password";
header ("Location: index.php");
exit;
}
}
?>
此代码是每个部门页面上的检查会话
if(!isset($_SESSION['Auth']['id']) || (trim($_SESSION['Auth']['id']) == '')) {
header('Location: index.php');
exit();
}