title: PHP website with privileges structure
body: <p>I am creating an Intranet with PHP. There will be different privileges for different users (admin, user etc).
  I plan on using only PHP and a database in MySql with different tables.</p>
  
  <p>I want to know which way is the simplest and "best suited" solution for writing the code of the Intranet, to separate "user" from "admin".</p>
  
  <p>Is it to use one "index.php" and then use an if/else method for displaying content based on privileges? like this:</p>
  
  <pre><code>if ($priv == 'admin')
    display content for admin
  
  else if ($priv == 'user')
    display content for user
  </code></pre>
  
  <p>OR should I have different files for different privileges, for example, use one file to first check the privileges and then open another page based on what privilege it is:</p>
  
  <pre><code>If "admin"
      OPEN index_admin.php
  else if "user"
      OPEN index_user.php
  </code></pre>
  
  <p>Just need some advice on the direction to go here.</p>
  
  <p>The intranet will be fairly simple, with a timereporting/timetracking function for employees of a business to report their times in.</p>
  
  <p>Thanks</p>