RE: [PHP] header function odd behavior

2011-06-28 Thread Ford, Mike
 -Original Message-
 From: H Rao [mailto:hydsd...@gmail.com]
 Sent: 28 June 2011 04:40
 
 I am trying to understand odd(different) behavior of the header
 function
 under two different environments.
 
 Here is the code which I am trying to execute from two different
 servers
 
 ?
 header (Set-Cookie: c1=value1;path=/; domain=.domain.com);
 header (Set-Cookie: c2=value2;path=/; domain=.domain.com);
 ?
 
 When executed from server1(OS X), both cookies are set in browser,
 but when
 executed from server2(Linux), only the second cookie is set.
 
 server1 and server2 are running different OS and php version as
 below. I
 know I could add $replace=false option on the Linux server, but I am
 trying
 to understand the different behavior of header() function on these
 two
 servers. Any thoughts?

Well, according to the manual, you need to be using the FALSE parameter anyway 
since By default it will replace, but if you pass in FALSE as the second 
argument you can force multiple headers. So the wrong behaviour is on the 
(older) OS X server, but I'm as confused as you as to why this should be as 
there is no indication in the manual or the ChangeLog that the default 
behaviour has changed at any point.

Cheers!

Mike
-- 
Mike Ford,
Electronic Information Developer, Libraries and Learning Innovation,  
Leeds Metropolitan University, Portland PD507, City Campus, 
Portland Way, LEEDS,  LS1 3HE,  United Kingdom 
E: m.f...@leedsmet.ac.uk T: +44 113 812 4730





To view the terms under which this email is distributed, please go to 
http://disclaimer.leedsmet.ac.uk/email.htm

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] header function odd behavior

2011-06-27 Thread Nilesh Govindarajan
On 06/28/2011 09:10 AM, H Rao wrote:
 Hi,

 I am trying to understand odd(different) behavior of the header function
 under two different environments.

 Here is the code which I am trying to execute from two different servers

 ?
 header (Set-Cookie: c1=value1;path=/; domain=.domain.com);
 header (Set-Cookie: c2=value2;path=/; domain=.domain.com);
 ?

 When executed from server1(OS X), both cookies are set in browser, but when
 executed from server2(Linux), only the second cookie is set.

 server1 and server2 are running different OS and php version as below. I
 know I could add $replace=false option on the Linux server, but I am trying
 to understand the different behavior of header() function on these two
 servers. Any thoughts?

snip

I don't have a clear idea about this because I always use setcookie(),
but something tells me that this has something to do with output
buffering and friends.

-- 
Regards,
Nilesh Govindarajan
@nileshgr


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Header function

2010-03-01 Thread Kim Madsen

Ashley Sheridan wrote on 01/03/2010 07:13:


The HTTP header doesn't treat quoteation marks in the same way that PHP
does. It needs double quote marks to function correctly.


How do you mean? And do you have a link to this information?

Even if this is true, then the first Nick did should still be correct?

header('Content-Disposition: attachment; filename=PurchaseReq.doc');

I'm using the same headers for downloads, allthough I use double qoutes 
for the header function aswell:


header(Content-Disposition: attachment; filename=\artist - title.mp3\);

--
Kind regards
Kim Emax - masterminds.dk

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Header function

2010-03-01 Thread Ashley Sheridan
On Mon, 2010-03-01 at 12:14 +0100, Kim Madsen wrote:

 Ashley Sheridan wrote on 01/03/2010 07:13:
 
  The HTTP header doesn't treat quoteation marks in the same way that PHP
  does. It needs double quote marks to function correctly.
 
 How do you mean? And do you have a link to this information?
 
 Even if this is true, then the first Nick did should still be correct?
 
 header('Content-Disposition: attachment; filename=PurchaseReq.doc');
 
 I'm using the same headers for downloads, allthough I use double qoutes 
 for the header function aswell:
 
 header(Content-Disposition: attachment; filename=\artist - title.mp3\);
 
 -- 
 Kind regards
 Kim Emax - masterminds.dk
 


I only meant for the quotes around the filename. I'd tried

