Home >Backend Development >PHP Tutorial >php登陆权限验证有关问题

php登陆权限验证有关问题

WBOY
WBOYOriginal
2016-06-13 11:14:311289browse

php登陆权限验证问题

本帖最后由 yangyi1234567 于 2013-02-02 20:53:42 编辑
<br /><?php<br />	include('config.php');<br />		$sql="select * from admin where name ='$_SESSION[ui]'";<br />		$query=mysql_query("$sql");<br />		$row=mysql_fetch_array($query);<br />		$uus= is_array($row);<br />		$pps= $uus ? $_SESSION['shell']==$row['password'] : FALSE;<br />		if($pps){<br />		<br />			echo $_SESSION['ui'];<br />		<br />		}else{<br />			echo "无权限访问";<br />			exit();<br />		}<br />?><br />

在没有session的时候,打开改页面,会出现下面这些错误提示,请问各位大侠,是什么原因造成的
Notice: Undefined index: ui in C:\xampp\htdocs\sousuo\check\check.php on line 14
无权限访问

------解决方案--------------------
没有定义却要输出 所以就有了提示

if(isset($_SESSION['ui']))
echo $_SESSION['ui'];
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