RE: [PHP] PHP redirect

2011-09-24 Thread Dajka Tamas
If $data['feed_link'] is extracted from $_POST, then it's already
urldecoded.

BTW, what's the problem? It's not redirecting you, or just redirecting you
to az unavailable/wrong page? ( most browsers change the  amp; in titlebar
to '', so you don't have to worry about that )

-Original Message-
From: muad shibani [mailto:muad.shib...@gmail.com] 
Sent: Saturday, September 24, 2011 12:36 PM
To: php-general@lists.php.net
Subject: [PHP] PHP redirect

when I try to go to a URL by using PHP header function so if the URL
contains  it converts it to amp; so the needed page will not
display correctly I tried to use:

 $url = urldecode($data['feed_link']);

 header ( Location: $url );

but I can't get it


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



Re: [PHP] PHP redirect

2011-09-24 Thread muad shibani
it redirecting me to  unavailable/wrong page, the data came from database
but each time it gives me amp; instead of 

On Sat, Sep 24, 2011 at 3:39 AM, Dajka Tamas vi...@vipernet.hu wrote:

 If $data['feed_link'] is extracted from $_POST, then it's already
 urldecoded.

 BTW, what's the problem? It's not redirecting you, or just redirecting you
 to az unavailable/wrong page? ( most browsers change the  amp; in titlebar
 to '', so you don't have to worry about that )

 -Original Message-
 From: muad shibani [mailto:muad.shib...@gmail.com]
 Sent: Saturday, September 24, 2011 12:36 PM
 To: php-general@lists.php.net
 Subject: [PHP] PHP redirect

 when I try to go to a URL by using PHP header function so if the URL
 contains  it converts it to amp; so the needed page will not
 display correctly I tried to use:

  $url = urldecode($data['feed_link']);

  header ( Location: $url );

 but I can't get it




RE: [PHP] PHP redirect

2011-09-24 Thread Dajka Tamas
Try header(Location: .html_entity_decode($data['feed_link']));

 

From: muad shibani [mailto:muad.shib...@gmail.com] 
Sent: Saturday, September 24, 2011 12:41 PM
To: Dajka Tamas
Cc: php-general@lists.php.net
Subject: Re: [PHP] PHP redirect

 

it redirecting me to  unavailable/wrong page, the data came from database
but each time it gives me amp; instead of 

On Sat, Sep 24, 2011 at 3:39 AM, Dajka Tamas vi...@vipernet.hu wrote:

If $data['feed_link'] is extracted from $_POST, then it's already
urldecoded.

BTW, what's the problem? It's not redirecting you, or just redirecting you
to az unavailable/wrong page? ( most browsers change the  amp; in titlebar
to '', so you don't have to worry about that )


-Original Message-
From: muad shibani [mailto:muad.shib...@gmail.com]
Sent: Saturday, September 24, 2011 12:36 PM
To: php-general@lists.php.net
Subject: [PHP] PHP redirect

when I try to go to a URL by using PHP header function so if the URL
contains  it converts it to amp; so the needed page will not
display correctly I tried to use:

 $url = urldecode($data['feed_link']);

 header ( Location: $url );

but I can't get it

 



Re: [PHP] PHP redirect

2011-09-24 Thread muad shibani
it works very well .. thanks a lot for you dajkta you saved my day .. thanks
a lot

On Sat, Sep 24, 2011 at 3:45 AM, Dajka Tamas vi...@vipernet.hu wrote:

 Try header(”Location: ”.html_entity_decode($data[’feed_link’]));

 ** **

 *From:* muad shibani [mailto:muad.shib...@gmail.com]
 *Sent:* Saturday, September 24, 2011 12:41 PM
 *To:* Dajka Tamas
 *Cc:* php-general@lists.php.net
 *Subject:* Re: [PHP] PHP redirect

 ** **

 it redirecting me to  unavailable/wrong page, the data came from database
 but each time it gives me amp; instead of 

 On Sat, Sep 24, 2011 at 3:39 AM, Dajka Tamas vi...@vipernet.hu wrote:***
 *

 If $data['feed_link'] is extracted from $_POST, then it's already
 urldecoded.

 BTW, what's the problem? It's not redirecting you, or just redirecting you
 to az unavailable/wrong page? ( most browsers change the  amp; in titlebar
 to '', so you don't have to worry about that )


 -Original Message-
 From: muad shibani [mailto:muad.shib...@gmail.com]
 Sent: Saturday, September 24, 2011 12:36 PM
 To: php-general@lists.php.net
 Subject: [PHP] PHP redirect

 when I try to go to a URL by using PHP header function so if the URL
 contains  it converts it to amp; so the needed page will not
 display correctly I tried to use:

  $url = urldecode($data['feed_link']);

  header ( Location: $url );

 but I can't get it

 ** **



Re: [PHP] PHP REDIRECT

2004-02-18 Thread Raditha Dissanayake
Hi Chris.
You have done a better job describing that situation than i did. Thank you.
best regards
raditha
Chris Shiflett wrote:

--- Raditha Dissanayake [EMAIL PROTECTED] wrote:
 

It's not often that i disagree with the other chris but one occaision 
where meta refresh turns out to be the only solution is when working 
with some payment gateways where instead of doing a simple old post to 
your return page they include it inside their own thank you page so the 
headers will not work.

Lame? well some of the best known gateways are doing it.
   

You're right, but I don't think this means that we must disagree. :-)

In my opinion, this simply falls into the narrow category for which the
http-equiv attribute was created. If you want to specify an HTTP header in
the content, it's your only option. This is such a case. Because the
payment processor is the one acting as the Web client, it is they who
receive your HTTP response. They only display the content of this response
to the end user, so any headers you set are probably discarded (or maybe
the payment processor is redirected?).
However, this has lead to people using this same approach in the 99% of
situations where it is not necessary. If the user's Web client is
receiving your HTTP response in its entirety (the usual situation), you
can set any HTTP header you want the right way.
I don't have the URL handy, but there is a site somewhere that has been
conducting extensive tests to determine which headers have good http-equiv
support among various browsers. While Refresh is pretty well supported,
 

--
Raditha Dissanayake.

http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload
Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader
Graphical User Inteface. Just 150 KB | with progress bar.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] PHP REDIRECT

2004-02-18 Thread Chris Shiflett
--- Raditha Dissanayake [EMAIL PROTECTED] wrote:
 You have done a better job describing that situation than i did. Thank
 you.

No problem. :-)

I found that URL I mentioned (with the browser tests). The author claims
that it's all being rewritten, but most of them are listed here:

http://www.hixie.ch/tests/tesremas/listsuites.pl?suite=WBT

The tests I was thinking about were this one on meta Refresh:

http://www.hixie.ch/tests/evil/mixed/refresh1.html

And this one on HTTP Refresh:

http://www.hixie.ch/tests/evil/mixed/refresh1.http.html

The results are here:

http://www.hixie.ch/tests/tesremas/listresults.pl

Chris

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

PHP Security - O'Reilly
 Coming mid-2004
HTTP Developer's Handbook - Sams
 http://httphandbook.org/
PHP Community Site
 http://phpcommunity.org/

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



Re: [PHP] PHP REDIRECT

2004-02-16 Thread Chris Shiflett
--- ajay [EMAIL PROTECTED] wrote:
 i'd like to redirect a person to another page but after a certain time
 interval has elapsed. this is because i have a generic error displaying
 page and i would like the person to go to this page, stay there for like
 10 seconds and then be redirected to the index page.
 
 i was using header(url) to redirect the user. but how do i get that to
 happen after a certain time interval.

Use the Refresh header:

header('Refresh: 10;URL=http://example.org/');

Hope that helps.

Chris

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

PHP Security - O'Reilly
 Coming mid-2004
HTTP Developer's Handbook - Sams
 http://httphandbook.org/
PHP Community Site
 http://phpcommunity.org/

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



RE: [PHP] PHP REDIRECT

2004-02-16 Thread Chris Shiflett
--- Chris [EMAIL PROTECTED] wrote:
 You can't view the page and have PHP redirect it. You would need to
 use a meta refresh tag or JavaScript.

I assume by meta refresh tag, you mean this:

meta http-equiv=refresh content=10;URL=http://example.org/;

What most people seem to not realize, is that the http-equiv attribute is
just a way to specify HTTP headers in a meta tag. This is handy when you
want to do so in static pages, but PHP has a more proper way to specify
headers:

http://www.php.net/header

This creates a real HTTP header, and there is no reason for any PHP
developer to use a meta tag for this purpose.

Hope that helps.

Chris

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

PHP Security - O'Reilly
 Coming mid-2004
HTTP Developer's Handbook - Sams
 http://httphandbook.org/
PHP Community Site
 http://phpcommunity.org/

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



Re: [PHP] PHP REDIRECT

2004-02-16 Thread Lowell Allen
 --- Chris [EMAIL PROTECTED] wrote:
 You can't view the page and have PHP redirect it. You would need to
 use a meta refresh tag or JavaScript.
 
 I assume by meta refresh tag, you mean this:
 
 meta http-equiv=refresh content=10;URL=http://example.org/;
 
 What most people seem to not realize, is that the http-equiv attribute is
 just a way to specify HTTP headers in a meta tag. This is handy when you
 want to do so in static pages, but PHP has a more proper way to specify
 headers:
 
 http://www.php.net/header
 
 This creates a real HTTP header, and there is no reason for any PHP
 developer to use a meta tag for this purpose.

Well, how about this situation as a reason:

You must do authorization, then force a file download, and you want to also
display a link to the file with the typical click the link below if the
download does not start automatically. I couldn't figure out how to display
a page (after authorization), then use the PHP header redirect to force the
download while keeping the same page display. However, using a meta refresh
to a script that forced the download (without producing any display) was an
easy solution.

Am I overlooking a better solution?

--
Lowell Allen

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



RE: [PHP] PHP REDIRECT

2004-02-16 Thread Chris
Heh, I was on my way to bed and didn't think about that. (And my 'answer'
was a bit abrupt as well)