header(Content-Disposition: attachment; filename='artist -
title.mp3');

before and it didn't work correctly. I hadn't run into the problem of
double quotes inside singe though, as the filenames I was generating
relied on a variable, and I found it easier to just escape the second
set of nested quotes and include the variable directly.

As far as I'm aware, the header() function shouldn't care whether it
uses single or double quotes, so I would assume it's something else
amiss.

Thanks,
Ash
http://www.ashleysheridan.co.uk




RE: [PHP] Header function

2010-02-28 Thread Ashley Sheridan
On Sat, 2010-02-27 at 23:48 +1100, Nick allan wrote:

 Interesting the following works
 Changing the  to '. If I leave the ' around the filename, the ' becomes part 
 of the filename. But it seemed to be more about changing the surrounding ' to 
  that fixed it. Not sure why this is, but its working now.
 
 
 header('Content-Type: application/msword');
  header(Content-Disposition: attachment; filename=PurchaseReq.doc);
 -Original Message-
 From: Richard Quadling [mailto:rquadl...@googlemail.com] 
 Sent: Saturday, 27 February 2010 8:45 PM
 To: Nick allan
 Cc: php-general@lists.php.net
 Subject: Re: [PHP] Header function
 
 On 27 February 2010 04:32, Nick allan nal...@wdev.net wrote:
  Hi all
 
  Has anyone got any ideas why the following isn't giving me correct filename
  in the ie save dialogue
 
  header('Content-Type: application/msword');
 
   header('Content-Disposition: attachment; filename=PurchaseReq.doc');
 
 
 
  I get the save dialogue, but with preq.doc instead of PurchaseReq.doc
 
  Preq.php is the calling php file. It has worked before so I'm not sure what
  I've changed to have it stop working.
 
 
 
 
 
  Thanks in advance for any suggestions.
 
 
 
  Regards Nick
 
 
 
 
 
 What happens if you drop the quotes around the filename?
 
 -- 
 -
 Richard Quadling
 Standing on the shoulders of some very clever giants!
 EE : http://www.experts-exchange.com/M_248814.html
 EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp
 Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
 ZOPA : http://uk.zopa.com/member/RQuadling
 
 


The HTTP header doesn't treat quoteation marks in the same way that PHP
does. It needs double quote marks to function correctly.

Thanks,
Ash
http://www.ashleysheridan.co.uk




Re: [PHP] Header function

2010-02-27 Thread Richard Quadling
On 27 February 2010 04:32, Nick allan nal...@wdev.net wrote:
 Hi all

 Has anyone got any ideas why the following isn't giving me correct filename
 in the ie save dialogue

 header('Content-Type: application/msword');

  header('Content-Disposition: attachment; filename=PurchaseReq.doc');



 I get the save dialogue, but with preq.doc instead of PurchaseReq.doc

 Preq.php is the calling php file. It has worked before so I'm not sure what
 I've changed to have it stop working.





 Thanks in advance for any suggestions.



 Regards Nick





What happens if you drop the quotes around the filename?

-- 
-
Richard Quadling
Standing on the shoulders of some very clever giants!
EE : http://www.experts-exchange.com/M_248814.html
EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
ZOPA : http://uk.zopa.com/member/RQuadling

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Header function

2010-02-27 Thread Nick allan
Interesting the following works
Changing the  to '. If I leave the ' around the filename, the ' becomes part 
of the filename. But it seemed to be more about changing the surrounding ' to  
that fixed it. Not sure why this is, but its working now.


header('Content-Type: application/msword');
 header(Content-Disposition: attachment; filename=PurchaseReq.doc);
-Original Message-
From: Richard Quadling [mailto:rquadl...@googlemail.com] 
Sent: Saturday, 27 February 2010 8:45 PM
To: Nick allan
Cc: php-general@lists.php.net
Subject: Re: [PHP] Header function

On 27 February 2010 04:32, Nick allan nal...@wdev.net wrote:
 Hi all

 Has anyone got any ideas why the following isn't giving me correct filename
 in the ie save dialogue

 header('Content-Type: application/msword');

  header('Content-Disposition: attachment; filename=PurchaseReq.doc');



 I get the save dialogue, but with preq.doc instead of PurchaseReq.doc

 Preq.php is the calling php file. It has worked before so I'm not sure what
 I've changed to have it stop working.





 Thanks in advance for any suggestions.



 Regards Nick





What happens if you drop the quotes around the filename?

-- 
-
Richard Quadling
Standing on the shoulders of some very clever giants!
EE : http://www.experts-exchange.com/M_248814.html
EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
ZOPA : http://uk.zopa.com/member/RQuadling


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] header function query

2010-02-26 Thread Richard Quadling
On 26 February 2010 06:49, Nick allan nal...@wdev.net wrote:
 Hi all

 The situation is as follows

 I've read some data in from a couple of files into a string variable, made
 some changes to it and want to send the contents of the string out to the
 browser as a word document.

 My code currently looks like the following

 header('Content-Type: application/msword');

                header('Content-Disposition: attachment;
 filename=preq.doc');

 ob_clean();

 echo $allText;





 The above code works fine, the client gets a file download dialogue and can
 save or open the file.

 How can I indicate end of file, then continue writing html to display a new
 page. I want to be able to ask the user some additional questions after they
 have downloaded the file.  My problem is that if I add any html code after
 the above echo statement, it is included in the downloaded file.

 There's probably a simple answer to this, but I haven't been able to find
 anything using google.



 Thanks in advance for any suggestions.



 Regards Nick





Under normal conditions, you can't.

A request is for a single thing. While it is potentially possible to
embed graphics, css, js into a single html file request, downloading
files is not.

Instead, you issue the html first, but include in the head tag, a
meta redirect tag to the URL just for the download file.




-- 
-
Richard Quadling
Standing on the shoulders of some very clever giants!
EE : http://www.experts-exchange.com/M_248814.html
EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
ZOPA : http://uk.zopa.com/member/RQuadling

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] header function query

2010-02-26 Thread Rene Veerman
output the html you want to send afterwards first,

