Deploying another application as subdomain


Let’s say that I have an application up and running at

I and developing another application that is complimentary to
have decided to serve that application using

Now this is a totally different application but is useful to the people
visiting site. This new application has it’s own database and
source code.

My problem is login part.

If a user logins to and then visits how do I
who the user is and if the user is logged in or not? Should I use
for this purpose then the someone can change the user_id in the cookie?