sql - login with different user level PHP -



sql - login with different user level PHP -

please help. what's problem code. i'm trying create login different user level, when seek login admin or other user, did not direct request page.

here's code

<?php ...//the problem goes here, didn't direct request page if(empty($error)){//if array empty , means no error found $query_check = "select * users (email = '$email' , password= '$password') , activation null"; $result = mysqli_query($db_conn, $query_check); if(!$query_check){ echo "query failed"; } if(@mysqli_num_rows($result)==1){//if match $_session = mysqli_fetch_array($result,mysqli_assoc); //assign result of query session global variable $row = mysqli_fetch_array ($result, mysqli_assoc); if($row['role_type']=='admin'){ header("location:../views/admin/dashboard.php"); exit; } if($row['role_type']=='staff'){ header("location:../views/staff/dashboard.php"); } if($row['role_type']=='patient'){ header("location: ../views/dafault/home.php"); } }else{ $msg_error = "either business relationship inactive or email address /password incorrect"; } }else{ echo '<div class="errormsgbox"> <ol>'; foreach($error $key => $values){ echo ' <li>'.$values.'</li>'; } echo '</ol></div>'; } if(isset($msg_error)){ echo '<div class="warning">'.$msg_error.' </div>'; } mysqli_close($db_conn); }

?>

the header function should contain qualified url not relative file scheme path.

header('location: http://www.example.com/views/admin/dashboard.php');

php sql

Comments

Popular posts from this blog

web services - java.lang.NoClassDefFoundError: Could not initialize class net.sf.cglib.proxy.Enhancer -

Accessing MATLAB's unicode strings from C -

javascript - mongodb won't find my schema method in nested container -