Integrating with existing site?

It is possible to integrate the user login system with an existing user database.

I’m thinking when my users login to Site A, I can set the session variables at the same time for my invoice plane user. That way I can let the existing users I have see their invoices through invoice plane in a sub-directory.

I would think this should be doable by just knowing what needs to be set as part of the session cookie when logging in on my main site.

I think this would be easy if your site is running on CodeIgniter. If not you would have to implement something like a SSO (single sign on) on both sides. Which is not that easy anymore.