title: how to destroy Session after some minutes
body: <p>hi guys how can i destroy session after some minutes (example 30min), i would really appriciate if someone can help me through out of this,</p>
  
  <p>here is my code im using for login :</p>
  
  <p>checkLogin :</p>
  
  <pre><code> &lt;?php
  // checkLogin.php
  
  session_start(); // Start a new session
  require('db.php'); // Holds all of our database connection information
  
  // Get the data passed from the form
  $username = $_POST['user'];
  $password = $_POST['pass'];
  
  // Do some basic sanitizing
  $static_salt='asdfasdfqwertyuiop123ABC_some_static_salt_string';
  $username = stripslashes($username);
  $password = stripslashes($password);
  $password=hash('sha512', $password . $static_salt . $username);
  
  
  $sql = "select * from users where user = '$username' and pass = '$password'";
  $result = mysql_query($sql) or die ( mysql_error() );
  
  $count = 0;
  
  while ($line = mysql_fetch_assoc($result)) {
       $count++;
  }
  
  if ($count == 1) {
       $_SESSION['loggedIn'] = "true";
       header("Location: index.php"); // This is wherever you want to redirect the user to
  } else {
       $_SESSION['loggedIn'] = "false";
       header("Location: deshtoi.php"); // Wherever you want the user to go when they fail the login
  }
  
  ?&gt;
  </code></pre>
  
  <p>Login.php </p>
  
  <pre><code> &lt;div class="login-form"&gt;
  &lt;form action="checkLogin.php" method="post"&gt;
  &lt;input class="fusha" placeholder="Llogaria" type="text" name="user"&gt;
  &lt;input class="fusha" placeholder="Fjalekalimi" type="password" name="pass"&gt;
  &lt;input class="fusha" style="width:272px;" type="submit" value="Kycu"/&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>index.php </p>
  
  <pre><code>&lt;?php session_start();
  if ($_SESSION['loggedIn'] != "true") {
       print('&lt;script&gt;window.location = "login.php"&lt;/script&gt;');
  }
  ?&gt;
  </code></pre>