Check that $_SERVER['SERVER_NAME'] is exists before use
Remove use of db_prepare_bool.