title: how to maintain session login until logout is clicked
body: <p>At present if i login then click a link tab on my site then return to the login page i need to re-enter details however i do not want this is want it to store the session until logout is clicked</p>
  
  <p>php login script:</p>
  
  <pre><code>&lt;?
  session_start();
  
  $server = "localhost";
  $username = "root";
  $password = "";
  $db_name = "dblogin";
  
  $db = mysql_connect($server,$username,$password) or die("Connection to database failed, perhaps the service is down !!");
  mysql_select_db($db_name) or die("Database name not available !!");
  
  $login = mysql_query("select * from tbuser where (username = '" . $_POST['username'] . "') and (password = '" . md5($_POST['password']) . "')",$db);
  $rowcount = mysql_num_rows($login);
  if ($rowcount == 1) {
  $_SESSION['username'] = $_POST['username'];
  header("Location: securedpage.php");
  }
  else
  {
  header("Location: loginpage.php");
  }
  ?&gt;
  </code></pre>