then either put a link to another script that outputs the word file,
or have an auto-launch ajax routine (i recommend jquery.com for ajax)
do it automatically.

On Fri, Feb 26, 2010 at 7:49 AM, Nick allan nal...@wdev.net wrote:
 Hi all

 The situation is as follows

 I've read some data in from a couple of files into a string variable, made
 some changes to it and want to send the contents of the string out to the
 browser as a word document.

 My code currently looks like the following

 header('Content-Type: application/msword');

                header('Content-Disposition: attachment;
 filename=preq.doc');

 ob_clean();

 echo $allText;





 The above code works fine, the client gets a file download dialogue and can
 save or open the file.

 How can I indicate end of file, then continue writing html to display a new
 page. I want to be able to ask the user some additional questions after they
 have downloaded the file.  My problem is that if I add any html code after
 the above echo statement, it is included in the downloaded file.

 There's probably a simple answer to this, but I haven't been able to find
 anything using google.



 Thanks in advance for any suggestions.



 Regards Nick





--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] header function, I'm stumped

2003-12-09 Thread Kelly Hallman
On Tue, 2 Dec 2003, Chris Hubbard wrote:
 All, dealing with header(location:...) again.  and trying to
 understand what's happening. I've got the following code:
 header(Location:http://www.mysite.com/cp/ad/ad_details.php?id=;. $id);

I'm kinda surprised I didn't see this mentioned.. Have you tried:
header(Location: http://url.redirect/\n\n;); exit; // ?

The browser may be particular about the headers. When you add the two 
newlines to the end, it makes it look like the end of the headers.

It's good practice to explicitly exit each time you redirect.

-- 
Kelly Hallman
// Ultrafancy

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] header function, I'm stumped

2003-12-09 Thread Chris Shiflett
--- Kelly Hallman [EMAIL PROTECTED] wrote:
 On Tue, 2 Dec 2003, Chris Hubbard wrote:
  All, dealing with header(location:...) again.  and trying to
  understand what's happening. I've got the following code:
  header(Location:http://www.mysite.com/cp/ad/ad_details.php?id=;.
 $id);
 
 I'm kinda surprised I didn't see this mentioned.. Have you tried:
 header(Location: http://url.redirect/\n\n;); exit; // ?

You should definitely not try to add your own newlines to the end of a
header like that. PHP might be able to gracefully handle it, but I
wouldn't rely on it.

As for the original question, put a space after your colon, and let us
know how that works.

Hope that helps.

Chris

=
Chris Shiflett - http://shiflett.org/

PHP Security Handbook
 Coming mid-2004
HTTP Developer's Handbook
 http://httphandbook.org/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] header function, I'm stumped

2003-12-09 Thread Jon Kriek
?php
ob_start();
$dom = $_SERVER['SERVER_NAME'];
writeMessage($id) or die('cannot write' . $id);
header('Location: http://' . $dom . '/cp/ad/ad_details.php?id=' . $id);
exit();
ob_end_flush();
?

-- 
Jon Kriek
www.phpfreaks.com
www.jonkriek.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] header function, I'm stumped

2003-12-02 Thread Chris Shiflett
--- Chris Hubbard [EMAIL PROTECTED] wrote:
 header(Location:http://www.mysite.com/cp/ad/ad_details.php?id=;. $id);

There should be a space after the first colon there.

 Then I used LiveHTTPHeaders in Mozilla and it give me some interesting
 information, though I'm not quite sure how to interpret.

Awesome. Paste that here (you can omit the bulk of the HTML, so that
there's not too much stuff to sift through), and we can help you interpret
it. What would be best is to try and trim it down to only what is
different between when it works and when it doesn't.

Chris

=
Chris Shiflett - http://shiflett.org/

PHP Security Handbook
 Coming mid-2004
HTTP Developer's Handbook
 http://httphandbook.org/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] header() function for displaying an opened PDF document.

2003-10-14 Thread Marek Kilimajer
Are you using sessions? Then you need 
session_cache_limiter('private_no_expire');

Scott Fletcher wrote:

I seem to be having problem with sending the PDF document to the browser to
be open on screen.  I kept getting the error message, it say 'Windows cannot
open this file'.  Here's my sample script, so what am I doing wrong?...
--snip--
header(Content-Type: application/pdf);
header(Content-Length: '40736');
header(Content-Disposition: inline; filename='junk.pdf');
--snip--
Thanks,
 Scott F.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] header() function for displaying an opened PDF document.

2003-10-14 Thread Scott Fletcher
Not using the session.  :-)  Oh well...

Marek Kilimajer [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Are you using sessions? Then you need
 session_cache_limiter('private_no_expire');

 Scott Fletcher wrote:

  I seem to be having problem with sending the PDF document to the browser
to
  be open on screen.  I kept getting the error message, it say 'Windows
cannot
  open this file'.  Here's my sample script, so what am I doing wrong?...
 
  --snip--
  header(Content-Type: application/pdf);
  header(Content-Length: '40736');
  header(Content-Disposition: inline; filename='junk.pdf');
  --snip--
 
  Thanks,
   Scott F.
 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] header() function for displaying an opened PDF document.

2003-10-14 Thread Scott Fletcher
Sound like a good idea.  I'll see if I can find this on the Internet and see
what happen.

Bertrand Moulard [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 now that I'm rethinking of it, I solved the problem by using the brilliant
 python program tcpwatch, which logs all the http data going in and out
your
 browser. Very easy to run and so handy (not only for this problem). Would
 find the url for dld if you want.

 cheers

 .b

 -Original Message-
 From: Scott Fletcher [mailto:[EMAIL PROTECTED]
 Sent: 13 October 2003 22:15
 To: [EMAIL PROTECTED]
 Subject: [PHP] header() function for displaying an opened PDF document.


 I seem to be having problem with sending the PDF document to the browser
to
 be open on screen.  I kept getting the error message, it say 'Windows
cannot
 open this file'.  Here's my sample script, so what am I doing wrong?...

 --snip--
 header(Content-Type: application/pdf);
 header(Content-Length: '40736');
 header(Content-Disposition: inline; filename='junk.pdf');
 --snip--

 Thanks,
  Scott F.

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] header() function for displaying an opened PDF document.

2003-10-13 Thread Bertrand Moulard
Might not be connected at all, but I had a similar problem with pdf stored
in a postgreSQL database as large object. The content type was set to pdf,
but ie wouldn't open it. It turned up that it was because there was a CRLF
at the end of one of my script, which spoiled the whole output. Pretty dumb
thing, but it kept me busy for a good hour. If you're desperate for a
solution, look for an unwanted new line somewhere in your file out of the ?
? tags.

good luck

.b

-Original Message-
From: Scott Fletcher [mailto:[EMAIL PROTECTED]
Sent: 13 October 2003 22:15
To: [EMAIL PROTECTED]
Subject: [PHP] header() function for displaying an opened PDF document.


I seem to be having problem with sending the PDF document to the browser to
be open on screen.  I kept getting the error message, it say 'Windows cannot
open this file'.  Here's my sample script, so what am I doing wrong?...

--snip--
header(Content-Type: application/pdf);
header(Content-Length: '40736');
header(Content-Disposition: inline; filename='junk.pdf');
--snip--

Thanks,
 Scott F.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] header() function for displaying an opened PDF document.

2003-10-13 Thread Bertrand Moulard
now that I'm rethinking of it, I solved the problem by using the brilliant
python program tcpwatch, which logs all the http data going in and out your
browser. Very easy to run and so handy (not only for this problem). Would
find the url for dld if you want.

cheers

.b

-Original Message-
From: Scott Fletcher [mailto:[EMAIL PROTECTED]
Sent: 13 October 2003 22:15
To: [EMAIL PROTECTED]
Subject: [PHP] header() function for displaying an opened PDF document.


I seem to be having problem with sending the PDF document to the browser to
be open on screen.  I kept getting the error message, it say 'Windows cannot
open this file'.  Here's my sample script, so what am I doing wrong?...

--snip--
header(Content-Type: application/pdf);
header(Content-Length: '40736');
header(Content-Disposition: inline; filename='junk.pdf');
--snip--

Thanks,
 Scott F.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] header function problem

2003-06-06 Thread Daniel J. Rychlik
It works now.  Are their any examples out there that will show how to pass
back the information that was entered and pass the error message back to the
form.htm ?  Or a function that i need to read up on.

-Dan


- Original Message - 
From: Jason Wong [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, June 05, 2003 1:01 AM
Subject: Re: [PHP] header function problem


 On Thursday 05 June 2003 07:01, Daniel J. Rychlik wrote:
  Well, it works if I use the full path instead of relative  So
obviously
  its an apache permissions issue.

 It has nothing to do with apache. The specs require that the location is
 absolute.

 -- 
 Jason Wong - Gremlins Associates - www.gremlins.biz
 Open Source Software Systems Integrators
 * Web Design  Hosting * Internet  Intranet Applications Development *
 --
 Search the list archives before you post
 http://marc.theaimsgroup.com/?l=php-general
 --
 /*
 It is undignified for a woman to play servant to a man who is not hers.
 -- Spock, Amok Time, stardate 3372.7
 */


 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] header function problem

2003-06-05 Thread Daniel J. Rychlik
Well, it works if I use the full path instead of relative  So obviously
its an apache permissions issue.




- Original Message - 
From: Daniel J. Rychlik [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, June 04, 2003 5:36 PM
Subject: [PHP] header function problem


I am using a header function to take a user back to a form if they have
mistyped or entered in data that is not desirable.

I have multiple functions that Ive written but the one that pertains to this
situation is listed

function check_data () {

if (!empty($value)) {

go_back( blah );
}
}

function go_back($err) {

header(Location: http://webserver/form.htm;);

}

When calling this, I recieved a 403 Forbidden error message.  Obviously Im
doing something wrong...  Or I have a permissions issue.  I would not think
its a permissions issue execpt the way the header function calls.  I
honestly dont know, just guessing.  I was wandering if anyone has seen this
when using the header() function

Thanks so much,
Daniel


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] header function problem

2003-06-05 Thread Jason Wong
On Thursday 05 June 2003 07:01, Daniel J. Rychlik wrote:
 Well, it works if I use the full path instead of relative  So obviously
 its an apache permissions issue.

It has nothing to do with apache. The specs require that the location is 
absolute.

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
It is undignified for a woman to play servant to a man who is not hers.
-- Spock, Amok Time, stardate 3372.7
*/


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] header function

2003-03-10 Thread Barry Gould
I have session auto start on.

Plus, like I said, it works fine if it's at the top of the page, not in the 
include file.

Thanks,
Barry
At 05:19 PM 3/7/2003, Jim Lucas wrote:
if you put this at the very to of the page, I am guessing
then that you haven't ran session_start()  ??
if you are trying to access a value stored in a session variable, you need
to initialize the session first, then access the variable.
Jim
- Original Message -
From: Barry Gould [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, March 07, 2003 3:35 PM
Subject: [PHP] header function
 I am having a hard time with the header(Location:) function inside an
 include file with PHP 4.3.1 (Linux, running as a module w/ Apache 1.3.27).

 At the VERY TOP of my php page, I have:
 ?php virtual(/include/logincheck.php) ?

 logincheck.php contains exactly:
 ?php
 // login check
 if(!isset($_SESSION[agent_id]))
 {
 header(Location:/);
 header(Connection: close);
 exit;
 }
 ?

 However, if this agent_id is not set, I just get a blank page with html
 open and close tags.

 I'm SURE there are no spaces or blank lines before these lines.

 It works fine if I put the code in the main page instead of using the
 virtual include.

 Output buffering is set to 4096 in php.ini.

 Any suggestions would be appreciated.

 Thanks,
 Barry


 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php




--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] header function

2003-03-10 Thread Barry Gould
I'm starting to think this is a BUG.

Can anyone else test this and confirm or contradict?

Thanks,
Barry
At 03:35 PM 3/7/2003, you wrote:
I am having a hard time with the header(Location:) function inside an 
include file with PHP 4.3.1 (Linux, running as a module w/ Apache 1.3.27).

At the VERY TOP of my php page, I have:
?php virtual(/include/logincheck.php) ?
logincheck.php contains exactly:
?php
// login check
if(!isset($_SESSION[agent_id]))
{
header(Location:/);
header(Connection: close);
exit;
}
?
However, if this agent_id is not set, I just get a blank page with html 
open and close tags.

I'm SURE there are no spaces or blank lines before these lines.

It works fine if I put the code in the main page instead of using the 
virtual include.

Output buffering is set to 4096 in php.ini.

Any suggestions would be appreciated.

Thanks,
Barry


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] header function

2003-03-10 Thread CPT John W. Holmes
Use INCLUDE(), not virtual(). virtual() isn't supposed to be used with PHP
files.

---John Holmes...

- Original Message -
From: Barry Gould [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, March 10, 2003 4:26 PM
Subject: Re: [PHP] header function


 I'm starting to think this is a BUG.

 Can anyone else test this and confirm or contradict?

 Thanks,
 Barry

 At 03:35 PM 3/7/2003, you wrote:
 I am having a hard time with the header(Location:) function inside an
 include file with PHP 4.3.1 (Linux, running as a module w/ Apache
1.3.27).
 
 At the VERY TOP of my php page, I have:
 ?php virtual(/include/logincheck.php) ?
 
 logincheck.php contains exactly:
 ?php
 // login check
 if(!isset($_SESSION[agent_id]))
 {
  header(Location:/);
  header(Connection: close);
  exit;
 }
 ?
 
 However, if this agent_id is not set, I just get a blank page with html
 open and close tags.
 
 I'm SURE there are no spaces or blank lines before these lines.
 
 It works fine if I put the code in the main page instead of using the
 virtual include.
 
 Output buffering is set to 4096 in php.ini.
 
 Any suggestions would be appreciated.
 
 Thanks,
 Barry


 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] header function

2003-03-10 Thread Barry Gould
AHA!

Thank you!

Barry

At 01:38 PM 3/10/2003, you wrote:
Use INCLUDE(), not virtual(). virtual() isn't supposed to be used with PHP
files.
---John Holmes...

- Original Message -
From: Barry Gould [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, March 10, 2003 4:26 PM
Subject: Re: [PHP] header function
 I'm starting to think this is a BUG.

 Can anyone else test this and confirm or contradict?

 Thanks,
 Barry

 At 03:35 PM 3/7/2003, you wrote:
 I am having a hard time with the header(Location:) function inside an
 include file with PHP 4.3.1 (Linux, running as a module w/ Apache
1.3.27).
 
 At the VERY TOP of my php page, I have:
 ?php virtual(/include/logincheck.php) ?
 
 logincheck.php contains exactly:
 ?php
 // login check
 if(!isset($_SESSION[agent_id]))
 {
  header(Location:/);
  header(Connection: close);
  exit;
 }
 ?
 
 However, if this agent_id is not set, I just get a blank page with html
 open and close tags.
 
 I'm SURE there are no spaces or blank lines before these lines.
 
 It works fine if I put the code in the main page instead of using the
 virtual include.
 
 Output buffering is set to 4096 in php.ini.
 
 Any suggestions would be appreciated.
 
 Thanks,
 Barry


 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] header function

2003-03-07 Thread Jim Lucas
if you put this at the very to of the page, I am guessing
then that you haven't ran session_start()  ??

if you are trying to access a value stored in a session variable, you need
to initialize the session first, then access the variable.

Jim
- Original Message -
From: Barry Gould [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, March 07, 2003 3:35 PM
Subject: [PHP] header function


 I am having a hard time with the header(Location:) function inside an
 include file with PHP 4.3.1 (Linux, running as a module w/ Apache 1.3.27).

 At the VERY TOP of my php page, I have:
 ?php virtual(/include/logincheck.php) ?

 logincheck.php contains exactly:
 ?php
 // login check
 if(!isset($_SESSION[agent_id]))
 {
 header(Location:/);
 header(Connection: close);
 exit;
 }
 ?

 However, if this agent_id is not set, I just get a blank page with html
 open and close tags.

 I'm SURE there are no spaces or blank lines before these lines.

 It works fine if I put the code in the main page instead of using the
 virtual include.

 Output buffering is set to 4096 in php.ini.

 Any suggestions would be appreciated.

 Thanks,
 Barry


 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] header function

2002-11-09 Thread Stephen
The file loading may be too long for PHP to recognize it or whatever. Try
shortening it in some way.


- Original Message -
From: Donahue Ben [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Saturday, November 09, 2002 2:47 PM
Subject: [PHP] header function


 I am using the header function what i have is this:

 header(Location:

http://.$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF'])./.$relative_u
rl

 $relative_url is a php file

 when i run this script with this header function in
 it, i get an error saying:Redirection limit for this
 URL has exceeded. Unable to load the requested page.

 I dont understand why i get this error and how to fix
 this.

 Ben

 __
 Do you Yahoo!?
 U2 on LAUNCH - Exclusive greatest hits videos
 http://launch.yahoo.com/u2

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] header function

2002-11-09 Thread Ernest E Vogelsinger
At 20:47 09.11.2002, Donahue Ben said:
[snip]
I am using the header function what i have is this:

header(Location:
http://.$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF'])./.$relative_url

$relative_url is a php file

when i run this script with this header function in
it, i get an error saying:Redirection limit for this
URL has exceeded. Unable to load the requested page.
[snip] 

This message might mean that $relative_url points to the same script...
what browser makemodel are you using? IE simply loops, without any error.

A small glitch: in case dirname($_SERVER['PHP_SELF']) is empty (root
directory), your header would look as:
http://www.yourdomain.com//relative.php

Note the double slash... 


-- 
   O Ernest E. Vogelsinger
   (\)ICQ #13394035
^ http://www.vogelsinger.at/



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] header() -- function failed to due caching.

2002-05-15 Thread Patrick Lynch

Hi Scott,

If you are using IE, make sure that the browser checks for updates every
visit to the page. (Tools-Internet Options-Settings). I am not sure
that this setting observes Cache-Control, etc...

Are you setting the Cache-Control header to Private and the expires
header to a suitable time?

Regards,
Patrick Lynch
http://www.optip.com/

-Original Message-
From: Scott Fletcher [mailto:[EMAIL PROTECTED]] 
Sent: 15 May 2002 18:31
To: [EMAIL PROTECTED]
Subject: [PHP] header() -- function failed to due caching.


I tried to use this script but it failed due to the caching.  Does
anyone know the way around hte problem or have a solution to the
problem?

--- example script 
  $url_address = $GLOBALS[HTTP_HOST];

   switch ($url_address) {
   case www.php.net:
   $url_address = http://www.php.net/db2admin/db2_cleanup.php;;
   break;
   case test.php.net:
   $url_address =
https://test.php.net/db2admin/db2_cleanup.php;;
   break;
   default:
   $url_address =  Undefined Url Address ;
   echo $url_address;
   break;
   }
header(Location: $url_address);

--- example script end 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Header() function and redirect

2001-08-30 Thread * RzE:

Original message
From: Zhu George-CZZ010 [EMAIL PROTECTED]
Date: Thu, Aug 30, 2001 at 11:10:19AM -0500
Message-ID: [EMAIL PROTECTED]
Subject: [PHP] Header() function and redirect


   I am using Apache and PHP. I encountered a redirect problem in PHP, and traced it 
down, so, I generated a very short PHP page as following:

 ?php
 sleep(30);
 $goto = http://tt.mot.com/to_pdf/pdf_tmp/test.pdf;;
 Header(Location: $goto);
 exit;
 ?

 If the sleep(30); statement is commented out, this page works fine in both 
IE4.0/IE5.0 and netscape, but if sleep(30) statement is in this page, it will only 
work in Netscape, but not in IE.

 Is there another way to do the redirect in PHP? or how to fix this problem (I 
can't remove the sleep statement because in the real program, it is a System call 
and will take more than 30 seconds)?

  Thank you very much in advance.

 Regards,
 George

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]

/Original message

Reply

You can (possibly) just redirect before the rest of your script.
Ofcourse you can't do that when the rest of the script produces
output, but it seems to me like it doesn't.

Try the next code:

--- PHP code ---
?php
  header (Location: http://somewhere.com;);
  error_log (And still my script is running!, 0);
?
--- End of PHP code ---

You'll see that the original script will write the line to the
logfile although the user is already redirected to the next page.

Btw... 30 seconds is a rather long time. No user will ever want to
wait that long. Just my opinion...

/Reply

--

* RzE:


-- 
-- Renze Munnik
-- DataLink BV
--
-- E: [EMAIL PROTECTED]
-- W: +31 23 5326162
-- F: +31 23 5322144
-- M: +31 6 21811143
--
-- Stationsplein 82
-- 2011 LM  HAARLEM
-- Netherlands
--
-- http://www.datalink.nl
-- 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] Header() function and redirect

2001-08-30 Thread Zhu George-CZZ010

But I have to wait for the application to finish. The idea is: the application will 
take the file, and convert it into PDF file (it takes more than 30 seconds generally), 
then display the generated  PDF file.

I am just wondering if I can use Header() to redirect to a general php page, then in 
that page, redirect to the PDF file.  

Thanks,
George



-Original Message-
From: * RzE: [mailto:[EMAIL PROTECTED]]
Sent: Thursday, August 30, 2001 11:19 AM
To: Zhu George-CZZ010; [EMAIL PROTECTED]
Subject: Re: [PHP] Header() function and redirect


Original message
From: Zhu George-CZZ010 [EMAIL PROTECTED]
Date: Thu, Aug 30, 2001 at 11:10:19AM -0500
Message-ID: [EMAIL PROTECTED]
Subject: [PHP] Header() function and redirect


   I am using Apache and PHP. I encountered a redirect problem in PHP, and traced it 
down, so, I generated a very short PHP page as following:

 ?php
 sleep(30);
 $goto = http://tt.mot.com/to_pdf/pdf_tmp/test.pdf;;
 Header(Location: $goto);
 exit;
 ?

 If the sleep(30); statement is commented out, this page works fine in both 
IE4.0/IE5.0 and netscape, but if sleep(30) statement is in this page, it will only 
work in Netscape, but not in IE.

 Is there another way to do the redirect in PHP? or how to fix this problem (I 
can't remove the sleep statement because in the real program, it is a System call 
and will take more than 30 seconds)?

  Thank you very much in advance.

 Regards,
 George

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]

