Restrict user accessing database SQL server || SQL database admin privilege PHP code

 we can restrict some user or group of user to accessing database.


let we have in table directory phpMyadmin 3 types of user

login_user_type

1 -  Admin 

2-  Admin and Colleague or main user with special privilege

3- Normal user with limited access


Restrict and redirect the user to certain page limited privilege accessing SQL database



Only Admin privilege :



SQL admin special privilege PHP code




<?php if($_SESSION['login_user_type']== 1)  ; else{header("location:login.php"); } ?>




 Admin and main user privilege :



SQL database restrict access no privilege for normal user



<?php if($_SESSION['login_user_type'] == 1 or $_SESSION['login_user_type'] == 2); else{header("location:login.php"); } ?>



Normal user access :

From above two option now you can control the normal user for using the SQL database.
Previous Post Next Post