检查用户权限的权限

I add values to user_privilege column by implode consist of permission of user that is ( 7gz,agt_courses,newbill,new_Trainee)=> each of them in real to open (say :newbill page) or not upon user permission in user_privilege column in "login" table in database in other words I want to check the user login his permission if it has say newbill permission he can open newbill page if not he can't open this page .

login table in database like this:

**username       username2          user_privilege**

amal             amal         7gz,agt_courses,newbill

ahmed           ahmed         dataDisplay,previllige,newUsers



$username = $_POST['username'];
$username2 = $_POST['username2'];

if($username && $username2)
{
    $finduser = mysqli_query($link,"SELECT * FROM LOGIN 
    WHERE username='".$username."' AND username2='".$username2."' AND FIND_IN_SET('Customers', user_previllige)") or die("error");

    if(mysqli_num_rows($finduser) !=0)
        {

            while($row = mysqli_fetch_array($finduser))
                {$uname = $row['username'];
                $uname2 = $row['username2'];}
        }

        if($username == $uname && $username2 == $uname2 )
            {$_SESSION['sessionname'] =$uname;
            $_SESSION['sessionname2'] =$uname2;
            header ("location:../customers/cutomer.php");}
                else echo '<script>function
{alert(you have not permission to open this page)}</script>';

    }

any body assist me ?

function check($sPermission, $sColumnValue)
{
    $aPerm = explode(',', $sColumnValue);

    return (!empty($aPerm) && in_array($sPermission, $aPerm));
}

I hope you know how to select data from db, so call will looks like this:

check('newbill', '7gz,agt_courses,newbill');