I am yet to do a stunning code with php. Can anyone help me to make an administrator account using php havin rights to create as many users and also have the right to edit te pages....Moderators: macek, egami, gesf
I am yet to do a stunning code with php. Can anyone help me to make an administrator account using php havin rights to create as many users and also have the right to edit te pages....

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.
}


Return to PHP & MySQL Security
Users browsing this forum: No registered users and 2 guests