Ah well, booboo's happen. I've always been an advocater of doing things the
*right way*, and in this case, the Refresh header would seem to be the right
way.

JUST SAY NO to meta http-equiv tags! :)

Chris (the other one)


 -Original Message-
 From: Chris Shiflett [mailto:[EMAIL PROTECTED]
 Sent: Monday, February 16, 2004 8:51 AM
 To: Chris; ajay; [EMAIL PROTECTED]
 Subject: RE: [PHP] PHP REDIRECT


 --- Chris [EMAIL PROTECTED] wrote:
  You can't view the page and have PHP redirect it. You would need to
  use a meta refresh tag or JavaScript.

 I assume by meta refresh tag, you mean this:

 meta http-equiv=refresh content=10;URL=http://example.org/;

 What most people seem to not realize, is that the http-equiv attribute is
 just a way to specify HTTP headers in a meta tag. This is handy when you
 want to do so in static pages, but PHP has a more proper way to specify
 headers:

 http://www.php.net/header

 This creates a real HTTP header, and there is no reason for any PHP
 developer to use a meta tag for this purpose.

 Hope that helps.

 Chris

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

 PHP Security - O'Reilly
  Coming mid-2004
 HTTP Developer's Handbook - Sams
  http://httphandbook.org/
 PHP Community Site
  http://phpcommunity.org/

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



Re: [PHP] PHP REDIRECT

2004-02-16 Thread Stuart
Lowell Allen wrote:
You must do authorization, then force a file download, and you want to also
display a link to the file with the typical click the link below if the
download does not start automatically. I couldn't figure out how to display
a page (after authorization), then use the PHP header redirect to force the
download while keeping the same page display. However, using a meta refresh
to a script that forced the download (without producing any display) was an
easy solution.
You're missing the point of what Chris is saying.

meta http-equiv=refresh content=10;URL=http://example.org/;

and

header('Refresh: 10;URL=http://example.org/');

are both doing the same thing just in different ways. The http-equiv 
meta tag was created to allow static HTML pages to specify HTTP headers. 
With PHP you don't need to use that, you can actually send the browser 
the actual header. IMHO it's a better way to do it, but I can't actually 
see a reason why I feel that way.

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


Re: [PHP] PHP REDIRECT

2004-02-16 Thread Raditha Dissanayake
Hi Chris and Chris and et al.

It's not often that i disagree with the other chris but one occaision 
where meta refresh turns out to be the only solution is when working 
with some payment gateways where instead of doing a simple old post to 
your return page they include it inside their own thank you page so the 
headers will not work.

Lame? well some of the best known gateways are doing it.



Chris wrote:

Heh, I was on my way to bed and didn't think about that. (And my 'answer'
was a bit abrupt as well)
Ah well, booboo's happen. I've always been an advocater of doing things the
*right way*, and in this case, the Refresh header would seem to be the right
way.
JUST SAY NO to meta http-equiv tags! :)

