I'm adding a few features to the new fckeditor module (resize images on upload, per-user filemanager roots) and I need a secure way to pass the user's name to fckeditor. Naturally, I figured I'd just create a session, and then get the info using $_SESSION. Wow, big mistake.

Does anyone know how I can access the session from outside drupal? I made a copy of session.inc to hack on, but it reqs database.inc, and that requires bootstrap.inc. 3 hours later . . . So - has this been done? It would be useful to me in all sorts of contexts, as drupal is at the center of my company's new web infrastructure, and I am tasked with integrating all sorts of things. I might just end up passing the SID and then doing a dbquery to get the uname, but that would be sub-optimal, and I'd run into this again I'm sure.

Thanks for any info
Eric D

Comments

gordon’s picture

If you are wanting to access the session from another php application on the same web site then it should not be that hard.

You will need to create a custom version of the sess_read() and sess_write() functions so that you can retreve the session from your database. see the php.net manual on sessions which explains more on doing this.

You will also need to make a copy of drupal_unpack() from bootstrap.inc so that you can correctly unpack your session.
--
Gordon Heydon
Heydon Consulting

--
Gordon Heydon