Re: [PHP] header function, I'm stumped
On Tue, 2 Dec 2003, Chris Hubbard wrote: All, dealing with header(location:...) again. and trying to understand what's happening. I've got the following code: header(Location:http://www.mysite.com/cp/ad/ad_details.php?id=;. $id); I'm kinda surprised I didn't see this mentioned.. Have you tried: header(Location: http://url.redirect/\n\n;); exit; // ? The browser may be particular about the headers. When you add the two newlines to the end, it makes it look like the end of the headers. It's good practice to explicitly exit each time you redirect. -- Kelly Hallman // Ultrafancy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] header function, I'm stumped
--- Kelly Hallman [EMAIL PROTECTED] wrote: On Tue, 2 Dec 2003, Chris Hubbard wrote: All, dealing with header(location:...) again. and trying to understand what's happening. I've got the following code: header(Location:http://www.mysite.com/cp/ad/ad_details.php?id=;. $id); I'm kinda surprised I didn't see this mentioned.. Have you tried: header(Location: http://url.redirect/\n\n;); exit; // ? You should definitely not try to add your own newlines to the end of a header like that. PHP might be able to gracefully handle it, but I wouldn't rely on it. As for the original question, put a space after your colon, and let us know how that works. Hope that helps. Chris = Chris Shiflett - http://shiflett.org/ PHP Security Handbook Coming mid-2004 HTTP Developer's Handbook http://httphandbook.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] header function, I'm stumped
?php ob_start(); $dom = $_SERVER['SERVER_NAME']; writeMessage($id) or die('cannot write' . $id); header('Location: http://' . $dom . '/cp/ad/ad_details.php?id=' . $id); exit(); ob_end_flush(); ? -- Jon Kriek www.phpfreaks.com www.jonkriek.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] header function, I'm stumped
All, dealing with header(location:...) again. and trying to understand what's happening. I've got the following code: writeMessage($id); header(Location:http://www.mysite.com/cp/ad/ad_details.php?id=;. $id); writeMessage() is a debugging function that writes the value of the variable to a debug log. When the code is run $id does have a valid value like 8 or 12. When I run the code, it does not redirect to the specified location, it continues executing the code. So I add the exit; and it does work: writeMessage($id); header(Location:http://www.mysite.com/cp/ad/ad_details.php?id=;. $id); exit; What's weird is the same code without the exit works on a different server (and indeed the same code with different location works on this server) I thought perhaps it was due to type problem, but code doesn't work if $id is a string or integer. The flow for the code: start the edit page when edit page is submitted, check the data, if data is good, update the database redirect to details page if data is bad, return to the edit page Then I used LiveHTTPHeaders in Mozilla and it give me some interesting information, though I'm not quite sure how to interpret. Can someone provide some depth to the mechanisms within the header(location)? Thanks in advance, Chris Hubbard [EMAIL PROTECTED] www.wildcharacters.com 425 481 2020 php based web application development [[ check out phalidate, a data validation class ]] Y! [EMAIL PROTECTED] MSN [EMAIL PROTECTED] AIM ganeshacph -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] header function, I'm stumped
--- Chris Hubbard [EMAIL PROTECTED] wrote: header(Location:http://www.mysite.com/cp/ad/ad_details.php?id=;. $id); There should be a space after the first colon there. Then I used LiveHTTPHeaders in Mozilla and it give me some interesting information, though I'm not quite sure how to interpret. Awesome. Paste that here (you can omit the bulk of the HTML, so that there's not too much stuff to sift through), and we can help you interpret it. What would be best is to try and trim it down to only what is different between when it works and when it doesn't. Chris = Chris Shiflett - http://shiflett.org/ PHP Security Handbook Coming mid-2004 HTTP Developer's Handbook http://httphandbook.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php