COOKIE SESSION

来源:互联网 发布:80端口怎么看 编辑:程序博客网 时间:2024/05/15 01:47
<? 
 session_start();
 if(!isset($_SESSION['admin'])){
  //验证是否设置了cookie
  if(isset($_COOKIE['admin_id'])){
   $sql="select * from where user_id=1";
   include 'includes/db.class.php';
   $db=new db('localhost','ecshop_test','root','');
   $row=$db->getRow($sql);
   $password=$row['password'];
   if($password!=$_COOKIE['admin_pass']){
    header ('Location:privilege.php');
   }
  }else{
   header('Location:privilege.php');
  }
 }
 ?>
原创粉丝点击