if you aren't seeing the session IDs in the url than chances are you are setting a cookie. IF the 2 sites are using the same domain name (but subdomains) then that's where the problem is.
if you set the cookie on site1.mydomain.com then go to site2.mydomain.com and the session cookie is set from *.mydomain.com then it will work anywhere.
Also, you don't seem to be checking the username, just the userid. If a userid exists on both sites, then it will be valid. The session already contains the username, and if you aren't checking it then it will just use that as the username.
example.
I login to site1 as jack, userid=15.
on site2 userid 15 is actually jill.
based on your session code, if I go to site 2, it will check to see if userid is set, say ok, your valid and will let me in.
I think you need to show us complete code for your authentication process and where you set the sessions then where you check them.
I'll reiterate my original question, are these 2 sites just subdomains of the same parent domain or separate domains altogether?