/Original message

Reply

You can (possibly) just redirect before the rest of your script.
Ofcourse you can't do that when the rest of the script produces
output, but it seems to me like it doesn't.

Try the next code:

--- PHP code ---
?php
  header (Location: http://somewhere.com;);
  error_log (And still my script is running!, 0);
?
--- End of PHP code ---

You'll see that the original script will write the line to the
logfile although the user is already redirected to the next page.

Btw... 30 seconds is a rather long time. No user will ever want to
wait that long. Just my opinion...

/Reply

--

* RzE:


-- 
-- Renze Munnik
-- DataLink BV
--
-- E: [EMAIL PROTECTED]
-- W: +31 23 5326162
-- F: +31 23 5322144
-- M: +31 6 21811143
--
-- Stationsplein 82
-- 2011 LM  HAARLEM
-- Netherlands
--
-- http://www.datalink.nl
-- 

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Header() function and redirect

2001-08-30 Thread * RzE:

Original message
From: Zhu George-CZZ010 [EMAIL PROTECTED]
Date: Thu, Aug 30, 2001 at 11:27:41AM -0500
Message-ID: [EMAIL PROTECTED]
Subject: RE: [PHP] Header() function and redirect

 But I have to wait for the application to finish. The idea is: the application will 
take the file, and convert it into PDF file (it takes more than 30 seconds 
generally), then display the generated  PDF file.

 I am just wondering if I can use Header() to redirect to a general php page, then 
in that page, redirect to the PDF file.

 Thanks,
 George

/Original message

Reply

Ah... well...

Don't know what you exactly mean, but you either have to wait 'till
the processing has been done (which, like I said, takes too long to
wait for), or you can use one of the following options:

- You can have an email send to the user telling him/her that the
  PDF is ready. You can either send it as an attachment, or just
  send a URL of the page where the PDF can be downloaded.
- You can have the user redirected to a page with a download link on
  it. Then you still have to problem, though, that the PDF isn't
  ready yet at the moment the user gets that link.

But you get back to what you're wondering (if I can use Header()
to redirect to a general php page); Yes, ofcourse... you can do it
before or after the processing. But! You can't do anything about
client-timeouts. And let's be honest... It's not that weird that a
browser gives up if it doesn't get any answer for more than 30
seconds. It's a pretty long timeout already.

