What is the potential issue with allowing multiple users to log in with the same credentials in a PHP CMS?

Allowing multiple users to log in with the same credentials in a PHP CMS can lead to security vulnerabilities and potential misuse of user accounts. To solve this issue, you should enforce unique credentials for each user to ensure proper authentication and authorization.

// Check if the username is already in use before allowing a new user to register
$username = $_POST['username'];
$query = "SELECT * FROM users WHERE username = '$username'";
$result = mysqli_query($conn, $query);

if(mysqli_num_rows($result) > 0) {
    // Username already exists, display an error message
    echo "Username already in use. Please choose a different username.";
} else {
    // Proceed with user registration
}