- if((! $record) || (! count($record))) {
- logger('authenticate: failed login attempt: ' . trim($_POST['openid_url']));
- notice( t('Login failed.') . EOL );
- goaway($a->get_baseurl());
- }
-
- $_SESSION['uid'] = $record['uid'];
- $_SESSION['theme'] = $record['theme'];
- $_SESSION['authenticated'] = 1;
- $_SESSION['page_flags'] = $record['page-flags'];
- $_SESSION['my_url'] = $a->get_baseurl() . '/profile/' . $record['nickname'];
- $_SESSION['addr'] = $_SERVER['REMOTE_ADDR'];
-
- notice( t("Welcome back ") . $record['username'] . EOL);
- $a->user = $record;
- if(strlen($a->user['timezone']))
- date_default_timezone_set($a->user['timezone']);
-
- $r = q("SELECT * FROM `contact` WHERE `uid` = %s AND `self` = 1 LIMIT 1",
- intval($_SESSION['uid']));
- if(count($r)) {
- $a->contact = $r[0];
- $a->cid = $r[0]['id'];
- $_SESSION['cid'] = $a->cid;
+ if (!$record || !count($record)) {
+ logger('authenticate: failed login attempt: '.notags(trim($_POST['username'])).' from IP '.$_SERVER['REMOTE_ADDR']);
+ notice(t('Login failed.').EOL);
+ goaway(z_root());