Sandi Budic Sandi Budic - 1 year ago 90
MySQL Question

user and superuser permissions

i just google one hour and i didnt find anything. i wanna try here...
Is possible in php to create something like admin permission on

i have login and users in MySQL.
so my question is... can i put on my "download"
permission to only admin can access it? (only admin can download
table with some information)
sorry for my bad English.enter image description here

Answer Source

STEP-1: When you validate user login successfully, assign some flag like $_SESSION['flag'] = "user";. And do the same for admin like: $_SESSION['flag'] = "admin";

   // login successful, then assign session 
   $_SESSION['flag'] = "admin";   
   // or for normal user
   $_SESSION['flag'] = "user";

STEP-2: Use this session variable to identify is user is admin or normal user and show or hide the download button like:


  if(isset($_SESSION['flag']) && !empty($_SESSION['flag']) && $_SESSION['flag']=="admin"){
       // code here for admin - show download button as you want!
       echo "<button id='btn_download'> Download </button>";
  } // else { // code here for normal user }