/Reply

--

* RzE:


-- 
-- Renze Munnik
-- DataLink BV
--
-- E: [EMAIL PROTECTED]
-- W: +31 23 5326162
-- F: +31 23 5322144
-- M: +31 6 21811143
--
-- Stationsplein 82
-- 2011 LM  HAARLEM
-- Netherlands
--
-- http://www.datalink.nl
-- 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] Header() function and redirect

2001-08-30 Thread Don Read


On 30-Aug-2001 Zhu George-CZZ010 wrote:
 But I have to wait for the application to finish. The idea is: the
 application will take the file, and convert it into PDF file (it takes more
 than 30 seconds generally), then display the generated  PDF file.
 
 I am just wondering if I can use Header() to redirect to a general php
 page, then in that page, redirect to the PDF file.  
 

30 seconds might be timing-out,
  instead let the browser handle the sleeping:

?php
  $goto='http://tt.mot.com/to_pdf/pdf_tmp/test.pdf';
  $sleepfor=30;

  printf('META HTTP-EQUIV=Refresh CONTENT=%d URL=%s',
$sleepfor, $goto);

// run the job
  $cmd='foo -bar baz ';
  system($cmd);
?

-- 
Don Read   [EMAIL PROTECTED]
-- It's always darkest before the dawn. So if you are going to 
   steal the neighbor's newspaper, that's the time to do it.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] header function

