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

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


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

$username = mysql_real_escape_string($username);


//Query
$sql="SELECT * FROM $tbl_name WHERE username='$username'";
$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: 1myaccount89456.php'); //User1 
	session_register("username");
	session_register("password");
	
}
else
if ($rows['userlevel'] == '2') {
	header('location: 2myaccount453.php'); //User2 
	session_register("username");
	session_register("password"); 
	
} 
else
if ($rows['userlevel'] == '3') {
	header('location: 3myaccount01355.php'); //user 3 
	session_register("username");
	session_register("password"); 

} 
else
if ($rows['userlevel'] == '4') {
	header('location: 4myaccount683.php'); // user4 
	session_register("username");
	session_register("password");
	
} 
else
if ($rows['userlevel'] == '5') {
	header('location: 5myaccount7684.php'); // user5 
	session_register("username");
	session_register("password");
	
} 
else
if ($rows['userlevel'] == '6') {
	header('location: 6myaccount8945.php'); // user6 
	session_register("username");
	session_register("password"); 
	
} 
else
if ($rows['userlevel'] == '7') {
	header('location: 7myaccount3660.php'); // user7 
	session_register("username");
	session_register("password"); 
	
} 
else
if ($rows['userlevel'] == '8') {
	header('location: 8myaccount7366.php'); // user8 
	session_register("username");
	session_register("password"); 
	
} 
else
if ($rows['userlevel'] == '9') {
	header('location: 9myaccount1486.php'); // user9 
	session_register("username");
	session_register("password"); 
	
} 
else
if ($rows['userlevel'] == '10') {
	header('location: 10myaccount2974.php'); // user9 
	session_register("username");
	session_register("password"); 
	
}

else
if ($rows['userlevel'] == '11') {
	header('location: 11myaccount4167.php'); // user9 
	session_register("username");
	session_register("password"); 
	
}

else
if ($rows['userlevel'] == '12') {
	header('location: 12myaccount5473.php'); // user9 
	session_register("username");
	session_register("password"); 
	
} 

else
if ($rows['userlevel'] == '13') {
	header('location: 13myaccount7690.php'); // user9 
	session_register("username");
	session_register("password"); 
	
}

else
if ($rows['userlevel'] == '14') {
	header('location: 14myaccount99876.php'); // user9 
	session_register("username");
	session_register("password"); 
	
}

else
if ($rows['userlevel'] == '15') {
	header('location: 15myaccount7764.php'); // user9 
	session_register("username");
	session_register("password"); 
	
}

else
if ($rows['userlevel'] == '16') {
	header('location: 16myaccount7935.php'); // user9 
	session_register("username");
	session_register("password"); 
	
}

else
if ($rows['userlevel'] == '17') {
	header('location: 17myaccount7024.php'); // user9 
	session_register("username");
	session_register("password"); 
	
}

else
if ($rows['userlevel'] == '18') {
	header('location: 18myaccount7864.php'); // user9 
	session_register("username");
	session_register("password"); 
	
}

else
if ($rows['userlevel'] == '19') {
	header('location: 19myaccount2398.php'); // user9 
	session_register("username");
	session_register("password"); 
	
}

else
if ($rows['userlevel'] == '20') {
	header('location: 20myaccount5786.php'); // user9 
	session_register("username");
	session_register("password"); 
	
}
else
{ 


	// Error login
echo "<script>alert('Access Denied!');
						window.location='index.php';
						</script>";
}

?>