|
Posted by Rik Wasmus on 12/04/07 07:06
On Tue, 04 Dec 2007 08:02:57 +0100, jodleren <sonnich@hot.ee> wrote:
> Hi all!
>
> I have this problem, that I need to check the user (using session data=
> and some checks (included files)), then when ok, I can send a file to
> the user.... meaning (simplified):
>
> header("Pragma: no-cache");
> header("Expires: -1");
>
> session_start();
> if($_SERVER['QUERY_STRING']=3D=3D"logout")
> session_unset();
>
> include("session_control.php");
> include('classes.php');
>
> then, if needed, I might try this (sending a generated file to the
> user):
>
> header('Content-type: application/octet-stream');
> header("Content-Disposition: attachment; filename=3D\"$filename\"");=
> readfile($userfile);
>
> But, I cannot set the headers any more. Then again, I need the
> $_SESSION information to check this first, and I need some included
> functions to do that.
>
> The very ugly solution is all code in one file. There must be another
> way....
>
> Any idea how to overcome this?
Includes are not the reason you can't send any headers anymore. They fac=
t =
that they produce output is. So, take care of that, strip all output fro=
m =
the included files that shouldn't be there (especially look for whitespa=
ce =
outside of php tags if the problem persists). Normally, PHP will inform =
=
you where the output started.
-- =
Rik Wasmus
Navigation:
[Reply to this message]
|