Reply to Re: Headers, session, include, - and header again?

Your name:

Reply:


Posted by Rik Wasmus on 12/05/07 16:01

On Wed, 05 Dec 2007 16:47:51 +0100, AnrDaemon <anrdaemon@freemail.ru> =

wrote:

> Greetings, jodleren.
> In reply to Your message dated Tuesday, December 4, 2007, 10:02:57,
>
>> I have this problem, that I need to check the user (using session dat=
a
>> 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?
>
> One more idea - enable output buffering.

Which is, 99% of the time it's used to be able to send headers, just =

obscuring a fault in the design of the script. It works, it's just not =

good practise.
-- =

Rik Wasmus

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация