ali ali - 5 months ago 18
SQL Question

access level for php

I have 3 tables

student
,
instructor
, and
admin
, each one of them contains
id, username, password, email
and
access_level
. The
access_level
for the student is
1
, instructor is
2
, and admin is
3
. I want to filter the login to different pages, so each user will direct to different page. I have been looking and searching for answer but unfortunately nothing that help me.

Answer

Try this :

if(valid($username,$password)>0){
    //setcookie
    //setsession
    if(valid($username,$password)==1){
        //redirect to student page
    }
    elseif(valid($username,$password)==2){
//redirect to instructor page
    }
    else{
        //redirect to admin page
    }

}
else{
    //redirect to login
}
Comments