public static function getLastLogin($userId)
    {
        global $PPHP;
        $db = $PPHP['db'];
        $last = $db->selectSingleArray(
            "
            SELECT timestamp, ip, datetime(timestamp, 'localtime') AS localtimestamp
            FROM transactions
            WHERE objectType='user' AND objectId=? AND action='login'
            ORDER BY id DESC
            LIMIT 1
            ",
            array(
                $userId
            )
        );
        return $last !== false ? $last : array('timestamp' => null, 'ip' => null);
    }