
php没有同用户跳转没有同页面:
1、明码校验
这里view层提交过去的用户名以及明码是没有加密的,数据中的明码是通过md5加密的,以是起首对明码进行加密,而后跟数据库中的记载比对,假如分歧则以为胜利。
2、session保留
假如校验胜利则将用户信息保留正在session中。
3、依据没有同权限跳转
有时分咱们关于没有同的用户展现的页面也没有同,这时候就需求咱们依据用户的权限跳转到相应的页面。
4、完成代码
// 登录
public function login()
{
//明码加密并从数据库查找记载
$map['username'] = input('post.a');
$map['password'] = md5(input('post.b'));
$user=db('user')->where($where)->find();
//验证胜利则保留session
if ($user) {
unset($user["psd"]);
session("user", $user['id']);
//依据没有同权限跳转
if($user['quanxian'] == 0){
$this->redirect('Module1/index/index');
}
elseif ($user['quanxian'] == 1) {
$this->redirect('MOdule2/index/index');
}
else{
$this->redirect('Module3/index/index');
}
}else{
print_r ('error!');
return false;
}
}保举:php效劳器
以上就是php没有同用户跳转没有同页面的具体内容,更多请存眷资源魔其它相干文章!
标签: php php教程 跳转 php故障解决 php使用问题
版权声明:除非特别标注,否则均为本站原创文章,转载时请以链接形式注明文章出处。
抱歉,评论功能暂时关闭!