A
Anonymous
Guest
Hello vineeth,
I recommend you have a column in your table of users that says "Admin" make it an INT and make it DEFAULT of 0.
Then make a function with a query inside of it that checks to see if the column of Admin is 1 or not, if it is, then return true...
Something like this.
Hope this helped
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
14 Year Old Programmer & Graphic Artist, Confident and Courageous
I recommend you have a column in your table of users that says "Admin" make it an INT and make it DEFAULT of 0.
Then make a function with a query inside of it that checks to see if the column of Admin is 1 or not, if it is, then return true...
Something like this.
Code:
function userisadmin() {
$idname = $_SESSION['user_id']; // your session name to determain the id of the user that is logged in
$query = "SELECT Admin FROM users WHERE id ='$idname'";
if ($query_run = mysql_query($query)) {
if($query_result = mysql_result($query_run, 0, $field)) {
if ($query_result == '1') {
return true;
}else{
return false;
}
}
}
}
// then on any page you could put
if (userisadmin()) {
//if they're an admin...
}else{
if they are not.
}
Hope this helped
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
14 Year Old Programmer & Graphic Artist, Confident and Courageous