瀏覽代碼

cookie 本地开发也用安全模式

visuddhinanda 2 年之前
父節點
當前提交
7b75fd81d1
共有 1 個文件被更改,包括 4 次插入1 次删除
  1. 4 1
      public/app/ucenter/index.php

+ 4 - 1
public/app/ucenter/index.php

@@ -164,12 +164,15 @@ if (isset($_POST["op"]) && $_POST["op"] == "new") {
                 $jwt = JWT::encode($payload,$key,'HS512');
                 $jwt = JWT::encode($payload,$key,'HS512');
                 //End of JWT
                 //End of JWT
                 // set cookie
                 // set cookie
+                /*
 				if(empty($_SERVER["HTTPS"])){
 				if(empty($_SERVER["HTTPS"])){
                     //本地开发
                     //本地开发
 					setcookie("user_uid", $user_uuid,["expires"=>$ExpTime,"path"=>"/","secure"=>false,"httponly"=>true]);
 					setcookie("user_uid", $user_uuid,["expires"=>$ExpTime,"path"=>"/","secure"=>false,"httponly"=>true]);
 					setcookie("user_id", $Fetch[0]["id"], ["expires"=>$ExpTime,"path"=>"/","secure"=>false,"httponly"=>true]);
 					setcookie("user_id", $Fetch[0]["id"], ["expires"=>$ExpTime,"path"=>"/","secure"=>false,"httponly"=>true]);
 					setcookie("token", $jwt, ["expires"=>$ExpTime,"path"=>"/","secure"=>false,"httponly"=>true]);
 					setcookie("token", $jwt, ["expires"=>$ExpTime,"path"=>"/","secure"=>false,"httponly"=>true]);
-				}else{
+				}else
+                */
+                {
                     //服务器运行
                     //服务器运行
 					setcookie("user_uid", $user_uuid, ["expires"=>$ExpTime,"path"=>"/","secure"=>true,"httponly"=>true]);
 					setcookie("user_uid", $user_uuid, ["expires"=>$ExpTime,"path"=>"/","secure"=>true,"httponly"=>true]);
 					setcookie("user_id", $Fetch[0]["id"], ["expires"=>$ExpTime,"path"=>"/","secure"=>true,"httponly"=>true]);
 					setcookie("user_id", $Fetch[0]["id"], ["expires"=>$ExpTime,"path"=>"/","secure"=>true,"httponly"=>true]);