I'm working with a very complex legacy D7 site, and very complex requirements (bleaugh).
Anyway: I'm working on a deeplinking system that allows a jump to the site, which then logs-in a user (this is based on an encrypted ID), does some other stuff like setting up cookies, and then jumps to the required page.
This is fine, except some of them are HTTP pages, which work, and some are HTTPS, which don't.
What happens is that when it arrives on the required page there is no logged-in user (so "Access Denied"). But if I then go to an HTTP page (like the front page), the user is logged in.
So clearly I need to set up the HTTPS session data before jumping to the required page. I've been through the Drupal session code but I can't figure it out.
I need to set the SSESSPHPID cookie and possibly some other stuff - but what and what's right? Any help would be appreciated.