Chris (the other one)

 

-Original Message-
From: Chris Shiflett [mailto:[EMAIL PROTECTED]


--
Raditha Dissanayake.

http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload
Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader
Graphical User Inteface. Just 150 KB | with progress bar.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] PHP REDIRECT

2004-02-16 Thread Chris
I'm not quite following you here. I understand that no solution is always
the correct one. Everything has exceptions...

If the page you want to redirect from has PHP, just dont' use the meta
http-equiv=..., set the header with PHP instead. As far as I can see that
should always be possible.

 -Original Message-
 From: Raditha Dissanayake [mailto:[EMAIL PROTECTED]
 Sent: Monday, February 16, 2004 10:07 AM
 To: [EMAIL PROTECTED]
 Subject: Re: [PHP] PHP REDIRECT


 Hi Chris and Chris and et al.

 It's not often that i disagree with the other chris but one occaision
 where meta refresh turns out to be the only solution is when working
 with some payment gateways where instead of doing a simple old post to
 your return page they include it inside their own thank you page so the
 headers will not work.

 Lame? well some of the best known gateways are doing it.



 Chris wrote:

 Heh, I was on my way to bed and didn't think about that. (And my 'answer'
 was a bit abrupt as well)
 
 Ah well, booboo's happen. I've always been an advocater of doing
 things the
 *right way*, and in this case, the Refresh header would seem to
 be the right
 way.
 
 JUST SAY NO to meta http-equiv tags! :)
 
 Chris (the other one)
 
 
 
 
 -Original Message-
 From: Chris Shiflett [mailto:[EMAIL PROTECTED]
 


 --
 Raditha Dissanayake.
 
 http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload
 Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader
 Graphical User Inteface. Just 150 KB | with progress bar.

 --
 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] PHP REDIRECT

2004-02-16 Thread Raditha Dissanayake
Nopes,

What happens is that the gateways include your page instead of posting 
to your page.

For example if you visit a site that uses worldpay as a payment service 
provider you will see their banner on the thank you page after
payment is made.  In such cases the header functions will not work 
because it's too late to send them.

hope this is a better explaination.

best regards
raditha
Chris wrote:

I'm not quite following you here. I understand that no solution is always
the correct one. Everything has exceptions...
If the page you want to redirect from has PHP, just dont' use the meta
http-equiv=..., set the header with PHP instead. As far as I can see that
should always be possible.
 

-Original Message-
From: Raditha Dissanayake [mailto:[EMAIL PROTECTED]
Sent: Monday, February 16, 2004 10:07 AM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] PHP REDIRECT
Hi Chris and Chris and et al.

It's not often that i disagree with the other chris but one occaision
where meta refresh turns out to be the only solution is when working
with some payment gateways where instead of doing a simple old post to
your return page they include it inside their own thank you page so the
headers will not work.
Lame? well some of the best known gateways are doing it.



Chris wrote:

   

Heh, I was on my way to bed and didn't think about that. (And my 'answer'
was a bit abrupt as well)
Ah well, booboo's happen. I've always been an advocater of doing
 

things the
   

*right way*, and in this case, the Refresh header would seem to
 

be the right
   

way.

JUST SAY NO to meta http-equiv tags! :)

Chris (the other one)



 

-Original Message-
From: Chris Shiflett [mailto:[EMAIL PROTECTED]
   

--
Raditha Dissanayake.

http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload
Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader
Graphical User Inteface. Just 150 KB | with progress bar.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
   

 



--
Raditha Dissanayake.

http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload
Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader
Graphical User Inteface. Just 150 KB | with progress bar.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] PHP REDIRECT

2004-02-16 Thread Chris
Ahh, ok, I understand. Thanks

Chris

 -Original Message-
 From: Raditha Dissanayake [mailto:[EMAIL PROTECTED]
 Sent: Monday, February 16, 2004 10:51 AM
 To: Chris; [EMAIL PROTECTED]
 Subject: Re: [PHP] PHP REDIRECT


 Nopes,

 What happens is that the gateways include your page instead of posting
 to your page.

 For example if you visit a site that uses worldpay as a payment service
 provider you will see their banner on the thank you page after
 payment is made.  In such cases the header functions will not work
 because it's too late to send them.

 hope this is a better explaination.

 best regards
 raditha


 Chris wrote:

 I'm not quite following you here. I understand that no solution is always
 the correct one. Everything has exceptions...
 
 If the page you want to redirect from has PHP, just dont' use the meta
 http-equiv=..., set the header with PHP instead. As far as I
 can see that
 should always be possible.
 
 
 
 -Original Message-
 From: Raditha Dissanayake [mailto:[EMAIL PROTECTED]
 Sent: Monday, February 16, 2004 10:07 AM
 To: [EMAIL PROTECTED]
 Subject: Re: [PHP] PHP REDIRECT
 
 
 Hi Chris and Chris and et al.
 
 It's not often that i disagree with the other chris but one occaision
 where meta refresh turns out to be the only solution is when working
 with some payment gateways where instead of doing a simple old post to
 your return page they include it inside their own thank you page so the
 headers will not work.
 
 Lame? well some of the best known gateways are doing it.
 
 
 
 Chris wrote:
 
 
 
 Heh, I was on my way to bed and didn't think about that. (And
 my 'answer'
 was a bit abrupt as well)
 
 Ah well, booboo's happen. I've always been an advocater of doing
 
 
 things the
 
 
 *right way*, and in this case, the Refresh header would seem to
 
 
 be the right
 
 
 way.
 
 JUST SAY NO to meta http-equiv tags! :)
 
 Chris (the other one)
 
 
 
 
 
 
 -Original Message-
 From: Chris Shiflett [mailto:[EMAIL PROTECTED]
 
 
 
 --
 Raditha Dissanayake.
 
 http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload
 Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader
 Graphical User Inteface. Just 150 KB | with progress bar.
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 
 
 


 --
 Raditha Dissanayake.
 
 http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload
 Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader
 Graphical User Inteface. Just 150 KB | with progress bar.

 --
 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] PHP REDIRECT

2004-02-16 Thread Chris Shiflett
--- Raditha Dissanayake [EMAIL PROTECTED] wrote:
 It's not often that i disagree with the other chris but one occaision 
 where meta refresh turns out to be the only solution is when working 
 with some payment gateways where instead of doing a simple old post to 
 your return page they include it inside their own thank you page so the 
 headers will not work.
 
 Lame? well some of the best known gateways are doing it.

