What could be causing the issue of not being able to delete blocked usernames in a PHP forum running on phpBB 2.0.22?
The issue of not being able to delete blocked usernames in a PHP forum running on phpBB 2.0.22 could be caused by the user deletion function not checking for blocked status before attempting to delete the user. To solve this issue, you can modify the user deletion function to include a check for blocked status before proceeding with the deletion.
// Check if user is blocked before deleting
function delete_user($user_id) {
global $db;
$sql = "SELECT user_id, user_type FROM " . USERS_TABLE . " WHERE user_id = $user_id AND user_type != " . USER_IGNORE;
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
if ($row) {
// Delete user if not blocked
$sql = "DELETE FROM " . USERS_TABLE . " WHERE user_id = $user_id";
$db->sql_query($sql);
return true;
} else {
return false;
}
}
Related questions
-
LIKE operator SQL query username validation
-
hidden fields data retention security vulnerability
-
echo statements performance output buffering