php 怎么判断用户登录了

?php这是一个简单的例子if(!isset($_GET[‘logout’])){ session_start();
if(!isset($_SESSION[‘adminname’]) or
($_SESSION[‘adminagent’]!=md5($_SERVER[‘HTTP_澳门新葡亰手机版,USER_AGENT’]))){
header(‘location:/admin/’); exit();
}}else{$_SESSION=array();session_destroy();setcookie(session_name(),”,time()-300,’/’,”,0);header(‘location:index.php’);exit();}?