title: Simple password check using $_SESSION. Cant check SESSION['pass'] using if
body: <p>I cant for the life of me get this to work, I have hacked the code back to the bare minimum, obviously the <code>}else{</code> at the end would contact a simple form which submits through <code>$_POST</code>.</p>
  
  <p>I know this is not best practice to store authentication in a session but this is for stand alone page with a calender so 'top security' is not a priority.</p>
  
  <p>Here is the code</p>
  
  <pre><code>&lt;?php
  ini_set('display_errors', 1);
  session_start();
  
  
  if($_SESSION['passw'] === "word") {
  
  echo 'password checked ok&lt;br&gt;';
  
  }elseif($_POST['password'] === "word"){
  
  $_SESSION['passw'] = "word";
  unset($_POST);
  }else{
  
  $_POST['password'] = "word";
  header('Location: '.$_SERVER['PHP_SELF']);
  
  }
  
  
  ?&gt;
  </code></pre>
  
  <p>Any thoughts much much appreciated:-)</p>