You're right, but I don't think this means that we must disagree. :-)

In my opinion, this simply falls into the narrow category for which the
http-equiv attribute was created. If you want to specify an HTTP header in
the content, it's your only option. This is such a case. Because the
payment processor is the one acting as the Web client, it is they who
receive your HTTP response. They only display the content of this response
to the end user, so any headers you set are probably discarded (or maybe
the payment processor is redirected?).

However, this has lead to people using this same approach in the 99% of
situations where it is not necessary. If the user's Web client is
receiving your HTTP response in its entirety (the usual situation), you
can set any HTTP header you want the right way.

I don't have the URL handy, but there is a site somewhere that has been
conducting extensive tests to determine which headers have good http-equiv
support among various browsers. While Refresh is pretty well supported,
other headers are not, and the most consistent support for any header
definitely lies with it being sent within the protocol where it is
intended.

Hope that helps.

Chris

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

PHP Security - O'Reilly
 Coming mid-2004
HTTP Developer's Handbook - Sams
 http://httphandbook.org/
PHP Community Site
 http://phpcommunity.org/

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



Re: [PHP] PHP REDIRECT

2004-02-16 Thread Chris Shiflett
--- Raditha Dissanayake [EMAIL PROTECTED] wrote:
 What happens is that the gateways include your page instead of posting 
 to your page.
 
 For example if you visit a site that uses worldpay as a payment service 
 provider you will see their banner on the thank you page after
 payment is made.  In such cases the header functions will not work 
 because it's too late to send them.

In case this wasn't clear, I can elaborate...

Let's use some fake domains:

1. payment.org - the payment processor
2. yoursite.org - your Web site

As a user, I want to buy something from yoursite.org, and you use a
payment processor for this purpose. I click a link from your site to
theirs, so http://payment.org/... is displayed in my browser. I enter some
credit card ifnormation, and click the button, and this happens:

1. payment.org verifies my information, charges my credit card, etc.
2. payment.org sends an HTTP request (typically a POST) to a URL at
yoursite.org, where you receive payment notifications. You make the output
of this page appropriate for the end user.
3. payment.org displays the output of your page to the user.

So, after I (the user) click the submit button, I see a thank you page
of some sort that was generated by yoursite.org. However, my browser still
shows that I am on payment.org's Web site.

To recap, payment.org is playing the role of a Web client (browser, for
example) when communicating with yoursite.org's payment notification page.
It uses the output of this page (the HTTP content) to use when it
communicates back to the user, at which time it is playing the more
typical role of a Web server.

Hope that helps.

Chris

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

PHP Security - O'Reilly
 Coming mid-2004
HTTP Developer's Handbook - Sams
 http://httphandbook.org/
PHP Community Site
 http://phpcommunity.org/

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



Re: [PHP] PHP REDIRECT

2004-02-16 Thread Chris Shiflett
--- Lowell Allen [EMAIL PROTECTED] wrote:
 You must do authorization, then force a file download, and you want to
 also display a link to the file with the typical click the link below
 if the download does not start automatically. I couldn't figure out how
 to display a page (after authorization), then use the PHP header
 redirect to force the download while keeping the same page display.
 However, using a meta refresh to a script that forced the download
 (without producing any display) was an easy solution.
 
 Am I overlooking a better solution?

I'm not sure. To be clear, you're saying that the following two things do
not behave the same for you:

header('Refresh: ...');

meta http-equiv=Refresh ...

Is this right? I suspect that you might be comparing these instead:

header('Location: ...');

meta http-equiv=Refresh ...

If this is the case, the difference in behavior is due to:

1. Different headers.
2. Different response status codes (setting a Location header also changes
the status code from 200 to 302).

If this is not the case, I'm honestly not sure why the behavior would be
any different, since browsers that support http-equiv are supposed to
interpret these exactly as if they were real headers.

Hope that helps.

Chris

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

PHP Security - O'Reilly
 Coming mid-2004
HTTP Developer's Handbook - Sams
 http://httphandbook.org/
PHP Community Site
 http://phpcommunity.org/

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



Re: [PHP] PHP REDIRECT

2004-02-16 Thread Lowell Allen
 --- Lowell Allen [EMAIL PROTECTED] wrote:

[snip]

 Am I overlooking a better solution?
 
 I'm not sure. To be clear, you're saying that the following two things do
 not behave the same for you:
 
 header('Refresh: ...');
 
 meta http-equiv=Refresh ...
 
 Is this right? I suspect that you might be comparing these instead:
 
 header('Location: ...');
 
 meta http-equiv=Refresh ...

Your suspicion is correct, as pointed out earlier by Stuart. Thanks to both
of you for the explanation, and sorry for the confusion.

--
Lowell Allen

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



Re: [PHP] PHP REDIRECT

2004-02-15 Thread Binay
use sleep(no of seconds)..

Cheers
Binay
- Original Message -
From: ajay [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, February 16, 2004 9:54 AM
Subject: [PHP] PHP REDIRECT


 hi!

 i'd like to redirect a person to another page but after a certain time
interval
 has elapsed. this is because i have a generic error displaying page and i
would
 like the person to go to this page, stay there for like 10 seconds and
then be
 redirected to the index page.

 i was using header(url) to redirect the user.
 but how do i get that to happen after a certain time interval.

 thanks

 regards

 --
 ajay
 ---
 Who Dares Wins

 -
 This mail sent through IMP: www-mail.usyd.edu.au

 --
 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] PHP REDIRECT

2004-02-15 Thread Chris
You can't view the page and have PHP redirect it. You would need to use a
meta refresh tag or JavaScript.

Chris

 -Original Message-
 From: ajay [mailto:[EMAIL PROTECTED]
 Sent: Sunday, February 15, 2004 8:25 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP] PHP REDIRECT


 hi!

 i'd like to redirect a person to another page but after a certain
 time interval
 has elapsed. this is because i have a generic error displaying
 page and i would
 like the person to go to this page, stay there for like 10
 seconds and then be
 redirected to the index page.

 i was using header(url) to redirect the user.
 but how do i get that to happen after a certain time interval.

 thanks

 regards

 --
 ajay
 ---
 Who Dares Wins

 -
 This mail sent through IMP: www-mail.usyd.edu.au

 --
 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] PHP REDIRECT

