Re: [PHP] Redirect after download
Justin England wrote: I am writing a file download system and I need to be able to do a redirect after the download is finished. The Redirect is sent as a header, before your download content. The browser is free to act on that Redirect header and IGNORE the file download content as soon as it sees the Redirect header. The assumption by the browser for a Redirect header is that you are using it for what it was desgined to mean: This document has moved. It should come as no surprise, then, that when you try to use the Redirect header to get the browser to do something entirely different from what the Redirect header was intended for, it doesn't work. :-) If you control both the page you are coming from and Redirecting to, you could have the destination page do the actual download, at least in theory. There again, not all browsers will work correctly when you try to cram a download into HTML output all in one response to a single HTTP request. So for those of use who use such browsers, *PLEASE* for the love of God, give us a normal friggin' link to click on to get what we want. Users with the fancy browsers will get their nifty download-and-transition-to-new-page experience. If you do not control the destination page, and can't make it do the download (along with a link for us Luddites) then you are pretty much stuck: You can't do that (Not reliably, anyway) -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Redirect or Set Current Directory?
I've got a script that lists all the folders on my web space. If the folder containes a non-php old web page with an index.htm in it I try to include that index.htm but the links inside there do not realize they are another folder deep. I've been away from this php stuff for a while so am probably missing something stupid. I recall there was something tricky about doing a redirect, that way I'd just leave my php template go to the straight index page in that folder which is another option except then I'd lose my master header footer menu items. Here's what I'm messing with: # Check for preformatted INDEX.HTM # if (file_exists (index.htm)){ (chdir ($imagedir));#hmm, this doesn't help? $fh=opendir($imagedir); include $imagedir . /index.htm; } Obviously I don't really know what I'm doing. Any push in the correct direction would be appreciated. This is the page: http://www.edgehill.net/index.php?SCREEN=index.php if you click on any folder in the list you can see how the links are not working properly. This is the bones of a class project that I am working on integrating into my professional site. Here;s an example of one of the class pages that works: http://www.edgehill.net/index.php?SCREEN=ecards.php the straight domain address takes you to my old html formatted pages: http://www.edgehill.net -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Redirect then error message to user
I'm not quite sure how to get an error message to print out after a redirect. I know it's possible. Now page1 moves to page2, check below is on page2 If I leave it on page2 (without redirect), it prints error to user fine. Once it redirects no print. I also tried leaving it on form1, at the top it won't work, since the variables haven't been set yet. Not sure how to let it post form 1 to form 1 check and then on success move to form 2. { // valid - next - } else { header(Location: http://www.xx.com/page1.php; ); print You have errors; exit; } } ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Redirect then error message to user
[snip] { header(Location: http://www.xx.com/page1.php; ); print You have errors; exit; } } [/snip] You either need to carry info about the error in a session variable or url string or something...above your redirect happens before any error can be sent to the browser -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Redirect then error message to user
Now why didn't I think of that ! Thank you Jay! Stuart --- Jay Blanchard [EMAIL PROTECTED] wrote: [snip] { header(Location: http://www.xx.com/page1.php; ); print You have errors; exit; } } [/snip] You either need to carry info about the error in a session variable or url string or something...above your redirect happens before any error can be sent to the browser -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Redirect then error message to user
On Saturday 23 October 2004 01:25, Stuart Felenstein wrote: I'm not quite sure how to get an error message to print out after a redirect. I know it's possible. It's not possible. Think about it. How *can* you print something out when you've already told the browser to go somewhere else? BTW you ought to have an exit statement after the header() statement, some browsers will get confused if you continue printing stuff after a redirect. -- 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 -- /* Hey, diddle, diddle the overflow pdl To get a little more stack; If that's not enough then you lose it all And have to pop all the way back. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Redirect then error message to user
This isn't working: Page2 (after page1 has been posted): else { $_SESSION['er'] = 'Please make sure to fill in all 3 corresponding values .'; header(Location: http://www.x.com/TestMulti4a.php; ); exit; } } Page1: Opening after session_start $_SESSION['er'] = $_POST['er']; Then below in form area: print $er; (tried also echo) Am I do something wrong ? Stuart --- Jay Blanchard [EMAIL PROTECTED] wrote: [snip] { header(Location: http://www.xx.com/page1.php; ); print You have errors; exit; } } [/snip] You either need to carry info about the error in a session variable or url string or something...above your redirect happens before any error can be sent to the browser -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Redirect then error message to user
On Saturday 23 October 2004 02:38, Stuart Felenstein wrote: This isn't working: Page2 (after page1 has been posted): else { $_SESSION['er'] = 'Please make sure to fill in all 3 corresponding values .'; If you want keep changes to any session variables (so that they're available on subsequent pages) you need to: session_write_close() before you redirect. header(Location: http://www.x.com/TestMulti4a.php; ); exit; } } Page1: Opening after session_start $_SESSION['er'] = $_POST['er']; Then below in form area: print $er; (tried also echo) Am I do something wrong ? What are you trying to do here? Is 'Page1' == TestMulti4a.php? Are you trying to display $_SESSION['er'] as set in Page2? If so why are you assigning $_POST['er'] to $_SESSION['er']? All you need to do is echo $_SESSION['er']. -- 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 -- /* A witty saying proves nothing. -- Voltaire */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Redirect then error message to user
Sorry, all fixed now! Thank you for the help! Stuart -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Redirect then error message to user
See below: --- Jason Wong [EMAIL PROTECTED] wrote: What are you trying to do here? Is 'Page1' == TestMulti4a.php? Are you trying to display $_SESSION['er'] as set in Page2? If so why are you assigning $_POST['er'] to $_SESSION['er']? All you need to do is echo $_SESSION['er']. Yes Page1 - TestMulti4a So slightly changed and I thought it was working, seems TestMulti4a (page1) displays the error when I go to it directly (before input) So on Page2 I have: else { $_SESSION['oops'] = Use all 3 fields to set a skill; header(Location: http://www.lurkingforwork.com/TestMulti4a.php; ); exit; } Page1: ?php print $_SESSION['oops'] ? I even logged out of the session, thinking I was now carrying it through the session. Stuart 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 -- /* A witty saying proves nothing. -- Voltaire */ -- 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] Redirect then error message to user
The only problem I'm having here is that if a user goes backwards, the error from the session variable will show up. I put an unset $.. underneath the echo but that seems to have no effect. Stuart --- Stuart Felenstein [EMAIL PROTECTED] wrote: See below: --- Jason Wong [EMAIL PROTECTED] wrote: What are you trying to do here? Is 'Page1' == TestMulti4a.php? Are you trying to display $_SESSION['er'] as set in Page2? If so why are you assigning $_POST['er'] to $_SESSION['er']? All you need to do is echo $_SESSION['er']. Yes Page1 - TestMulti4a So slightly changed and I thought it was working, seems TestMulti4a (page1) displays the error when I go to it directly (before input) So on Page2 I have: else { $_SESSION['oops'] = Use all 3 fields to set a skill; header(Location: http://www.lurkingforwork.com/TestMulti4a.php; ); exit; } Page1: ?php print $_SESSION['oops'] ? I even logged out of the session, thinking I was now carrying it through the session. Stuart 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 -- /* A witty saying proves nothing. -- Voltaire */ -- 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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Redirect then error message to user
You can pass the error in the redirect URL: header(Location: http://www.xx.com/page1.php?errmsg=You missed some stuff) On your main page you just check if there is an errmsg to be displayed: if(isset($_GET['errmsg'])) { echo $_GET['errmsg']; } That a simplified version obviously. But that's the concept. I design all my pages so that one file handles display, edit, validation and save. Then I don't have to worry about going back and forth between pages, doing redirects or retaining data through session variables. Most important, the user doesn't lose what they already entered just because they missed a field. On Oct 22, 2004, at 3:58 PM, Stuart Felenstein wrote: The only problem I'm having here is that if a user goes backwards, the error from the session variable will show up. I put an unset $.. underneath the echo but that seems to have no effect. Stuart --- Stuart Felenstein [EMAIL PROTECTED] wrote: See below: --- Jason Wong [EMAIL PROTECTED] wrote: What are you trying to do here? Is 'Page1' == TestMulti4a.php? Are you trying to display $_SESSION['er'] as set in Page2? If so why are you assigning $_POST['er'] to $_SESSION['er']? All you need to do is echo $_SESSION['er']. Yes Page1 - TestMulti4a So slightly changed and I thought it was working, seems TestMulti4a (page1) displays the error when I go to it directly (before input) So on Page2 I have: else { $_SESSION['oops'] = Use all 3 fields to set a skill; header(Location: http://www.lurkingforwork.com/TestMulti4a.php; ); exit; } Page1: ?php print $_SESSION['oops'] ? I even logged out of the session, thinking I was now carrying it through the session. Stuart 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 -- /* A witty saying proves nothing. -- Voltaire */ -- 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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Brent Baisley Systems Architect Landover Associates, Inc. Search Advisory Services for Advanced Technology Environments p: 212.759.6400/800.759.0577 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Redirect then error message to user
Brent - Thank you I will try that method. Can you elaborate more on below. I take it to mean you have one page/script that your pages are going to do all the checks. This form is 5 pages long. So I chose session variables just to keep it neat and maybe, more secure. Stuart --- Brent Baisley [EMAIL PROTECTED] wrote: I design all my pages so that one file handles display, edit, validation and save. Then I don't have to worry about going back and forth between pages, doing redirects or retaining data through session variables. Most important, the user doesn't lose what they already entered just because they missed a field. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Redirect then error message to user
I think what Brent is suggesting is a single script that will handle the display and processing of all 5 form 'pages'. The code below is just to give an idea of how I think the 'flow' could go, don't go copying the code and expect anything (positive) to happen !! if(!$_POST['step'] || $_POST['step']=='0') { // Display form 1 or call appropriate function/method if ($_SESSION['errmsg']) echo $errmsg; form action=$PHP_SELF?step=1 } if($_POST['step']=='1') { // Validate form 1 or call appropriate function/method if (error found) { $errmsg = ul; $errmsg .= li Field One is required /li; // etc etc $_SESSION['errmsg'] = $errmsg; } // Not sure about the following line ?? Header(Location: http://mysite.com/path/to/myself?step=2;); } if ($_POST['step']=='2') { ... etc... Graham -Original Message- From: Stuart Felenstein [mailto:[EMAIL PROTECTED] Sent: 22 October 2004 21:55 To: Brent Baisley Cc: [EMAIL PROTECTED] Subject: Re: [PHP] Redirect then error message to user Brent - Thank you I will try that method. Can you elaborate more on below. I take it to mean you have one page/script that your pages are going to do all the checks. This form is 5 pages long. So I chose session variables just to keep it neat and maybe, more secure. Stuart --- Brent Baisley [EMAIL PROTECTED] wrote: I design all my pages so that one file handles display, edit, validation and save. Then I don't have to worry about going back and forth between pages, doing redirects or retaining data through session variables. Most important, the user doesn't lose what they already entered just because they missed a field. -- 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
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
--- 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
--- 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
--- 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
--- 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
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
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
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
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
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
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
--- 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
--- 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
--- 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
--- 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
[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
Re: [PHP] PHP REDIRECT
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
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
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] redirect
it works, thx Chris W. Parker [EMAIL PROTECTED] schreef in bericht news:[EMAIL PROTECTED] Pablo Zorzoli mailto:[EMAIL PROTECTED] on Wednesday, October 29, 2003 11:20 AM said: You cannot do any echo ; before header(location:..); maybe that's the problem. The solution would be to turn on output buffering. ?php ob_start(); // do your stuff header(Location: http://www.fullurl.com/notjust/a/page.html;); exit; ? hth, Chris. p.s. Output buffering I think can have some performance issues regarding server memory but I'm not certain about this. -- Don't like reformatting your Outlook replies? Now there's relief! http://home.in.tum.de/~jain/software/outlook-quotefix/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] redirect
Hi, Is there in php something as a redirect to another page like in asp? e.g if(choice==1) response.redirect(page.php); response.redirect(page2.php); I have search in the manuel, but the only thing I find is something like header(Location: registratie.html); But I guess it's wrong because header information is already send. Alain -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] redirect
header(Location: registratie.html); That is exactly how you do the PHP version of a response.redirect(). Regards. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] redirect
But I get the following warning: Warning: Cannot modify header information - headers already sent by (output started at /home/schoolre/public_html/Hitek/Online/Registratie/registratieFuncties.php: 1) in /home/schoolre/public_html/Hitek/Online/Registratie/registratieData.php on line 30 In registratieData there is a include file to registratieFuncties.php. And in the file registratieFuncties.php there is a include file to Connecties.inc for the connectiestring to the database Alain Gregory Kornblum [EMAIL PROTECTED] schreef in bericht news:[EMAIL PROTECTED] ing.com... header(Location: registratie.html); That is exactly how you do the PHP version of a response.redirect(). Regards. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] redirect
On Wed, 2003-10-29 at 16:17, alain dhaene wrote: But I get the following warning: Warning: Cannot modify header information - headers already sent by (output started at /home/schoolre/public_html/Hitek/Online/Registratie/registratieFuncties.php: 1) in /home/schoolre/public_html/Hitek/Online/Registratie/registratieData.php on line 30 In registratieData there is a include file to registratieFuncties.php. And in the file registratieFuncties.php there is a include file to Connecties.inc for the connectiestring to the database You cannot do any echo ; before header(location:..); maybe that's the problem. regards.. pablo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] redirect
Pablo Zorzoli mailto:[EMAIL PROTECTED] on Wednesday, October 29, 2003 11:20 AM said: You cannot do any echo ; before header(location:..); maybe that's the problem. The solution would be to turn on output buffering. ?php ob_start(); // do your stuff header(Location: http://www.fullurl.com/notjust/a/page.html;); exit; ? hth, Chris. p.s. Output buffering I think can have some performance issues regarding server memory but I'm not certain about this. -- Don't like reformatting your Outlook replies? Now there's relief! http://home.in.tum.de/~jain/software/outlook-quotefix/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] redirect
I have check my code. I haven't use a echo in my code. It's very strange. I will search more on the manule. thx Pablo Zorzoli [EMAIL PROTECTED] schreef in bericht news:[EMAIL PROTECTED] On Wed, 2003-10-29 at 16:17, alain dhaene wrote: But I get the following warning: Warning: Cannot modify header information - headers already sent by (output started at /home/schoolre/public_html/Hitek/Online/Registratie/registratieFuncties.php: 1) in /home/schoolre/public_html/Hitek/Online/Registratie/registratieData.php on line 30 In registratieData there is a include file to registratieFuncties.php. And in the file registratieFuncties.php there is a include file to Connecties.inc for the connectiestring to the database You cannot do any echo ; before header(location:..); maybe that's the problem. regards.. pablo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] redirect
--- alain dhaene [EMAIL PROTECTED] wrote: Is there in php something as a redirect to another page like in asp? Yes, and as with ASP, there are several methods. Make an example script that has only this: ? header('Location: http://www.google.com/'); ? As for your error about headers already being sent, this is because you generate output prior to the call to header(). You can't do this due to a protocol restriction. The same applies to ASP, although it might buffer output or something for you. Hope that helps. Chris = My Blog http://shiflett.org/ HTTP Developer's Handbook http://httphandbook.org/ RAMP Training Courses http://www.nyphp.org/ramp -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] redirect
--- alain dhaene [EMAIL PROTECTED] wrote: I have check my code. I haven't use a echo in my code. It's very strange. I will search more on the manule. I don't think the manual will help you here. You *do* have output in your script prior to the call to header(). Trust me. :-) One way to find out is to put this directly above the call to header(): exit; Then, call the script with your browser, view source, and select all (control-A). If *anything* is highlighted, even whitespace, then that's your output. Get rid of it, or buffer it (as per another suggestion). Hope that helps. Chris = My Blog http://shiflett.org/ HTTP Developer's Handbook http://httphandbook.org/ RAMP Training Courses http://www.nyphp.org/ramp -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] redirect
alain dhaene mailto:[EMAIL PROTECTED] on Wednesday, October 29, 2003 11:29 AM said: I have check my code. I haven't use a echo in my code. It's very strange. I will search more on the manule. PHP has so far been very good to me with reporting this error. I would trust the error message and look carefully at the file and line it reports as being the offender. /home/schoolre/public_html/Hitek/Online/Registratie/registratieData.php on line 30 Chris. -- Don't like reformatting your Outlook replies? Now there's relief! http://home.in.tum.de/~jain/software/outlook-quotefix/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] redirect
alain dhaene wrote: But I get the following warning: Warning: Cannot modify header information - headers already sent by (output started at /home/schoolre/public_html/Hitek/Online/Registratie/registratieFuncties.php: 1) The warning states it clearly, output started on line 1 in registratieFuncties.php. Output means any output that is send to the browser, and there are many ways you can output something - echo, print, anything outside ?php ?, error ... in /home/schoolre/public_html/Hitek/Online/Registratie/registratieData.php on line 30 In registratieData there is a include file to registratieFuncties.php. And in the file registratieFuncties.php there is a include file to Connecties.inc for the connectiestring to the database Alain Gregory Kornblum [EMAIL PROTECTED] schreef in bericht news:[EMAIL PROTECTED] ing.com... header(Location: registratie.html); That is exactly how you do the PHP version of a response.redirect(). Regards. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Redirect
Hi there people, I'm looking for a function that will redirect a browser to another page after a PHP scrip has run. I tried serching for it in the doc but found nothing. It shall be similar to Tcl's ns_returnredirect. Thanx. Joao Penna Andrade Undergraduate, Mechanical Engineering UNICAMP, Brazil -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Redirect
http://us2.php.net/manual/en/function.header.php Joao Andrade wrote: Hi there people, I'm looking for a function that will redirect a browser to another page after a PHP scrip has run. I tried serching for it in the doc but found nothing. It shall be similar to Tcl's ns_returnredirect. Thanx. Joao Penna Andrade Undergraduate, Mechanical Engineering UNICAMP, Brazil -- 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] Redirect
On Saturday 25 October 2003 10:54 am, Joao Andrade wrote: Hi there people, I'm looking for a function that will redirect a browser to another page after a PHP scrip has run. I tried serching for it in the doc but found nothing. It shall be similar to Tcl's ns_returnredirect. Thanx. You can either use the php function header() or the HTML meta refresh thing. James -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Redirect
header() refresh/redirect with delay. --- ?php ob_start(); if(!headers_sent()) { header('Refresh: 1; Url=http://www.example.com'); exit(); } ob_end_flush(); ? --- header() refresh/re-direct without delay --- ?php ob_start(); if(!headers_sent()) { header('Location: http://www.example.com'); exit(); } ob_end_flush(); ? --- -- Jon Kriek http://phpfreaks.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] RE : [PHP] Redirect URL
Thank you very much, This was the reason I figured it out now. Thank you for good advise. Yury On 22 Sep 2003 at 14:39, BENARD Jean-philippe wrote: Headers must be sent before anything else (text, html ...). If you put somewhere something like : echo test;, php will send standard HTML header and you'll not be able to sent another headers. Be sure that nothing is sent before your header or put this test on top of the executed script. Cordialement, Jean-Philippe BENARD Consultant STERIA Infogrance ([EMAIL PROTECTED]) -Message d'origine- De: Yury B. [mailto:[EMAIL PROTECTED] Envoy: dimanche 21 septembre 2003 22:00 : [EMAIL PROTECTED] Objet: [PHP] Redirect URL Hi I have form in file register.php. The action of this form is the same - register.php the form validation script is included in this file like include(mail.php) In mail.php there is two sections - one is working if user didn't complete form properly another if everything okay. So, I need form to show the different page (let's say success.htm) if everything was filled right. I include the following in the mail.php file if everything is okay: header(Location: http://test.my/success.htm;); But it doesn't work even though all the files are in the same directory. it shows: Warning: Cannot modify header information - headers already sent by (output started at z:\home\test.my\www\register.php:5) in z:\home\test.my\www\mail.php on line 41 What is wrong? Yury -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php God is our provider http://www.body-builders.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Redirect URL
Hi I have form in file register.php. The action of this form is the same - register.php the form validation script is included in this file like include(mail.php) In mail.php there is two sections - one is working if user didn't complete form properly another if everything okay. So, I need form to show the different page (let's say success.htm) if everything was filled right. I include the following in the mail.php file if everything is okay: header(Location: http://test.my/success.htm;); But it doesn't work even though all the files are in the same directory. it shows: Warning: Cannot modify header information - headers already sent by (output started at z:\home\test.my\www\register.php:5) in z:\home\test.my\www\mail.php on line 41 What is wrong? Yury -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Redirect URL
Search the archives or google. Yury B. wrote: Hi I have form in file register.php. The action of this form is the same - register.php the form validation script is included in this file like include(mail.php) In mail.php there is two sections - one is working if user didn't complete form properly another if everything okay. So, I need form to show the different page (let's say success.htm) if everything was filled right. I include the following in the mail.php file if everything is okay: header(Location: http://test.my/success.htm;); But it doesn't work even though all the files are in the same directory. it shows: Warning: Cannot modify header information - headers already sent by (output started at z:\home\test.my\www\register.php:5) in z:\home\test.my\www\mail.php on line 41 What is wrong? Yury -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Redirect to HTTPS
I have a stupid question. I need if i be in a http make a redirect to https. Http is a 80 port and ssl is a 443 port if ($HTTP_SERVER_VARS['SERVER_PORT']==80) { header(Location: https://mynet.com/pay.php;); exit; } Is the correct way to do this ??? Exist any function to make this ??? Excuse my broken English, Regards from Spain Un saludo, Danny -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Redirect to HTTPS
This is how I do it: if ($_SERVER['HTTPS']!='on') { header(Location: https://mynet.com/pay.php;); exit; } It is my ambition to say in ten sentences; what others say in a whole book. - Friedrich Nietzsche From: [EMAIL PROTECTED] Date: Fri, 1 Aug 2003 10:20:58 +0200 To: [EMAIL PROTECTED] Subject: [PHP] Redirect to HTTPS I have a stupid question. I need if i be in a http make a redirect to https. Http is a 80 port and ssl is a 443 port if ($HTTP_SERVER_VARS['SERVER_PORT']==80) { header(Location: https://mynet.com/pay.php;); exit; } Is the correct way to do this ??? Exist any function to make this ??? Excuse my broken English, Regards from Spain Un saludo, Danny -- 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] Redirect to HTTPS
It might also be worth making sure that your web server is configured to force https on this page if this is what you want. Otherwise a user could type the URL in without the HTTPS and still get the page. On Friday 01 Aug 2003 9:20 am, [EMAIL PROTECTED] wrote: I have a stupid question. I need if i be in a http make a redirect to https. Http is a 80 port and ssl is a 443 port if ($HTTP_SERVER_VARS['SERVER_PORT']==80) { header(Location: https://mynet.com/pay.php;); exit; } Is the correct way to do this ??? Exist any function to make this ??? Excuse my broken English, Regards from Spain Un saludo, Danny -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Redirect to HTTPS
Here's another way to do it: ?php $url=$_SERVER[SCRIPT_URI]; $url_array=parse_url($url); if($url_array[scheme]!=https) { header(Location: https://$url_array[host]$url_array[path];); } ? Luis -Original Message- From: Richard Baskett [mailto:[EMAIL PROTECTED] Sent: Friday, August 01, 2003 3:25 AM To: PHP General Subject: Re: [PHP] Redirect to HTTPS This is how I do it: if ($_SERVER['HTTPS']!='on') { header(Location: https://mynet.com/pay.php;); exit; } It is my ambition to say in ten sentences; what others say in a whole book. - Friedrich Nietzsche From: [EMAIL PROTECTED] Date: Fri, 1 Aug 2003 10:20:58 +0200 To: [EMAIL PROTECTED] Subject: [PHP] Redirect to HTTPS I have a stupid question. I need if i be in a http make a redirect to https. Http is a 80 port and ssl is a 443 port if ($HTTP_SERVER_VARS['SERVER_PORT']==80) { header(Location: https://mynet.com/pay.php;); exit; } Is the correct way to do this ??? Exist any function to make this ??? Excuse my broken English, Regards from Spain Un saludo, Danny -- 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] REDIRECT STATUS CGI
Can I just change this status to 0 en then start my Xitami? Or do I have to reinstall it after I have changed the status to 0? The first option didn't seem to work properly. Thanks in advance, Freek Curt Zirzow [EMAIL PROTECTED] schreef in bericht news:[EMAIL PROTECTED] * Thus wrote Freek van de Griendt ([EMAIL PROTECTED]): Hi, I just started using PHP and installed it on my Windows machine, together with Xitami (Web server). But now, when I try to write a simple PHP file I get the following error: Security Alert! The PHP CGI cannot be accessed directly. This PHP CGI binary was compiled with force-cgi-redirect enabled. This means that a page will only be served up if the REDIRECT_STATUS CGI variable is set, e.g. via an Apache Action directive. php.net has all your answers http://php.net/manual/en/install.xitami.php Curt -- I used to think I was indecisive, but now I'm not so sure. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] REDIRECT STATUS CGI
On Jul 22, 2003, Freek van de Griendt claimed that: |Hi, | |I just started using PHP and installed it on my Windows machine, together |with Xitami (Web server). But now, when I try to write a simple PHP file I |get the following error: | |Security Alert! The PHP CGI cannot be accessed directly. |This PHP CGI binary was compiled with force-cgi-redirect enabled. This means |that a page will only be served up if the REDIRECT_STATUS CGI variable is |set, e.g. via an Apache Action directive. | |For more information as to why this behaviour exists, see the manual page |for CGI security. | |For more information about changing this behaviour or re-enabling this |webserver, consult the installation file that came with this distribution, |or visit the manual page. | |How can I change this redirect status? I tried to do it in my php.ini file |but I am not sure what I have to change. | |Any help? Thanks in advance. | |Freek Looks like you have a bad configuration in your php.ini file. First, search your hard drive for all instances of php.ini, then, maybe one of these will help: http://lists.xitami.org/pipermail/xitami/2002-January/002141.html http://www.devarticles.com/forum/printthread.php?threadid=2518 http://www.php.net/security.cgi-bin Jeff -- Registered Linux user #304026. lynx -source http://jharris.rallycentral.us/jharris.asc | gpg --import Key fingerprint = 52FC 20BD 025A 8C13 5FC6 68C6 9CF9 46C2 B089 0FED Responses to this message should conform to RFC 1855. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] REDIRECT STATUS CGI
* Thus wrote Freek van de Griendt ([EMAIL PROTECTED]): Hi, I just started using PHP and installed it on my Windows machine, together with Xitami (Web server). But now, when I try to write a simple PHP file I get the following error: Security Alert! The PHP CGI cannot be accessed directly. This PHP CGI binary was compiled with force-cgi-redirect enabled. This means that a page will only be served up if the REDIRECT_STATUS CGI variable is set, e.g. via an Apache Action directive. php.net has all your answers http://php.net/manual/en/install.xitami.php Curt -- I used to think I was indecisive, but now I'm not so sure. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Redirect output of include() for mailing
Hello, Suppose I have a php file that output certain HTML given certain parameters. So I can call it likt http://localhost/myscript.php?foo=bar I can include it from other page using include('myscript.php?foo=bar') But how can I instead capture the output of the include to variable and mail it, something like $msg = include('myscript.php?foo=bar) mail($to,$subject,$msg); Furthermore, if myscript.php generates image instead (eg. JPEG), which I usually call using IMG SRC=myscript.php?foo=bar, can I 'save' the image in a variable, and then mail it as an attachment? I know that I have to use some mail class that will handle attachments, but that's is available somewhere in the net, or from PEAR I assume. So the problem only how to capture the dynamically generated image. Thanks for any help. Reuben D. Budiardja -- - /\ ASCII Ribbon Campaign against HTML \ / email and proprietary format X attachments. / \ - Have you been used by Microsoft today? Choose your life. Choose freedom. Choose LINUX. - -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Redirect output of include() for mailing
Hello, This is a reply to an e-mail that you wrote on Tue, 22 Jul 2003 at 18:37, lines prefixed by '' were originally written by you. But how can I instead capture the output of the include to variable and mail it, something like $msg = include('myscript.php?foo=bar) Use output buffering... ob_start() // see http://uk2.php.net/ob_start include(youfile.php); $mailthis = ob_get_contents() // see http://uk2.php.net/manual/en/function.ob-get-contents.php ob_end_clean() // see http://uk2.php.net/manual/en/function.ob-end-clean.php HTH David -- phpmachine :: The quick and easy to use service providing you with professionally developed PHP scripts :: http://www.phpmachine.com/ Professional Web Development by David Nicholson http://www.djnicholson.com/ QuizSender.com - How well do your friends actually know you? http://www.quizsender.com/ (developed entirely in PHP) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Redirect output of include() for mailing
On Tuesday 22 July 2003 01:43 pm, David Nicholson wrote: Hello, This is a reply to an e-mail that you wrote on Tue, 22 Jul 2003 at 18:37, lines prefixed by '' were originally written by you. But how can I instead capture the output of the include to variable and mail it, something like $msg = include('myscript.php?foo=bar) Use output buffering... ob_start() // see http://uk2.php.net/ob_start include(youfile.php); $mailthis = ob_get_contents() // see http://uk2.php.net/manual/en/function.ob-get-contents.php ob_end_clean() // see http://uk2.php.net/manual/en/function.ob-end-clean.php Thanks. Will the same method works for a dynamically generated image using php? Suppose that myscript.php output JPEG instead of HTML. RDB HTH David -- - /\ ASCII Ribbon Campaign against HTML \ / email and proprietary format X attachments. / \ - Have you been used by Microsoft today? Choose your life. Choose freedom. Choose LINUX. - -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Redirect output of include() for mailing
Hello, This is a reply to an e-mail that you wrote on Tue, 22 Jul 2003 at 18:57, lines prefixed by '' were originally written by you. Thanks. Will the same method works for a dynamically generated image using php? Suppose that myscript.php output JPEG instead of HTML. RDB Yes that will work fine. BTW: I just noticed I missed off the ';' at the end of most of the lines of code that I posted, I really should start proof-reading before clicking send! David -- phpmachine :: The quick and easy to use service providing you with professionally developed PHP scripts :: http://www.phpmachine.com/ Professional Web Development by David Nicholson http://www.djnicholson.com/ QuizSender.com - How well do your friends actually know you? http://www.quizsender.com/ (developed entirely in PHP) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] REDIRECT STATUS CGI
Hi, I just started using PHP and installed it on my Windows machine, together with Xitami (Web server). But now, when I try to write a simple PHP file I get the following error: Security Alert! The PHP CGI cannot be accessed directly. This PHP CGI binary was compiled with force-cgi-redirect enabled. This means that a page will only be served up if the REDIRECT_STATUS CGI variable is set, e.g. via an Apache Action directive. For more information as to why this behaviour exists, see the manual page for CGI security. For more information about changing this behaviour or re-enabling this webserver, consult the installation file that came with this distribution, or visit the manual page. How can I change this redirect status? I tried to do it in my php.ini file but I am not sure what I have to change. Any help? Thanks in advance. Freek -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Redirect to a different frame...
Hello there, I was wondering if there is a way to use the header function in php to redirect the browser's output to a different frame. Specifically, I have a form on frame A which has two submit buttons. I would like one to submit the data in the form to a page which will load in frame A, and the other to submit the data to the same page which will load in frame B. I was hoping that I could put some code at the top of the results page which will tell the browser which frame to display it in (dependent on which $_POST variable is set). Is this possible? Thanks, Grant -- Grant Rutherford Iders Incorporated 600A Clifton Street Winnipeg, MB Canada R3G 2X6 http://www.iders.ca tel: 204-779-5400 ext 36 fax: 204-779-5444 This message is intended solely for the use of the designated recipient(s) and their appointed delegates, and may contain confidential information. Any unauthorized disclosure, copying or distribution of its contents is strictly prohibited. If you have received this message in error, please destroy it and advise the sender immediately by phone, email or facsimile. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Redirect to a different frame...
Hi, I was wondering if there is a way to use the header function in php to redirect the browser's output to a different frame. Specifically, I have a form on frame A which has two submit buttons. I would like one to submit the data in the form to a page which will load in frame A, and the other to submit the data to the same page which will load in frame B. in your form tag, you can put target=framename, example: form method=post name=framename action=file.php target=framethree Anything submitted from that frame will target the specified frame. No fancy PHP needed, unless you want to make the target dynamic. -Dan Joseph -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Redirect to a different frame...
Hi there, Thanks for your response. I understand that I can specify a target in the form tag. However, if I were to do that both buttons would have to go to the same frame. (I think?) If I could specify the target for each submit button, that would work perfectly. Also, if I could have the same input fields shared between two forms (one for each target destination). However, I don't think that either of these is an option in regular HTML. Thanks, Grant On Thu, 2003-07-03 at 10:41, Dan Joseph wrote: Hi, I was wondering if there is a way to use the header function in php to redirect the browser's output to a different frame. Specifically, I have a form on frame A which has two submit buttons. I would like one to submit the data in the form to a page which will load in frame A, and the other to submit the data to the same page which will load in frame B. in your form tag, you can put target=framename, example: form method=post name=framename action=file.php target=framethree Anything submitted from that frame will target the specified frame. No fancy PHP needed, unless you want to make the target dynamic. -Dan Joseph -- Grant Rutherford Iders Incorporated 600A Clifton Street Winnipeg, MB Canada R3G 2X6 http://www.iders.ca tel: 204-779-5400 ext 36 fax: 204-779-5444 This message is intended solely for the use of the designated recipient(s) and their appointed delegates, and may contain confidential information. Any unauthorized disclosure, copying or distribution of its contents is strictly prohibited. If you have received this message in error, please destroy it and advise the sender immediately by phone, email or facsimile. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Redirect to a different frame...
Oh, yeah, that is correct. You'd need to use the button tag and put some javascript in them to target the frames. I'm not up on the javascript enough though, check javascript.internet.com for more information. -Dan Joseph -Original Message- From: Grant Rutherford [mailto:[EMAIL PROTECTED] Sent: Thursday, July 03, 2003 12:03 PM To: Dan Joseph Cc: PHP Mailing List Subject: RE: [PHP] Redirect to a different frame... Hi there, Thanks for your response. I understand that I can specify a target in the form tag. However, if I were to do that both buttons would have to go to the same frame. (I think?) If I could specify the target for each submit button, that would work perfectly. Also, if I could have the same input fields shared between two forms (one for each target destination). However, I don't think that either of these is an option in regular HTML. Thanks, Grant On Thu, 2003-07-03 at 10:41, Dan Joseph wrote: Hi, I was wondering if there is a way to use the header function in php to redirect the browser's output to a different frame. Specifically, I have a form on frame A which has two submit buttons. I would like one to submit the data in the form to a page which will load in frame A, and the other to submit the data to the same page which will load in frame B. in your form tag, you can put target=framename, example: form method=post name=framename action=file.php target=framethree Anything submitted from that frame will target the specified frame. No fancy PHP needed, unless you want to make the target dynamic. -Dan Joseph -- Grant Rutherford Iders Incorporated 600A Clifton Street Winnipeg, MB Canada R3G 2X6 http://www.iders.ca tel: 204-779-5400 ext 36 fax: 204-779-5444 This message is intended solely for the use of the designated recipient(s) and their appointed delegates, and may contain confidential information. Any unauthorized disclosure, copying or distribution of its contents is strictly prohibited. If you have received this message in error, please destroy it and advise the sender immediately by phone, email or facsimile. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Redirect to a different frame...
input type=button value=Button 1 onclick=javascript:document.formname.target = 'frame1';document.formname.submit(); input type=button value=Button 2 onclick=javascript:document.formname.target = 'frame2';document.formname.submit(); On Thu, 2003-07-03 at 12:02, Dan Joseph wrote: Oh, yeah, that is correct. You'd need to use the button tag and put some javascript in them to target the frames. I'm not up on the javascript enough though, check javascript.internet.com for more information. -Dan Joseph -Original Message- From: Grant Rutherford [mailto:[EMAIL PROTECTED] Sent: Thursday, July 03, 2003 12:03 PM To: Dan Joseph Cc: PHP Mailing List Subject: RE: [PHP] Redirect to a different frame... Hi there, Thanks for your response. I understand that I can specify a target in the form tag. However, if I were to do that both buttons would have to go to the same frame. (I think?) If I could specify the target for each submit button, that would work perfectly. Also, if I could have the same input fields shared between two forms (one for each target destination). However, I don't think that either of these is an option in regular HTML. Thanks, Grant On Thu, 2003-07-03 at 10:41, Dan Joseph wrote: Hi, I was wondering if there is a way to use the header function in php to redirect the browser's output to a different frame. Specifically, I have a form on frame A which has two submit buttons. I would like one to submit the data in the form to a page which will load in frame A, and the other to submit the data to the same page which will load in frame B. in your form tag, you can put target=framename, example: form method=post name=framename action=file.php target=framethree Anything submitted from that frame will target the specified frame. No fancy PHP needed, unless you want to make the target dynamic. -Dan Joseph -- Grant Rutherford Iders Incorporated 600A Clifton Street Winnipeg, MB Canada R3G 2X6 http://www.iders.ca tel: 204-779-5400 ext 36 fax: 204-779-5444 This message is intended solely for the use of the designated recipient(s) and their appointed delegates, and may contain confidential information. Any unauthorized disclosure, copying or distribution of its contents is strictly prohibited. If you have received this message in error, please destroy it and advise the sender immediately by phone, email or facsimile. -- Adam Voigt ([EMAIL PROTECTED]) Linux/Unix Network Administrator The Cryptocomm Group -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Redirect to a different frame...
Hi there, Thank you! I had a feeling that javascript would be the answer, but as I have not yet learned javascript, I was hoping that php would work. Oh, well. No sense putting that off anymore. Time to delve into the javascript tutorials. Thanks for your time, everyone. Grant On Thu, 2003-07-03 at 11:07, Adam Voigt wrote: input type=button value=Button 1 onclick=javascript:document.formname.target = 'frame1';document.formname.submit(); input type=button value=Button 2 onclick=javascript:document.formname.target = 'frame2';document.formname.submit(); On Thu, 2003-07-03 at 12:02, Dan Joseph wrote: Oh, yeah, that is correct. You'd need to use the button tag and put some javascript in them to target the frames. I'm not up on the javascript enough though, check javascript.internet.com for more information. -Dan Joseph -Original Message- From: Grant Rutherford [mailto:[EMAIL PROTECTED] Sent: Thursday, July 03, 2003 12:03 PM To: Dan Joseph Cc: PHP Mailing List Subject: RE: [PHP] Redirect to a different frame... Hi there, Thanks for your response. I understand that I can specify a target in the form tag. However, if I were to do that both buttons would have to go to the same frame. (I think?) If I could specify the target for each submit button, that would work perfectly. Also, if I could have the same input fields shared between two forms (one for each target destination). However, I don't think that either of these is an option in regular HTML. Thanks, Grant On Thu, 2003-07-03 at 10:41, Dan Joseph wrote: Hi, I was wondering if there is a way to use the header function in php to redirect the browser's output to a different frame. Specifically, I have a form on frame A which has two submit buttons. I would like one to submit the data in the form to a page which will load in frame A, and the other to submit the data to the same page which will load in frame B. in your form tag, you can put target=framename, example: form method=post name=framename action=file.php target=framethree Anything submitted from that frame will target the specified frame. No fancy PHP needed, unless you want to make the target dynamic. -Dan Joseph -- Grant Rutherford Iders Incorporated 600A Clifton Street Winnipeg, MB Canada R3G 2X6 http://www.iders.ca tel: 204-779-5400 ext 36 fax: 204-779-5444 This message is intended solely for the use of the designated recipient(s) and their appointed delegates, and may contain confidential information. Any unauthorized disclosure, copying or distribution of its contents is strictly prohibited. If you have received this message in error, please destroy it and advise the sender immediately by phone, email or facsimile. -- Adam Voigt ([EMAIL PROTECTED]) Linux/Unix Network Administrator The Cryptocomm Group -- Grant Rutherford Iders Incorporated 600A Clifton Street Winnipeg, MB Canada R3G 2X6 http://www.iders.ca tel: 204-779-5400 ext 36 fax: 204-779-5444 This message is intended solely for the use of the designated recipient(s) and their appointed delegates, and may contain confidential information. Any unauthorized disclosure, copying or distribution of its contents is strictly prohibited. If you have received this message in error, please destroy it and advise the sender immediately by phone, email or facsimile. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] REDIRECT
Does anybody know of a way to redirect to another page once you have already outputted html to the screen. In other words, I want to output some text to the screen for 10 secs and then re-direct to another page. Thanks, Dale -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP redirect
Hi guys what is the function in PHP for directing a php page?? thanx in advance Angelo
Re: [PHP] PHP redirect
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
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
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
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] Redirect
I believe you can also prevent the header error by using ob_start(); Jean-Louis Letortorec [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] To work around that headers already sent problem, I use: if ($condition == true) { echo scriptlocation.href=('http://...');/script; } That works great all the time (unless the javascript has been disabled at the browser side, but usually it's enabled). Jean-Louis At 15:55 3-4-2003, you wrote: Hi, How would one redirect a user to a different page if a certain condition was met? i.e. if($condition == true){ goTo newPage.php } if ($condition == true) { Header(Location: http://www.sense.nl/index.php?module=ContentExpressfunc=displayceid=15;); } take care that your script does not create any output before this,because then you will get an error (headers already sent) -- 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
[PHP] Redirect
Hi, How would one redirect a user to a different page if a certain condition was met? i.e. if($condition == true){ goTo newPage.php } Thanks for your help -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Redirect
From: shaun [EMAIL PROTECTED] How would one redirect a user to a different page if a certain condition was met? i.e. if($condition == true){ goTo newPage.php } Redirects are done using the header() function. See the documentation at http://www.php.net/manual/en/function.header.php. -- Lowell Allen -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Redirect
At 15:55 3-4-2003, you wrote: Hi, How would one redirect a user to a different page if a certain condition was met? i.e. if($condition == true){ goTo newPage.php } if ($condition == true) { Header(Location: http://www.sense.nl/index.php?module=ContentExpressfunc=displayceid=15;); } take care that your script does not create any output before this,because then you will get an error (headers already sent) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Redirect
if($condition == true){ Header (Location: newpage.php); exit; } -Original Message- From: Lowell Allen [mailto:[EMAIL PROTECTED] Sent: 03 April 2003 04:09 PM To: PHP Subject: Re: [PHP] Redirect From: shaun [EMAIL PROTECTED] How would one redirect a user to a different page if a certain condition was met? i.e. if($condition == true){ goTo newPage.php } Redirects are done using the header() function. See the documentation at http://www.php.net/manual/en/function.header.php. -- Lowell Allen -- 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] Redirect
To work around that headers already sent problem, I use: if ($condition == true) { echo scriptlocation.href=('http://...');/script; } That works great all the time (unless the javascript has been disabled at the browser side, but usually it's enabled). Jean-Louis At 15:55 3-4-2003, you wrote: Hi, How would one redirect a user to a different page if a certain condition was met? i.e. if($condition == true){ goTo newPage.php } if ($condition == true) { Header(Location: http://www.sense.nl/index.php?module=ContentExpressfunc=displayceid=15;); } take care that your script does not create any output before this,because then you will get an error (headers already sent) -- 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
[PHP] redirect using header
I have been trying to do a redirect with header; HTML HEAD TITLEOptex Staging and Services Inc. /TITLE /HEAD BODY ?php header('http://newwebpage.com'); ? H3 FONT COLOR=#FFStand By For Terminal.../FONT/H3 /BODY /HTML I keep getting the error; Warning: Cannot modify header information - headers already sent by (output started at /usr/hosting/optex/goterm/temp.html:8) in /usr/hosting/optex/goterm/temp.html on line I have tried the header statement in different postions, and also tried eliminating the existing HEAD section with no difference. What am doing wrong here? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] redirect using header
Read the manual section on headers. A header must be sent before any other output, including whitespace, so putting it in the middle of an HTML page is totally not going to work. http://www.php.net/manual/en/function.header.php -Original Message- From: David Banning [mailto:[EMAIL PROTECTED] Sent: Thursday, March 27, 2003 11:15 AM To: [EMAIL PROTECTED] Subject: [PHP] redirect using header I have been trying to do a redirect with header; HTML HEAD TITLEOptex Staging and Services Inc. /TITLE /HEAD BODY ?php header('http://newwebpage.com'); ? H3 FONT COLOR=#FFStand By For Terminal.../FONT/H3 /BODY /HTML I keep getting the error; Warning: Cannot modify header information - headers already sent by (output started at /usr/hosting/optex/goterm/temp.html:8) in /usr/hosting/optex/goterm/temp.html on line I have tried the header statement in different postions, and also tried eliminating the existing HEAD section with no difference. What am doing wrong here? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] redirect using header
-Original Message- From: David Banning [mailto:[EMAIL PROTECTED] Sent: Thursday, March 27, 2003 2:15 PM To: [EMAIL PROTECTED] Subject: [PHP] redirect using header I have been trying to do a redirect with header; HTML HEAD TITLEOptex Staging and Services Inc. /TITLE /HEAD BODY ?php header('http://newwebpage.com'); ? H3 FONT COLOR=#FFStand By For Terminal.../FONT/H3 /BODY /HTML If you want to send output before the re-direct you need to use javascript. body onLoad=setTimeout(location.href='http://mywebdomain.com/index.html',100 00); This will execute right after the page is completely loaded and move to the next page after 10 seconds. If javascript is disabled this will not work, so provide a link in that case to be clicked on. You can also use the meta tag: meta http-equiv=refresh content=10; URL=index.php body Hello there /body Since meta starts counting when page is first accessed (as opposed to when the page is comepletly loaded), people with slow connection might not see the message -- depending on how big things are. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] redirect using header
Use --- header(Location:http://newwebpage.com;); -Original Message- From: David Banning [mailto:[EMAIL PROTECTED] Sent: Thursday, March 27, 2003 1:15 PM To: [EMAIL PROTECTED] Subject: [PHP] redirect using header I have been trying to do a redirect with header; HTML HEAD TITLEOptex Staging and Services Inc. /TITLE /HEAD BODY ?php header('http://newwebpage.com'); ? H3 FONT COLOR=#FFStand By For Terminal.../FONT/H3 /BODY /HTML I keep getting the error; Warning: Cannot modify header information - headers already sent by (output started at /usr/hosting/optex/goterm/temp.html:8) in /usr/hosting/optex/goterm/temp.html on line I have tried the header statement in different postions, and also tried eliminating the existing HEAD section with no difference. What am doing wrong here? -- 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] redirect using header
--- David Banning [EMAIL PROTECTED] wrote: I have been trying to do a redirect with header; ... I keep getting the error; Warning: Cannot modify header information - headers already sent by (output started at /usr/hosting/optex/goterm/temp.html:8) in /usr/hosting/optex/goterm/temp.html on line --- Jeremy Russell [EMAIL PROTECTED] wrote: Use --- header(Location:http://newwebpage.com;); Technically, the syntax for the header is (notice the space after the colon and the proper URL): header('Location: http://newwebpage.com/'); Also, while his syntax is a problem, it is not the problem at hand. David, you cannot have output prior to using the header() function. You need to call header() prior to outputting your HTML. Chris = Become a better Web developer with the 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] Redirect to a new page?
if the browser doesn't support Javascript use this : if (YES) { header(Location: thispage.php); } else { header(Location: thatpage.php); } exit(); Just make sure you haven't send any output to the browser yet. A suggestion: place this code before you ever print in your code. I know you could do it :) Thanks, Miches:) -Original Message- From: Beauford.2002 [mailto:[EMAIL PROTECTED] Sent: Thursday, March 13, 2003 10:44 AM To: PHP General Subject: [PHP] Redirect to a new page? Hi, I have searched around for hours on this and nothing seems to work. I want simply to do this if yes - goto thispage.php if no - goto thatpage.php Thanks -- 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
[PHP] Redirect to a new page?
Hi, I have searched around for hours on this and nothing seems to work. I want simply to do this if yes - goto thispage.php if no - goto thatpage.php Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Redirect to a new page?
you can use javascript instead.. for example in a jump menu: function seleccionPerfil(form) { if (form.perfil.selectedIndex == 0) { window.location.href=yourpage1.php; } if (form.perfil.selectedIndex == 1) { window.location.href=yourpage2.php; } if (form.perfil.selectedIndex == 2) { window.location.href=yourpage3.php; } } On Thu, 13 Mar 2003, Beauford.2002 wrote: Hi, I have searched around for hours on this and nothing seems to work. I want simply to do this if yes - goto thispage.php if no - goto thatpage.php Thanks -- David Elías Sánchez Vásquez Bachiller en Educación PUCP [EMAIL PROTECTED] telf. (51)-1-5255601 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Redirect to a new page?
btw in your case would be just if/else cheers David. On Thu, 13 Mar 2003, David E.S.V. wrote: you can use javascript instead.. for example in a jump menu: function seleccionPerfil(form) { if (form.perfil.selectedIndex == 0) { window.location.href=yourpage1.php; } if (form.perfil.selectedIndex == 1) { window.location.href=yourpage2.php; } if (form.perfil.selectedIndex == 2) { window.location.href=yourpage3.php; } } On Thu, 13 Mar 2003, Beauford.2002 wrote: Hi, I have searched around for hours on this and nothing seems to work. I want simply to do this if yes - goto thispage.php if no - goto thatpage.php Thanks -- David Elías Sánchez Vásquez Bachiller en Educación PUCP [EMAIL PROTECTED] telf. (51)-1-5255601 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Redirect to a new page?
if(something){ header(Location: {$_SERVER['HTTP_HOST']}/thispage.php); }else{ header(Location: {$_SERVER['HTTP_HOST']}/thatpage.php); } Beauford.2002 wrote: Hi, I have searched around for hours on this and nothing seems to work. I want simply to do this if yes - goto thispage.php if no - goto thatpage.php Thanks -- 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] Redirect to a new page?
Figured it out echo Script Lang=javascript; echo window.location.href = 'viewpostats.php'; echo /script; - Original Message - From: Leif K-Brooks [EMAIL PROTECTED] To: Beauford.2002 [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Thursday, March 13, 2003 2:20 PM Subject: Re: [PHP] Redirect to a new page? if(something){ header(Location: {$_SERVER['HTTP_HOST']}/thispage.php); }else{ header(Location: {$_SERVER['HTTP_HOST']}/thatpage.php); } Beauford.2002 wrote: Hi, I have searched around for hours on this and nothing seems to work. I want simply to do this if yes - goto thispage.php if no - goto thatpage.php Thanks -- 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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Redirect...
Hi all, I'm running the below code to download a text file. After the save as window comes up, I can correctly save the document. However, the browser goes to a Action Cancelled error page. Here's my code: ? header(Content-type: application/text); header('Content-Disposition: attachment; filename=variables.txt'); header('Content-Length: ' . strlen($send)); ? Am I suppose to redirect the page after it saves the file, and if so how would I do that? Thanks, Doug Coning -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Redirect without header or javascipt
with using header? you mean like this-- Header(location: http://url;); -Original Message- From: Daniel Guerrier [mailto:[EMAIL PROTECTED]] Sent: Wednesday, February 19, 2003 7:00 AM To: php user group Subject: [PHP] Redirect without header or javascipt Is there any to redirect in php with using header() and without the use of javascript? __ Do you Yahoo!? Yahoo! Shopping - Send Flowers for Valentine's Day http://shopping.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Redirect without header or javascipt
Is there any to redirect in php with using header() and without the use of javascript? __ Do you Yahoo!? Yahoo! Shopping - Send Flowers for Valentine's Day http://shopping.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Redirect without header or javascipt
no tyler - Original Message - From: Daniel Guerrier [EMAIL PROTECTED] To: php user group [EMAIL PROTECTED] Sent: Tuesday, February 18, 2003 4:59 PM Subject: [PHP] Redirect without header or javascipt Is there any to redirect in php with using header() and without the use of javascript? __ Do you Yahoo!? Yahoo! Shopping - Send Flowers for Valentine's Day http://shopping.yahoo.com -- 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] Redirect without header or javascipt
Is there any to redirect in php with using header() and without the use of javascript? You can use an html meta tag with http-equiv=refresh. Kirk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Redirect without header or javascipt
without header() and without javascript? your only option would be a meta refresh, which i can't imagine is going to help :) Justin on 19/02/03 9:59 AM, Daniel Guerrier ([EMAIL PROTECTED]) wrote: Is there any to redirect in php with using header() and without the use of javascript? __ Do you Yahoo!? Yahoo! Shopping - Send Flowers for Valentine's Day http://shopping.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] redirect
What is the syntax to have php redirect to another web site? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] redirect
What is the syntax to have php redirect to another web site? ?php header(Location: http://domain.com/;); ? -- Greg Donald http://destiney.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php