Galois:
I had to disable the session.use_trans_sid parameter in PHP config for a similar script to work at all for me when handling Brio report files.
Still, I continue to have trouble using php4 session_start(). I have a script that reads files of various types, detects the file type by ext, then sends appropriate mime-type and other headers to the browser prior to delivering the file.
The file delivery script works perfectly as long as I do not call session_start() before the following:
$result = readfile($path."\x5c".$match);
When I attempt to secure the script with a similar scheme as yours (depends on reading session variables), the delivery fails for one file type in both IE and Navigator. The helper app (brio) is not seeing the headers that make it happy.
I am still looking for a solution and/or a workaround. This may be a case for storing session data in a db. I'll post any progress I make and appreciate the same from you or others sympathetic to my inexperience!