Why is it always shown not logged in??

Source: Internet
Author: User
Here are two pages one is login page after login to jump to blog.php page This page contains the following cookie page why did you jump to blog.php after showing no login? It's supposed to be logged in.


  
   prepare("select id,username,password from user where username=? and password=?");      $stmt->execute(array($_POST['username'],($_POST['password'])));      if($stmt->rowCount()>0){      list($id,$username)=$stmt->fetch(PDO::FETCH_NUM);      $time=time()*24*60*60;      setCookie("uid",$id,$time,"/");      setCookie("username",$username,$time,"/");      setCookie("isLogin",1,$time,"/");      echo '';      }      else{          echo "登陆失败";      } } ?>        下面是cookie页面
  
   

Reply content:

Here are two pages one is login page after login to jump to blog.php page This page contains the following cookie page why did you jump to blog.php after showing no login? It's supposed to be logged in.


  
   prepare("select id,username,password from user where username=? and password=?");      $stmt->execute(array($_POST['username'],($_POST['password'])));      if($stmt->rowCount()>0){      list($id,$username)=$stmt->fetch(PDO::FETCH_NUM);      $time=time()*24*60*60;      setCookie("uid",$id,$time,"/");      setCookie("username",$username,$time,"/");      setCookie("isLogin",1,$time,"/");      echo '';      }      else{          echo "登陆失败";      } } ?>        下面是cookie页面
  
   

$time=time()*24*60*60  改为   $time=time() +24*60*60

The cookie is not good when the user closes the browser cache function, it is recommended to use session

It is possible that you closed the cookie cache of the browser

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.