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