<tfoot id='R0VMc'></tfoot>

      <bdo id='R0VMc'></bdo><ul id='R0VMc'></ul>
    <legend id='R0VMc'><style id='R0VMc'><dir id='R0VMc'><q id='R0VMc'></q></dir></style></legend>
    <i id='R0VMc'><tr id='R0VMc'><dt id='R0VMc'><q id='R0VMc'><span id='R0VMc'><b id='R0VMc'><form id='R0VMc'><ins id='R0VMc'></ins><ul id='R0VMc'></ul><sub id='R0VMc'></sub></form><legend id='R0VMc'></legend><bdo id='R0VMc'><pre id='R0VMc'><center id='R0VMc'></center></pre></bdo></b><th id='R0VMc'></th></span></q></dt></tr></i><div id='R0VMc'><tfoot id='R0VMc'></tfoot><dl id='R0VMc'><fieldset id='R0VMc'></fieldset></dl></div>

    <small id='R0VMc'></small><noframes id='R0VMc'>

        登录后我的 php 会话一直丢失

        时间:2024-04-12
        <legend id='K36Iq'><style id='K36Iq'><dir id='K36Iq'><q id='K36Iq'></q></dir></style></legend>
            • <bdo id='K36Iq'></bdo><ul id='K36Iq'></ul>

                  <tfoot id='K36Iq'></tfoot>

                1. <small id='K36Iq'></small><noframes id='K36Iq'>

                  <i id='K36Iq'><tr id='K36Iq'><dt id='K36Iq'><q id='K36Iq'><span id='K36Iq'><b id='K36Iq'><form id='K36Iq'><ins id='K36Iq'></ins><ul id='K36Iq'></ul><sub id='K36Iq'></sub></form><legend id='K36Iq'></legend><bdo id='K36Iq'><pre id='K36Iq'><center id='K36Iq'></center></pre></bdo></b><th id='K36Iq'></th></span></q></dt></tr></i><div id='K36Iq'><tfoot id='K36Iq'></tfoot><dl id='K36Iq'><fieldset id='K36Iq'></fieldset></dl></div>
                    <tbody id='K36Iq'></tbody>
                2. 本文介绍了登录后我的 php 会话一直丢失的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我已经阅读了很多关于 php 安全最佳实践的内容,并且我正在努力在我的 xampp 服务器上使用它们.

                  I have read alot about the php security best practices on so, and I am trying hard to employ those on my xampp server.

                  我有一个包含我所有的安全、ddos、会话管理的包含,其中有一个名为 sec_session_start 的函数.代码如下,但是当我尝试登录,然后重定向回我的主页时,所有会话数据都消失了.在我的登录过程页面上,在我进行重定向之前,它具有所有正确的会话数据.

                  I have an include that does all my security, ddos, session management, and in there is a function called sec_session_start. The code is below, but when i try to login, and then redirect back to my home page, all the session data is gone. On my login process page, before I do a redirect, it has all the correct session data.

                  在每个标题之后,我正在执行退出;".我也试过写 session_write_close();

                  After each header, i am doing "exit;". I have also tried writing session_write_close();

                  但这似乎不能解决我的问题.

                  But that doesnt' seem to solve my problems.

                  这里是功能代码.

                  function sec_session_start() {
                  $session_name = 'AnyName'; // Set a custom session name
                  $secure = false; // Set to true if using https.
                  $httponly = true; // This stops javascript being able to access the session id. 
                  
                  ini_set('session.use_only_cookies', 1); // Forces sessions to only use cookies. 
                  $cookieParams = session_get_cookie_params(); // Gets current cookies params.
                  session_set_cookie_params($cookieParams["lifetime"], $cookieParams["path"], $cookieParams["domain"], $secure, $httponly); 
                  session_name($session_name); // Sets the session name to the one set above.
                  session_start(); // Start the php session
                  session_regenerate_id(true); // regenerated the session, delete the old one.  
                  }
                  

                  每个页面都会调用这个函数.

                  This function is called on every page.

                  有什么建议吗?

                  推荐答案

                  删除session_regenerate_id(true);

                  Drop the session_regenerate_id(true);

                  这是不必要的,不会覆盖以前的 cookie,但真"是真正的问题,因为它会清除以前的会话详细信息.

                  This is uncessary and won't overwrite previous cookies, but the "true" is the real problem as that cleans out the previous session details.

                  这篇关于登录后我的 php 会话一直丢失的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:XAMPP 服务器不加载 CSS 文件 下一篇:GMail fsockopen():使用 Codeigniter 和 XAMPP 的 SSL 操作失败错误

                  相关文章

                3. <small id='8Oh89'></small><noframes id='8Oh89'>

                  <legend id='8Oh89'><style id='8Oh89'><dir id='8Oh89'><q id='8Oh89'></q></dir></style></legend>
                  • <bdo id='8Oh89'></bdo><ul id='8Oh89'></ul>
                  <i id='8Oh89'><tr id='8Oh89'><dt id='8Oh89'><q id='8Oh89'><span id='8Oh89'><b id='8Oh89'><form id='8Oh89'><ins id='8Oh89'></ins><ul id='8Oh89'></ul><sub id='8Oh89'></sub></form><legend id='8Oh89'></legend><bdo id='8Oh89'><pre id='8Oh89'><center id='8Oh89'></center></pre></bdo></b><th id='8Oh89'></th></span></q></dt></tr></i><div id='8Oh89'><tfoot id='8Oh89'></tfoot><dl id='8Oh89'><fieldset id='8Oh89'></fieldset></dl></div>

                    1. <tfoot id='8Oh89'></tfoot>