Home  >  Article  >  Backend Development  >  PHP权限登录,该怎么处理

PHP权限登录,该怎么处理

PHPz
PHPzOriginal
2016-06-13 13:38:403388browse

PHP权限登录

用 户  名(user):_____

密      码(password):_____

选择身份(user_id):_____     13812fddd96f98d7397a53210cb6efb8

没有使用过SESSION,不知道该怎么写····

------解决方案--------------------

简单的很! 在代码最开头session_start(),初始化SESSION。后面就可以直接给$_SESSION超级全局变量赋值,或者读取。

http://www.w3school.com.cn/php/php_sessions.asp

------解决方案--------------------

最好是写个函数。

权限是个大问题。不是是说跳转就能解决了。

------解决方案--------------------

session_start();
if(@$_POST["login"])
{
echo "";
}

在if里嵌套你自己的条件跳转到你想去的页面

先做用户身份验证

根据用户身份取得权限字,保存于 session 中

所有需要身份验证的页面都要在进入时验证身份(通过权限字)

session没有限制你保存什么,但是出于编写的快捷,资源的占用等考虑,一般都使用数字来存储。

在ini里设置auto session也可以。

以上就是对PHP权限登录,该怎么处理的全部介绍,如果您想了解更多有关php编程入门,请关注PHP中文网。





Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn