Delete SQL Server 2008 R2 server logins mapped to offline databases
Here is a script to identify orphaned logins.

SELECT SL.name, SL.dbname 
, 'USE [master]; 
ALTER LOGIN [' + SL.name + '] WITH DEFAULT_DATABASE=[master];
CREATE USER [' + SL.name + '] FOR LOGIN [' + SL.name + '] 
WITH DEFAULT_SCHEMA = [dbo];' AS SQL_command 
FROM sys.[syslogins] SL
LEFT JOIN sys.[databases] SD
ON SL.[dbname] = SD.[name]
WHERE SD.name IS NULL
ORDER BY SL.[name], SL.[dbname];


The full article can be found on http://sqlmag.com/database-administration/identifying-orphaned-logins