title: Keep session name during automatic refresh, but not forever
body: <p>I know this has been discussed a lot, but I can't seem to find a solution to my problem:</p>
  
  <p>I have a password that is passed to new php file with a form as follows:</p>
  
  <pre><code>&lt;form method="POST" action="test.php"&gt;
  Password: &lt;input type="password" name="password" size="15" /&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>On the test.php file I create a session, then get the password with POST as follows:</p>
  
  <pre><code>session_name('first'); 
  session_start('first');
  
  if (isset($_SESSION['pass_s'])) 
  {
     $_SESSION['pass_s'] = $_SESSION['pass_s'];
  } else 
  {
     $_SESSION['pass_s'] = $_POST['password'];
  }  
  $pass = $_SESSION['pass_s'];
  </code></pre>
  
  <p>But I also refresh this page with the following:</p>
  
  <pre><code> $page = "test.php";
   $sec = 60;
   header("Refresh: $sec; url=$page");
  </code></pre>
  
  <p>The problem is, that the session stays set no matter what, so on new login the old session is started. I am stuck between naming my sessions and refreshing my page. 
  I can't destroy sessions because of the refresh, but I also can't keep the session. I believe i is kept in the cookies.</p>
  
  <p>I basically need to destroy a session on exit of page, but not while the refresh is running on the page?</p>