2001-08-21 Thread Tyler Longren

Well, it's not a good idea to put something (like an echo) before a
header()...even for testing because that will prevent the header() from
working at all.  You should have gotten an All headers have been sent or
some similar error.

--
Tyler Longren
Captain Jack Communications
[EMAIL PROTECTED]
www.captainjack.com



On Tue, 21 Aug 2001 09:53:42 -0500
Jay Paulson [EMAIL PROTECTED] wrote:

 Hello everyone-
 
 I have a slight problem.. I'm running php 4.0.6 on RedHat 7.1 and I run
 my
 script and it hit's:
 
 header(Location:index.php);
 
 well the thing is once it hits that line in my script and just fails,
 however i don't get any type of parse error the browser just says 404
 error
 page not found... could it be i forgot to add something when i
 configured
 and installed php on my machine?
 
 i'm really losted here cause i can put an echo blah; before it or
 after it
 and it will print out just fine.. but comment out that echo and have it
 hit
 the header() line and i get teh 404 page error.. (and yes i've double
 and
 tripled checked that all the files etc are there it's just not doing the
 header function for some reason)
 
 Thanks!
 Jay
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] header function

2001-08-21 Thread Jay Paulson

You're right when you say that you shouldn't put an echo before the header..
however I did that just so I could see if I would get the error All headers
have been sent and well I didn't get that error... I didn't get any error
message.. so I thought that was strange and that's why I'm here asking this
question because I really don't know what's going on.. I have checked the
web server error log and when I call the header function it tries to
redirect me to a .php file (notice there is no file name).  So I'm not
sure what exactly is going on.

[Mon Aug 20 17:23:03 2001] [error] [client 64.132.13.114] File does not
exist: /home/username/htdocs/admin/.php


- Original Message -
From: Tyler Longren [EMAIL PROTECTED]
To: Jay Paulson [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Tuesday, August 21, 2001 9:54 AM
Subject: Re: [PHP] header function


 Well, it's not a good idea to put something (like an echo) before a
 header()...even for testing because that will prevent the header() from
 working at all.  You should have gotten an All headers have been sent or
 some similar error.

 --
 Tyler Longren
 Captain Jack Communications
 [EMAIL PROTECTED]
 www.captainjack.com



 On Tue, 21 Aug 2001 09:53:42 -0500
 Jay Paulson [EMAIL PROTECTED] wrote:

  Hello everyone-
 
  I have a slight problem.. I'm running php 4.0.6 on RedHat 7.1 and I run
  my
  script and it hit's:
 
  header(Location:index.php);
 
  well the thing is once it hits that line in my script and just fails,
  however i don't get any type of parse error the browser just says 404
  error
  page not found... could it be i forgot to add something when i
  configured
  and installed php on my machine?
 
  i'm really losted here cause i can put an echo blah; before it or
  after it
  and it will print out just fine.. but comment out that echo and have it
  hit
  the header() line and i get teh 404 page error.. (and yes i've double
  and
  tripled checked that all the files etc are there it's just not doing the
  header function for some reason)
 
  Thanks!
  Jay
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
  To contact the list administrators, e-mail: [EMAIL PROTECTED]

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] header function

2001-08-21 Thread Christian Reiniger

On Tuesday 21 August 2001 16:53, Jay Paulson wrote:

 I have a slight problem.. I'm running php 4.0.6 on RedHat 7.1 and I run
 my script and it hit's:

 header(Location:index.php);

 well the thing is once it hits that line in my script and just fails,
 however i don't get any type of parse error the browser just says 404
 error page not found... could it be i forgot to add something when i
 configured and installed php on my machine?

(1) Add a space after the colon
(2) Location: should get a complete URL, i.e.
header (Location: http://your.server.us/index.php;);

 and have it hit the header() line and i get teh 404 page error.. (and

A 404 can't come from parse errors or something. It *does* redirect you, 
but doesn't find the target file - 404

-- 
Christian Reiniger
LGDC Webmaster (http://lgdc.sunsite.dk/)

Install once, run forever. Linux.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]