<? /* 在字段中做一个权限等级字段,在用户登陆成功后,加入到session中,如 $_SESSION["popedom"]*/ session_start(); switch($_SESSION["popedom"]){ case 1: header("location: topage1.php"); break; case 2: header("location: topage2.php"); break; case 3: header("location: topage3.php"); break; default: header("location: topage.php"); break; } ?>
用session存 权限值 判断一下 就可以了 kingerq(多菜鸟) 代码都写出了
kingerq(多菜鸟)的方法和我一摸一样
我的实现方式是:数据库专门存储一个权限等级的字段(qx),当核对用户帐号和密码的同时读取权限然后登陆不同的页面用session来防止非法登陆或者跨权限登陆。主要代码如下: select user from menber where user='$_POST[username] select qx from menber where user='$_POST[username]' and password=password('$_POST[password]')" $_SESSION['manager'] = $_POST[username] $_SESSION['rank'] = $_POST['qx']; header("location:manage.php"); exit(); } else { header("location:error.php");
在字段中做一个权限等级字段,在用户登陆成功后,加入到session中. <? session_start(); switch($_SESSION["aaa"]){ case 1: header("location: bbb.php"); break; case 2: header("location: ccc.php"); break; case 3: header("location: ddd.php"); break; default: header("location: eee.php"); break; } ?>
/* 在字段中做一个权限等级字段,在用户登陆成功后,加入到session中,如 $_SESSION["popedom"]*/
session_start();
switch($_SESSION["popedom"]){
case 1:
header("location: topage1.php");
break;
case 2:
header("location: topage2.php");
break;
case 3:
header("location: topage3.php");
break;
default:
header("location: topage.php");
break;
}
?>
判断一下 就可以了
kingerq(多菜鸟) 代码都写出了
select user from menber where user='$_POST[username]
select qx from menber where user='$_POST[username]' and password=password('$_POST[password]')"
$_SESSION['manager'] = $_POST[username]
$_SESSION['rank'] = $_POST['qx'];
header("location:manage.php");
exit();
}
else
{
header("location:error.php");
<?
session_start();
switch($_SESSION["aaa"]){
case 1:
header("location: bbb.php");
break;
case 2:
header("location: ccc.php");
break;
case 3:
header("location: ddd.php");
break;
default:
header("location: eee.php");
break;
}
?>