2004-02-15 Thread John Nichel
ajay wrote:
hi!

i'd like to redirect a person to another page but after a certain time interval
has elapsed. this is because i have a generic error displaying page and i would
like the person to go to this page, stay there for like 10 seconds and then be
redirected to the index page.
i was using header(url) to redirect the user.
but how do i get that to happen after a certain time interval.
thanks

regards

You can sleep() the script, but no output will be sent to the browser. 
If you want them to view the 'error' page, ie output to the browser for 
the user to read, you cannot use php to redirect them after that.  Use 
JavaScript.  PHP == ServerSide, JavaScript == ClientSide.

--
By-Tor.com
It's all about the Rush
http://www.by-tor.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] PHP redirect

2003-05-29 Thread Awlad Hussain
Try this
header(LOCATION: page2go.php);

- Original Message - 
From: Angelo Zanetti [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, May 29, 2003 9:46 AM
Subject: [PHP] PHP redirect


Hi guys what is the function in PHP for directing a php page??

thanx in advance
Angelo



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



RE: [PHP] PHP redirect

2003-05-29 Thread Ralph
Use the header function:

http://www.php.net/manual/en/function.header.php


-Original Message-
From: Angelo Zanetti [mailto:[EMAIL PROTECTED] 
Sent: Thursday, May 29, 2003 1:46 AM
To: [EMAIL PROTECTED]
Subject: [PHP] PHP redirect

Hi guys what is the function in PHP for directing a php page??

thanx in advance
Angelo




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



Re: [PHP] PHP redirect

2003-05-29 Thread David Grant
Awlad Hussain wrote:
Try this
header(LOCATION: page2go.php);
I'm not normally so pedantic, however, the HTTP specification defines 
the above header as Location, not LOCATION.  It might also be an 
idea to give the filename as a path relative to the root directory, e.g.

header(Location: /foo/bar/index.php);

This should ensure compatability between user agents.

Regards,

David

--
David Grant
Web Developer
[EMAIL PROTECTED]
http://www.wiredmedia.co.uk
Tel: 0117 930 4365, Fax: 0870 169 7625

Wired Media Ltd
Registered Office: 43 Royal Park, Bristol, BS8 3AN
Studio: Whittakers House, 32 - 34 Hotwell Road, Bristol, BS8 4UD
Company registration number: 4016744

**
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.
**

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


Re: [PHP] PHP redirect

2003-05-29 Thread Leif K-Brooks
Actually, the standards require an absolute URL, e.g.

header(Location: http://foo.com/bar/baz/something.php;);

David Grant wrote:

It might also be an idea to give the filename as a path relative to 
the root directory, e.g.

header(Location: /foo/bar/index.php);


--
The above message is encrypted with double rot13 encoding.  Any unauthorized attempt 
to decrypt it will be prosecuted to the full extent of the law.


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


RE: [PHP] php redirect

2002-07-26 Thread Jay Blanchard

[snip]
I have a redirect i would like to do using php. It will go something like 
this
if (mysql_db_query ($dbname, $query, $link)) {
  {redirect would go here}
} else {
 {a different location on this redirect here}

How can i accomplish this? i just do not know php well enough to code the 
redirect. Please help. Thanks in advance and for all of the past help.
[/snip]

Use the header() function

http://www.php.net/manual/en/function.header.php

HTH!

Jay

My reality check bounced 

*
* Want to meet other PHP developers *
* in your area? Check out:  *
* http://php.meetup.com/*
* No developer is an island ... *
*


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




Re: [PHP] php redirect

2002-07-26 Thread Tech Support

I know what you mean about everything being M$.

I'm a die hard GNU fan and therefore hate everything M$, but I can think of
more than one occasion where that attitude cost me some money. I somehow
still believe that if I stick to my beliefs and maybe try to convert some M$
people to host their sites/apps on *nix we will eventually take down the
evil Redmond devil and open source software will rule the world.
/dream

The box read, 'windows 9x or better' so I installed Linux!
hehe

Jim Grill
Support
Web-1 Hosting
http://www.web-1hosting.net
- Original Message -
From: Justin French [EMAIL PROTECTED]
To: David Buerer [EMAIL PROTECTED]; 'Jay Blanchard'
[EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Friday, July 26, 2002 11:20 AM
Subject: Re: [PHP] php redirect


 Well the current web-dev environment here in Melbourne, Australia is VERY
 Microsoft oriented at the moment.  I'm happily freelancing, but have been
 keeping my eye on the big job websites, just in case that perfect job
comes
 up.

 I get emailed about a few jobs every day, and 90% of them are for a M$
 environment.

 I guess that would be some form of motivational tool for someone to learn
 ASP -- if there aren't any PHP jobs, then what's the point in knowing PHP?


 I'm sure it's just a temporary problem here at the moment, and it'll sort
 itself out... but if I ever get a week without much work, I'll try and
learn
 a bit of ASP, just so that when a client/employer ask me to use ASP, I can
 fumble through it, or better still, recommend PHP as an educated
 alternative.


 Justin French




 on 27/07/02 1:14 AM, David Buerer ([EMAIL PROTECTED]) wrote:

  What's ASP
 
  I don't know if and haven't learned it so it couldn't be.  After all,
how
  many programming languages does one need to know??
 
 
  -Original Message-
  From: Jay Blanchard [mailto:[EMAIL PROTECTED]]
  Sent: Friday, July 26, 2002 8:27 AM
  To: 'David Buerer'; [EMAIL PROTECTED]
  Subject: RE: [PHP] php redirect
 
 
  [snip]
  This is the only way I've figured out how to do it.  It seems to work
really
  well.
 
  if (mysql_db_query ($dbname, $query, $link)) {
  gotourl(myurl1);}
  } else {
  gorourl(myurl2);}
 
  function gotourl(myurl)
  {
  echo SCRIPT language=javascript;
  echo   window.location=$myurl;;
  echo /SCRIPT\n;
  }
  [/snip]
 
  Isn't this ASP? ;^]
 
  Jay
 
  My other car is a broom
 
  *
  * Want to meet other PHP developers *
  * in your area? Check out:  *
  * http://php.meetup.com/*
  * No developer is an island ... *
  *
 
 


 --
 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] php redirect

2002-07-26 Thread Martin Clifford

Learning about HTTP protocol helps a LOT with understanding headers.  Basically, the 
headers are generated by the server to tell the client (browser) what to do.  If you 
send ANYTHING (even a hard return) before the header function is invoked then you will 
get this error.  In essence, if you are going to use the header() function without 
output buffering, then it should be just like this:

--top of text editor
?php
header(Location: blah.php);
?
-- End of text editor

Martin Clifford
Homepage: http://www.completesource.net
Developer's Forums: http://www.completesource.net/forums/


 Tyler Durdin [EMAIL PROTECTED] 07/26/02 11:21AM 

I already tried that and i got an error that said Cannot add header 
information - headers already sent by (another snippet of code I have in the 
page.

Use the header() function

http://www.php.net/manual/en/function.header.php 

*




_
MSN Photos is the easiest way to share and print your photos: 
http://photos.msn.com/support/worldwide.aspx 


-- 
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] php redirect

2002-07-26 Thread David Buerer

I here ya' there Martin.

ASP is about next on my list. I'm just trying to get javascript and PHP
under my belt a little better firstwell ok, I'm waiting for my next
paying client. I've found that you do have to use what you know to know
whatever you need to do.  I couldn't live without Javascript+PHP+SQL when it
comes to site design.  ASP is next on my list.

-Original Message-
From: Martin Clifford [mailto:[EMAIL PROTECTED]] 
Sent: Friday, July 26, 2002 8:41 AM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED];
[EMAIL PROTECTED]
Subject: RE: [PHP] php redirect


I don't know if and haven't learned it so it couldn't be.  After all, 
how
many programming languages does one need to know??

Heh heh heh.  Jack of all trades, master of some.  That's how I look at it.
I'd say you need to know a little of everything.  I know (X)HTML, CSS-1-2-P,
JS, PHP, SQL, etc.  The list just goes on.  And the thing is, I use ALL of
them ALL the time ;o)


-Original Message-
From: Jay Blanchard [mailto:[EMAIL PROTECTED]] 
Sent: Friday, July 26, 2002 8:27 AM
To: 'David Buerer'; [EMAIL PROTECTED] 
Subject: RE: [PHP] php redirect


[snip]
This is the only way I've figured out how to do it.  It seems to work really
well.

if (mysql_db_query ($dbname, $query, $link)) {
  gotourl(myurl1);}
} else {
 gorourl(myurl2);}

