title: How to make sure user type="admin" can only access a certain webpage? php mysql
body: <p>How do I make sure that only users with type="admin" can access for example admin.php</p>
  
  <p>for example. I am logged out. but i can still access the admin.php, how to I make sure i can only access the page when i am logged in as an admin?</p>
  
  <pre><code>if($count==1){
  
  // Register $myusername, $mypassword and redirect to file "login_success.php"
  
  
      while($row = mysql_fetch_array($result)){
          //remove this line ******header("location:customer_home.php");
          if($row['type'] == 'admin'){
              header("location: admin.php");
          } else if($row['type'] == 'customer'){
              header("location: customer_home.php");
          }
      }
  }
  </code></pre>
  
  <p>Thank you so much.</p>