title: regenerating session id
body: <p>I am thinking of using this code on every page to reduce the possibility of session hijacking. By renewing the session_id on every request</p>
  
  <pre><code>if(!empty($_session)){ 
     session_start(); 
  }
  </code></pre>
  
  <p>Another way to achieve so would be to do this:</p>
  
  <pre><code>if(!empty($_session)){ 
    session_regenerate_id(true);
  }
  </code></pre>
  
  <p>However, I heard criticisms of that function that say that if the page is refreshed too fast for some reason, the session id becomes invalid.</p>
  
  <p>Another way to use the session id is to have more control over how a session is generated.</p>
  
  <p>There are other ways to achieve so.. Whats the best practice?</p>