function gotourl(myurl)
{
  echo SCRIPT language=javascript;
  echo   window.location=$myurl;;
  echo /SCRIPT\n;
}
[/snip]

Isn't this ASP? ;^]

Jay

My other car is a broom

*
* Want to meet other PHP developers *
* in your area? Check out:  *
* http://php.meetup.com/*
* No developer is an island ... *
*


Martin Clifford
Homepage: http://www.completesource.net
Developer's Forums: http://www.completesource.net/forums/




RE: [PHP] php redirect

2002-07-26 Thread Tyler Durdin


I already tried that and i got an error that said Cannot add header 
information - headers already sent by (another snippet of code I have in the 
page.

Use the header() function

http://www.php.net/manual/en/function.header.php

*




_
MSN Photos is the easiest way to share and print your photos: 
http://photos.msn.com/support/worldwide.aspx


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




RE: [PHP] php redirect

2002-07-26 Thread Jay Blanchard

[snip]
Learning about HTTP protocol helps a LOT with understanding headers.
Basically, the headers are generated by the server to tell the client
(browser) what to do.  If you send ANYTHING (even a hard return) before the
header function is invoked then you will get this error.  In essence, if you
are going to use the header() function without output buffering, then it
should be just like this:
[/snip]

As said before you can use Output Buffering to prevent this;

http://www.php.net/manual/en/function.ob-start.php

HTH!

Jay

p.s. Martin, did you figure out how to do the random quote mail tag? Maybe
we should have a contest

Keep the Earth clean.it's not Uranus!

*
* Want to meet other PHP developers *
* in your area? Check out:  *
* http://php.meetup.com/*
* No developer is an island ... *
*



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




RE: [PHP] php redirect

2002-07-26 Thread David Buerer

What's ASP

I don't know if and haven't learned it so it couldn't be.  After all, how
many programming languages does one need to know??


-Original Message-
From: Jay Blanchard [mailto:[EMAIL PROTECTED]] 
Sent: Friday, July 26, 2002 8:27 AM
To: 'David Buerer'; [EMAIL PROTECTED]
Subject: RE: [PHP] php redirect


[snip]
This is the only way I've figured out how to do it.  It seems to work really
well.

if (mysql_db_query ($dbname, $query, $link)) {
  gotourl(myurl1);}
} else {
 gorourl(myurl2);}

function gotourl(myurl)
{
  echo SCRIPT language=javascript;
  echo   window.location=$myurl;;
  echo /SCRIPT\n;
}
[/snip]

Isn't this ASP? ;^]

Jay

My other car is a broom

*
* Want to meet other PHP developers *
* in your area? Check out:  *
* http://php.meetup.com/*
* No developer is an island ... *
*




[PHP] [Getting OT] Re: [PHP] php redirect

2002-07-26 Thread Chris Garaffa

On Friday, July 26, 2002, at 11:32 AM, David Buerer wrote:
 ASP is about next on my list. I'm just trying to get javascript and PHP
 under my belt a little better firstwell ok, I'm waiting for my next
 paying client. I've found that you do have to use what you know to know
 whatever you need to do.  I couldn't live without Javascript+PHP+SQL 
 when it
 comes to site design.  ASP is next on my list.

