# Administration roles

**URL:** <https://forum.kirupa.com/t/administration-roles/330810>\
**Category:** programming\
**Created:** [March 19, 2013, 8:25pm UTC](https://forum.kirupa.com/t/administration-roles/330810 "2013-03-19T20:25:39Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![mattm35](https://avatars.discourse-cdn.com/v4/letter/m/a88e4f/32.png) [@mattm35](https://forum.kirupa.com/u/mattm35)\
**Post date:** [March 19, 2013, 8:25pm UTC](https://forum.kirupa.com/t/administration-roles/330810/1 "2013-03-19T20:25:39Z")

</div>

Hi, I am doing a school project in which I have to different pages load after login based on whether the user is a regular employee or administrator. I want their to be a default control panel, and then add a header based on if its an employee or admin. The following code I have isn’t working, I was wondering if somebody could help me out as to why?

```php

<?php
ob_start();
DATABASE CONNECTING CODE
mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB");

$username=$_POST['username'];
 $password=$_POST['password']; 
$username = stripslashes($username);
$password = stripslashes($password);
$username = mysql_real_escape_string($username);
$password = mysql_real_escape_string($password);

$is_admin = false;

$sql="SELECT * FROM employee WHERE username='$username' and pass='$password'";
$result=mysql_query($sql);$count=mysql_num_rows($result);

$sql = "SELECT is_admin FROM employee WHERE username = $username LIMIT 1";
$query = mysql_query( $sql );
$data = mysql_fetch_array( $query );

if ( $data['is_admin'] == 1 ) {
$is_admin = true;
}

if ($count==1) {
session_register("username");   
session_register("password");    
 header("location:control_panel.php"); } 

elseif ( $is_admin == true ) {    
include_once('header_admin.php'); } 

elseif ( $is_admin == false ) {    
include_once('header_employee.php');} 

else  
echo "Wrong Username or Password";    

ob_end_flush();
?>

```
