PDA

View Full Version : protecting pdf output with sessions


meediake
09-29-2005, 01:20 PM
hello everybody,
I have thought about it a lot and I'm right now developing a system, where I want to protect PDF and and other content with specific headers with sessions(user login info is kept in session).

when I use session_start before PDF output(using fpdf), it cannot be sent out, because some headers are allready sent.

Any ideas solving this problem?

Fou-Lu
09-29-2005, 04:41 PM
Output buffering (http://ca3.php.net/manual/en/ref.outcontrol.php) may be of assistance. I've never attempted to use a pdf download with sessions before (actually, I've never used PDF functions at all), but I cannot see it being a problem. If its headers being shared, attempt to couple up the headers by adding a false parameter for the second argument:
header("header", false);

Another option would be to use an inclusion into another script, where you can evaluate the current data passed. You can then create a defined constant, and compare it for use in your PDF generation. That should do the trick as well.