<?php
include("connect.php"); 
$tbl_name="user_levels"; // Table name 

$username=$_POST['username']; // username sent from form 
$password=$_POST['password']; // password sent from form 


// To protect MySQL injection 
$username = stripslashes($username);
$password = stripslashes($password);
$username = mysql_real_escape_string($username);
$password = mysql_real_escape_string($password);

//Query
$sql="SELECT * FROM $tbl_name WHERE username='$username' and password='$password'";
$result=mysql_query($sql);
// Mysql_num_row is counting table row
$rows = mysql_fetch_assoc($result);


//Direct pages with different user levels
if ($rows['userlevel'] == '1') {
	header('location: vhr/1myaccount89456.php'); //User1 
	session_register("username");
	session_register("password");
	
}
else
if ($rows['userlevel'] == '2') {
	header('location: vhr/2myaccount453.php'); //User2 
	session_register("username");
	session_register("password"); 
	
} 
else
if ($rows['userlevel'] == '3') {
	header('location: vhr/3myaccount01355.php'); //user 3 
	session_register("username");
	session_register("password"); 

} 
else
if ($rows['userlevel'] == '4') {
	header('location: vhr/4myaccount6831.php'); // user4 
	session_register("username");
	session_register("password");
	
} 
else
if ($rows['userlevel'] == '5') {
	header('location: vhr/5myaccount7684.php'); // user5 
	session_register("username");
	session_register("password");
	
} 
else
if ($rows['userlevel'] == '6') {
	header('location: vhr/6myaccount8945.php'); // user6 
	session_register("username");
	session_register("password"); 
	
} 
else
if ($rows['userlevel'] == '7') {
	header('location: vhr/7myaccount3660.php'); // user7 
	session_register("username");
	session_register("password"); 
	
} 
else
if ($rows['userlevel'] == '8') {
	header('location: vhr/8myaccount7366.php'); // user8 
	session_register("username");
	session_register("password"); 
	
}
else
if ($rows['userlevel'] == '9') {
	header('location: vhr/9myaccount56834.php'); // user9 
	session_register("username");
	session_register("password"); 
	
}
else
if ($rows['userlevel'] == '10') {
	header('location: vhr/10myaccount2867.php'); // user10 
	session_register("username");
	session_register("password"); 
	
}
else
if ($rows['userlevel'] == '11') {
	header('location: vhr/11myaccount98125.php'); // user11 
	session_register("username");
	session_register("password"); 
	
}
else
if ($rows['userlevel'] == '12') {
	header('location: vhr/12myaccount68333.php'); // user12 
	session_register("username");
	session_register("password"); 
	
}
else
if ($rows['userlevel'] == '13') {
	header('location: vhr/13myaccount006783.php'); // user13 
	session_register("username");
	session_register("password"); 
	
}
else
if ($rows['userlevel'] == '14') {
	header('location: vhr/14myaccount5673.php'); // user14 
	session_register("username");
	session_register("password"); 
	
}
else
if ($rows['userlevel'] == '15') {
	header('location: vhr/15myaccount75875.php'); // user15 
	session_register("username");
	session_register("password"); 
	
}
else
if ($rows['userlevel'] == '16') {
	header('location: vhr/16myaccount87446.php'); // user16 
	session_register("username");
	session_register("password"); 
	
}
else
if ($rows['userlevel'] == '17') {
	header('location: vhr/17myaccount78544.php'); // user17 
	session_register("username");
	session_register("password"); 
	
}
else
if ($rows['userlevel'] == '18') {
	header('location: vhr/18myaccount13776.php'); // user18 
	session_register("username");
	session_register("password"); 
	
} 
else
{ 
	// Error login
echo "<script>alert('Access Denied!');
						window.location='index.php';
						</script>";
}

?>