Good luck. I had a summer job once (would've been longer if my boss 
didn't spend all the company money and had to shut the company down) 
where we used ASP for all our dynamic pages. It's a joke. You go (back) 
to using dim statements and VBScript! Of course you can use JScript, but 
that's even more difficult at times. Connecting to a server? There are 
methods, but error reporting is not ASP's best feature.
IMHO, stick with PHP, maybe a bit of Perl, but anything you can do in 
ASP you can do better in PHP.

c.


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




Re: [PHP] php redirect

2002-07-26 Thread Bob Lockie


Well the current web-dev environment here in Melbourne, Australia is VERY
Microsoft oriented at the moment.  I'm happily freelancing, but have been
keeping my eye on the big job websites, just in case that perfect job comes
up.

I get emailed about a few jobs every day, and 90% of them are for a M$
environment.

I guess that would be some form of motivational tool for someone to learn
ASP -- if there aren't any PHP jobs, then what's the point in knowing PHP?


I'm sure it's just a temporary problem here at the moment, and it'll sort
itself out... but if I ever get a week without much work, I'll try and learn
a bit of ASP, just so that when a client/employer ask me to use ASP, I can
fumble through it, or better still, recommend PHP as an educated
alternative.


Justin French




on 27/07/02 1:14 AM, David Buerer ([EMAIL PROTECTED]) wrote:

 What's ASP
 
 I don't know if and haven't learned it so it couldn't be.  After all, how
 many programming languages does one need to know??
 
 
 -Original Message-
 From: Jay Blanchard [mailto:[EMAIL PROTECTED]]
 Sent: Friday, July 26, 2002 8:27 AM
 To: 'David Buerer'; [EMAIL PROTECTED]
 Subject: RE: [PHP] php redirect
 
 
 [snip]
 This is the only way I've figured out how to do it.  It seems to work really
 well.
 
 if (mysql_db_query ($dbname, $query, $link)) {
 gotourl(myurl1);}
 } else {
 gorourl(myurl2);}
 
 function gotourl(myurl)
 {
 echo SCRIPT language=javascript;
 echo   window.location=$myurl;;
 echo /SCRIPT\n;
 }
 [/snip]
 
 Isn't this ASP? ;^]
 
 Jay
 
 My other car is a broom

A lot of places in Canada use MS based web servers and I think PHP is mostly 
Unix-centric. :-)
A lot of applications are only for Windows so a lot of places make the choice to go 
for Windows web servers.
They end up buying an MS solution and most everyone who sells MS solutions is pushing 
ASP.
I'm not an integrator but this is the way it seems to me.




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




RE: [PHP] php redirect

2002-07-26 Thread Jay Blanchard

[snip]
What's ASP

I don't know if and haven't learned it so it couldn't be.  After all, how
many programming languages does one need to know??
[/snip]

a. I should have looked closer, you used JavaScript.
b. window.location=$myurl is used in ASP (Active Server Pages - M$), more
specifically VBScript (because ASP can use 3 or 4 different languages, so M$
says)

Jay

My Karma ran over my Dogma

*
* Want to meet other PHP developers *
* in your area? Check out:  *
* http://php.meetup.com/*
* No developer is an island ... *
*



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




Re: [PHP] PHP Redirect / header(location: )

2001-11-09 Thread Bas Jobsen

 Am I doing something wrong?  Thank you.
You may print nothing before the redirect header!
?
echo hello;
header(Location: go);
exit;
#wrong!
?

?
?
header(Location: go);
exit;
echo hello;
#oke, but hello isn't print
?
?
- Original Message - 
From: phantom [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, November 09, 2001 10:01 AM
Subject: [PHP] PHP Redirect / header(location: )


 I am trying to set up a redirect scirpt that in ASP was
 response.redirect(escape(newpage.asp)).
 
 I tried in PHP  header(location: newpage.php)
 
 but all i got was an error message saying that my header content had
 already been sent.  This PHP script was above the html script.
 
 Am I doing something wrong?  Thank you.
 
 
 -- 
 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] PHP Redirect / header(location: )

2001-11-09 Thread Scott Houseman

Make sure that there is no output from your PHP script - or any HTML code
whatsoever - before you call the header function.
Cheers
Scott
- Original Message -
From: phantom [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, November 09, 2001 11:01 AM
Subject: [PHP] PHP Redirect / header(location: )


 I am trying to set up a redirect scirpt that in ASP was
 response.redirect(escape(newpage.asp)).

 I tried in PHP  header(location: newpage.php)

 but all i got was an error message saying that my header content had
 already been sent.  This PHP script was above the html script.

 Am I doing something wrong?  Thank you.


 --
 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] PHP Redirect in the middle of code?

2001-09-10 Thread George Pitcher

Andrew,

I am in a similar position witha Lasso site, which I am considering php-ing.
I need to do conditional redirects.

George P, Edinburgh

- Original Message -
From: Andrew Penniman [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, September 10, 2001 3:37 PM
Subject: [PHP] PHP Redirect in the middle of code?


 I am trying to figure out how to use PHP to redirect the user to a new
 location *after* processing and most likely outputting a bunch of code.
 Because this redirection would happen late in the game I can't use
 header(Location: .$redirect_to);

 I come from a ColdFusion background and am used to CFAS' cflocation
 tag.  Does PHP have an equivalent function?

 I am really hoping not to use JavaScript, I want this redirection to
 happen at the server and not the client.

 --
 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]


_
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


-- 
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] PHP Redirect in the middle of code?

2001-09-10 Thread Robin Vickery

[EMAIL PROTECTED] (George Pitcher) writes:

 Andrew,
 
 I am in a similar position witha Lasso site, which I am considering php-ing.
 I need to do conditional redirects.
 
 George P, Edinburgh
 
 - Original Message -
 From: Andrew Penniman [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Monday, September 10, 2001 3:37 PM
 Subject: [PHP] PHP Redirect in the middle of code?
 
 
  I am trying to figure out how to use PHP to redirect the user to a new
  location *after* processing and most likely outputting a bunch of code.
  Because this redirection would happen late in the game I can't use
  header(Location: .$redirect_to);

You should probably look at ouput buffering; the php manual has a section
on the subject at http://uk.php.net/manual/en/ref.outcontrol.php and Zeev
Suraski wrote an article at Zend http://zend.com/zend/art/buffering.php

  -robin

-- 
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] PHP Redirect in the middle of code?

2001-09-10 Thread Steve Edberg

Right off the top of my head, you have three options that I can see:

(1) Rewrite the code to avoid any output before the redirect.

(2) Use output buffering (available only in PHP4). I haven't used 
this, but check out

http://www.php.net/manual/en/ref.outcontrol.php

(3) Use a META REFRESH tag. For example:

META HTTP-EQUIV=refresh CONTENT=1;page.php

where 1 is the time (in seconds) before you want the redirect, and 
'page.php' is where you want the redirect to. Of course, this tag 
needs to be in the HEAD section, so it might not help you much.

As far as I know, though, cold fusion's cflocation tag only works 
because CF does output buffering implicitly. So, I'd guess you need 
to do option (2).

-steve



At 10:37 AM -0400 9/10/01, Andrew Penniman wrote:
I am trying to figure out how to use PHP to redirect the user to a new
location *after* processing and most likely outputting a bunch of code.
Because this redirection would happen late in the game I can't use
header(Location: .$redirect_to);

I come from a ColdFusion background and am used to CFAS' cflocation
tag.  Does PHP have an equivalent function?

