title: Redundancy in PHP? safer or unnecessary
body: <p>I'm using the MVC model (I think thats what its called) and I have separated my site into smaller pages and includes.... Is it safer/better or worse (with no benefit) to check the same conditional twice?</p>
  
  <p>For example, I have an accounts page that looks something like this:</p>
  
  <pre><code>// Must be logged in
  if(isset($_SESSION['userID'])){
  
      include('edit_user.php');
  
  }
  </code></pre>
  
  <p>and then in my <code>edit_user.php</code> page I have something like this:</p>
  
  <pre><code>// Must be logged in
  if(isset($_SESSION['userID'])){
  
      if(isset($_POST['editUser'])){
          //Validate the form
      }
  ?&gt;
  
  &lt;form&gt;
  // Display the form
  &lt;/form&gt;
  
  &lt;?php
  } // End main IF
  </code></pre>
  
  <p>So pretty much I'm checking if the user id is set twice... I'm pretty mush doing the same thing with all my pages (that require users be logged in). Is that really necessary? My initial thought was to prevent unregistered users from accessing the <code>edit_user.php</code> form directly and doing things (I was also thinking of just redirecting if users do access the page directly). What do you guys think/suggest? </p>
  
  <p><b>Edit</b></p>
  
  <p>I dont think I explained myself too clearly... That was just an example... Here's a better example to better get across the reasons for my question:</p>
  
  <p>...Account page</p>
  
  <pre><code>if(isset$_SESSION['userID'])){
  
      include('edit_user.php');// edit user form
  
      include('change_password.php');// change password form
  
      include('change_pic.php');// change photo form
  
  }
  </code></pre>
  
  <p>and from within each of my includes, again I'm asking for a <code>SESSION['userID']</code>... So, what do you guys suggest now?</p>