I'm doing on this project and I find it hard to find the right answer to my question. I've googled for answers but none of them worked, I also tried to alter the codes but still it's not working properly. This is how I plan my project. A user/admin will log in one log-in form then it will redirect whether the input is for admin or normal user.
I've created a table named users, a table named info. In the info table, there is username(varchar), password(varchar) and admin_level(int).
Here's my html and php script:
<form method='post' action='login.php'>
<div id='userLogIn'>User LogIn</div>
Username <input type=text name=username> </br>
Password <input type=password name=password></br>
    <input type=submit name=submit value='Log in'>
</div>
<?php
if(isset($_POST['submit']))
{
    $a = $_POST['username'];
    $b = $_POST['password'];
    include("dbconnect.php");
    $sql = "SELECT * FROM info 
                     WHERE username 
                     LIKE '$a' AND password LIKE '$b' 
                     AND admin_level LIKE 1";
    $result=mysql_query($sql);
    $count = mysql_num_rows($result);
    $rows=mysql_fetch_array($result);
    if ($count == 1) {
    if ($rows['admin_level'] == 1) {
        header ("Location:adminPage.php");
    }
    else  {
        header ("Location:userPage.php");
        }
    }
    else {
        print "<font color=red>Username/Password Combination Error</font>";
    }
}
 
     
     
     
     
     
    