added a check if HTTP_USER_AGENT is set

Some client, mainly crawlers, doesn't send User-Agent. I've added isset() for $_SERVER['HTTP_USER_AGENT'] because In those case, Notice error occurs.