Fix user-agent logging

$_SERVER instead of $_ENV
Fix SQL error on email verification

Bug verified on labs:live and labs:fl4-dev:

Verifying an email address causes the following error to appear at the
bottom of the screen:

(db toolserver)Query failed: SELECT * FROM acc_emails WHERE mail_id =
'23'; ERROR: Table 'acc_notif.acc_emails' doesn't exist

This patch should fix that.
Merge branch 'master' of github.com:enwikipedia-acc/waca