Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
public function hasright($username, $checkright) {
global $tsSQL;
if(isCheckuser($username) && $checkright == "Admin") {
return true;
}
$username = $tsSQL->escape($username);
$query = "SELECT * FROM acc_user WHERE user_name = '$username';";
$result = $tsSQL->query($query);
if (!$result) {
$tsSQL->showError("Query failed: $query ERROR: " . mysql_error(),"Database query error.");
}
$row = mysql_fetch_assoc($result);
$rights = explode(':', $row['user_level']);
foreach( $rights as $right) {
if($right == $checkright ) {
return true;
}
}
return false;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment