title: Complex If statement not triggering [PHP]
body: <p>I'm trying to make  redirect if the user is not signed in. 
  so it should read like this:</p>
  
  <p>If FName is unset and $page does not equal 'new host' or 'login'
  then set header to login and set error message.</p>
  
  <p>All the parts work on their own, but not when I try to assemble them.</p>
  
  <p><strong>Edit, I have it working with a switch now but I'm still intrigued on why this <em>if</em> didn't work.</strong></p>
  
  <p>The || means true if either condition is true.</p>
  
  <p>The and checks to see if the leading and following conditions are true.</p>
  
  <p>Should I be using &amp;&amp; or does that make a difference?</p>
  
  <p>Here is my code:  </p>
  
  <pre><code>if ( !isset($_SESSION['FName']) and 
  ( $page == '/e-Party/Login/Login.php' ||  $page == '/e-Party/NewHost/NewHost.php')){
  
  echo "not logged in";
  
  $_SESSION['Error'] =
   "you must login to use our site,&lt;br&gt;. Or create a account if you don't have one"; 
    header( 'Location: /e-Party/Login/Login.php' );
    exit();
   } 
  </code></pre>
  
  <p>Edit,  here is my working switch. </p>
  
  <pre><code>if ( !isset($_SESSION['FName']))
  switch ($page) {
     case '/e-Party/NewHost/NewHost.php':    
     break;
  
     case '/e-Party/Login/Login.php':    
     break;  
  
     default:
     $_SESSION['Error'] =
     "you must login to use our site,&lt;br&gt;. Or creat a account if you dont   have one"; 
     header('Location: /e-Party/Login/Login.php');
     exit();
  }
  </code></pre>
  
  <p>A comment helps much more than a down vote, thank you for reading.</p>