I am really hoping not to use JavaScript, I want this redirection to
happen at the server and not the client.


-- 
+ Open source questions? +
| Steve Edberg   University of California, Davis |
| [EMAIL PROTECTED]   Computer Consultant |
| http://aesric.ucdavis.edu/  http://pgfsun.ucdavis.edu/ |
+--- http://pgfsun.ucdavis.edu/open-source-tools.html ---+

-- 
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] PHP Redirect in the middle of code?

2001-09-10 Thread Jason Brooke

 Right off the top of my head, you have three options that I can see:
 
 (1) Rewrite the code to avoid any output before the redirect.

I'd recommend this one myself 

jason 




-- 
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] PHP Redirect in the middle of code?

2001-09-10 Thread Ken

At 08:11 AM 9/10/01 -0700, Steve Edberg wrote:
Right off the top of my head, you have three options that I can see:
(3) Use a META REFRESH tag. For example:

 META HTTP-EQUIV=refresh CONTENT=1;page.php

where 1 is the time (in seconds) before you want the redirect, and 'page.php' is 
where you want the redirect to. Of course, this tag needs to be in the HEAD 
section, so it might not help you much.

Not necessarily true, the head part.  My application outputs a meta ...refresh... 
line really late in the HTML document - definitely inside the body section - and the 
refresh seems to be working for all.

- Ken
[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] PHP Redirect in the middle of code?

2001-09-10 Thread Philip Olson


On Tue, 11 Sep 2001, Jason Brooke wrote:

  Right off the top of my head, you have three options that I can see:
  
  (1) Rewrite the code to avoid any output before the redirect.
 
 I'd recommend this one myself 

Me too, I can't think of a valid reason to use a Location header while
having output also as the user will only have about .0002 seconds to
read the output before being redirected.

  if ($foo == 'example') {  // I'm not output

header('Location: http://www.example.com/');
exit;
  }

is perfectly valid.  Now, why would someone need to do :

  if ($foo == 'example') {

echo 'Hope you find example.com pleasing, have fun!';

header('Location: http://www.example.com/');
exit;
  }

If such an announcement is needed, using html Meta Refresh tag works as
one can also implement the delay (some of our users are slow readers :).

Also, headers_sent() can be useful.  I'd personally avoid output buffering
for this.

Regards,
Philip Olson

 
 jason 
 
 
 
 
 -- 
 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] PHP Redirect in the middle of code?

2001-09-10 Thread Steve Edberg

I learn something every day, here :)

According to my McGraw-Hill HTML Programmer's Reference [please, no 
messages about HTML not being 'programming'!], the META tag _should_ 
only occur in the HEAD container. Of course, we all know how 
closely browsers adhere to the HTML specs ;P

-steve


At 1:00 PM -0400 9/10/01, Ken wrote:
At 08:11 AM 9/10/01 -0700, Steve Edberg wrote:
Right off the top of my head, you have three options that I can see:
(3) Use a META REFRESH tag. For example:

  META HTTP-EQUIV=refresh CONTENT=1;page.php

where 1 is the time (in seconds) before you want the redirect, and 
'page.php' is where you want the redirect to. Of course, this tag 
needs to be in the HEAD section, so it might not help you much.

Not necessarily true, the head part.  My application outputs a 
meta ...refresh... line really late in the HTML document - 
definitely inside the body section - and the refresh seems to be 
working for all.

- Ken
[EMAIL PROTECTED]


-- 
+ Open source questions? +
| Steve Edberg   University of California, Davis |
| [EMAIL PROTECTED]   Computer Consultant |
| http://aesric.ucdavis.edu/  http://pgfsun.ucdavis.edu/ |
+--- http://pgfsun.ucdavis.edu/open-source-tools.html ---+

-- 
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] PHP Redirect in the middle of code?

2001-09-10 Thread Andrew Penniman

The Steve Edberg (option #2) and Michael Kimsal suggestions to use
ob_start() output buffering work like a charm.  Thanks so much!  I would
have been a long time coming before I mad this connection on my own.
Guess I need to hone my archive querying skills...

I think it would be _really_ swell if the documention for header()
mentioned output buffering as a means of tweaking the headers,
especially header(Location: .$redirect_to), in mid-code.

I Fusebox my pages (www.fusebox.org) so I only need to add a single
ob_start() and ob_end_flush() call to my source tree.  If I'm
redirecting then I call ob_end_clean(); header(Location:
.$redirect_to); and everything works like a charm!

Cheers!

-- 
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] PHP Redirect in the middle of code?

2001-09-10 Thread Michael Kimsal

Good to hear.  How's fusebox working for you?



Andrew Penniman wrote:

The Steve Edberg (option #2) and Michael Kimsal suggestions to use
ob_start() output buffering work like a charm.  Thanks so much!  I would
have been a long time coming before I mad this connection on my own.
Guess I need to hone my archive querying skills...

I think it would be _really_ swell if the documention for header()
mentioned output buffering as a means of tweaking the headers,
especially header(Location: .$redirect_to), in mid-code.

I Fusebox my pages (www.fusebox.org) so I only need to add a single
ob_start() and ob_end_flush() call to my source tree.  If I'm
redirecting then I call ob_end_clean(); header(Location:
.$redirect_to); and everything works like a charm!

Cheers!




-- 
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] PHP Redirect in the middle of code?

2001-09-10 Thread Michael J. Seely

HI
You can put the header function anywhere in the php code as long 
as the logic sends it as the very first output for the page in html. 
Conditional redirects are no problem.


[EMAIL PROTECTED] (George Pitcher) writes:

  Andrew,

  I am in a similar position witha Lasso site, which I am considering php-ing.
  I need to do conditional redirects.

  George P, Edinburgh

  - Original Message -
  From: Andrew Penniman [EMAIL PROTECTED]
  To: [EMAIL PROTECTED]
  Sent: Monday, September 10, 2001 3:37 PM
  Subject: [PHP] PHP Redirect in the middle of code?


   I am trying to figure out how to use PHP to redirect the user to a new
   location *after* processing and most likely outputting a bunch of code.
   Because this redirection would happen late in the game I can't use
   header(Location: .$redirect_to);

You should probably look at ouput buffering; the php manual has a section
on the subject at http://uk.php.net/manual/en/ref.outcontrol.php and Zeev
Suraski wrote an article at Zend http://zend.com/zend/art/buffering.php

   -robin

--
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]

-- 

_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
Michael Seely  408-777-9949