RE: [PHP] Problem with header(Location: )...
Try lowercase 'http'. Anything in error log? Try turning on display_errors. Cheers, Tamas -Original Message- From: Jason Pruim [mailto:li...@pruimphotography.com] Sent: Sunday, July 31, 2011 8:40 PM To: php-general@lists.php.net Subject: [PHP] Problem with header(Location: )... So I'm attempting to redirect back to the main site of a page after a successful insert into a database... Here's my code: ?PHP if (!$resp-is_valid) { // What happens when the CAPTCHA was entered incorrectly die (The reCAPTCHA wasn't entered correctly. Go back and try it again. . (reCAPTCHA said: . $resp-error . )); } else { $name = mysql_real_escape_string($_POST['txtName']); $comment = mysql_real_escape_string($_POST['areaComment']); $phonelink = mysql_real_escape_string($_POST['phonelink']); $SQL = INSERT INTO comments (name, comment, phonelink) VALUES ('$name', '$comment', '$phonelink'); mysql_query($SQL) or die(Unable to insert at this time. Sorry for the inconvience); //echo Insert successful!; header(Location: HTTP://jason.pruimphotography.com/dev/clients/flewid/Phone/); // Your code here to handle a successful verification } ? The insert happens, BUT it won't redirect back to the site There isn't any reason I should be able to do a header() redirect at that point is there? Or is there a better way to do it? Thanks Everyone! Jason Pruim li...@pruimphotography.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] Problem with header(Location: )...
Jason Pruim li...@pruimphotography.com On Jul 31, 2011, at 2:50 PM, Dajka Tamas wrote: Try lowercase 'http'. Anything in error log? Try turning on display_errors. Tried both, upper and lower case http nothing changed... And nothing in the error log... I try a simple echo with a link and that works just fine... Starting to get frustrated with it -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem with header(Location: )...
On Jul 31, 2011, at 1:40 PM, Jason Pruim wrote: So I'm attempting to redirect back to the main site of a page after a successful insert into a database... Here's my code: ?PHP if (!$resp-is_valid) { // What happens when the CAPTCHA was entered incorrectly die (The reCAPTCHA wasn't entered correctly. Go back and try it again. . (reCAPTCHA said: . $resp-error . )); } else { $name = mysql_real_escape_string($_POST['txtName']); $comment = mysql_real_escape_string($_POST['areaComment']); $phonelink = mysql_real_escape_string($_POST['phonelink']); $SQL = INSERT INTO comments (name, comment, phonelink) VALUES ('$name', '$comment', '$phonelink'); mysql_query($SQL) or die(Unable to insert at this time. Sorry for the inconvience); //echo Insert successful!; header(Location: HTTP://jason.pruimphotography.com/dev/clients/flewid/Phone/ ); // Your code here to handle a successful verification } ? The insert happens, BUT it won't redirect back to the site There isn't any reason I should be able to do a header() redirect at that point is there? Since the echo is commented out, there shouldn't be any output if that is sum total of the code executing on the http request. If this file is called from some other script, you might check to see if any output is sent from there. If display_errors is on, you should be getting something like Unable to send headers after output or some such (I can't offhand think of the actual error message). You can keep the error successful message for verification if you write it directly to the error log, via: error_log(Insert successful.PHP_EOL); Sometimes, it's also nice to insert markers to let you know where the log is emanating from: error_log(__FILE__.'@'.__LINE__.': '.Insert successful.PHP_EOL); Sometimes, a vexing sort of error is a blank line at the top or bottom of a file, outside the ?..? Or is there a better way to do it? Thanks Everyone! Jason Pruim li...@pruimphotography.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] Problem with header(Location: )...
On Jul 31, 2011, at 6:23 PM, Tamara Temple wrote: On Jul 31, 2011, at 1:40 PM, Jason Pruim wrote: So I'm attempting to redirect back to the main site of a page after a successful insert into a database... Here's my code: ?PHP if (!$resp-is_valid) { // What happens when the CAPTCHA was entered incorrectly die (The reCAPTCHA wasn't entered correctly. Go back and try it again. . (reCAPTCHA said: . $resp-error . )); } else { $name = mysql_real_escape_string($_POST['txtName']); $comment = mysql_real_escape_string($_POST['areaComment']); $phonelink = mysql_real_escape_string($_POST['phonelink']); $SQL = INSERT INTO comments (name, comment, phonelink) VALUES ('$name', '$comment', '$phonelink'); mysql_query($SQL) or die(Unable to insert at this time. Sorry for the inconvience); //echo Insert successful!; header(Location: HTTP://jason.pruimphotography.com/dev/clients/flewid/Phone/); // Your code here to handle a successful verification } ? The insert happens, BUT it won't redirect back to the site There isn't any reason I should be able to do a header() redirect at that point is there? Since the echo is commented out, there shouldn't be any output if that is sum total of the code executing on the http request. If this file is called from some other script, you might check to see if any output is sent from there. If display_errors is on, you should be getting something like Unable to send headers after output or some such (I can't offhand think of the actual error message). You can keep the error successful message for verification if you write it directly to the error log, via: error_log(Insert successful.PHP_EOL); Sometimes, it's also nice to insert markers to let you know where the log is emanating from: error_log(__FILE__.'@'.__LINE__.': '.Insert successful.PHP_EOL); Sometimes, a vexing sort of error is a blank line at the top or bottom of a file, outside the ?..? Just before I got your e-mail, I found there were 3 spaces at the very top of the file in front of my ?PHP I was fit to be tied as they say in the south... But it is up and working properly now! Thank you all for your help with this! :) Jason Pruim li...@pruimphotography.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem with header();
I don't had the oportunity to test it yet, but today i will. Today i will make two tests: - Save the files without BOM. - If i dont have success i will disable the output buffering. Thanks to everybody for all support. Regards, Igor Escobar systems analyst interface designer www . igorescobar . com On Tue, Mar 31, 2009 at 12:39 AM, Phpster phps...@gmail.com wrote: Output buffering turned off? Bastien Sent from my iPod On Mar 30, 2009, at 15:03, Igor Escobar titiolin...@gmail.com wrote: Hi guys, probably everybody goes think: its the same problem ever HTML before header() functions ... but it is not. I has working on a project and this are a running in Windows (shame on me). Recently i migrate to *Ubuntu *and some problems occurred and that specifically i can't understand WHY this rappening Warning: Cannot modify *header* information - headers already sent by On my web server on the internet it's OK On my local web server on my work it's OK On my loca web server on my notebook it's the problem. This error occurs only in my notebook (recently that I migrate to linux and it does not already). Please, someone have any idea what the fuck is happening? Regards, Igor Escobar systems analyst interface designer www . igorescobar . com
RE: [PHP] Problem with header();
The output buffer on or off does not matter. If there is nothing sent, there is nothing sent. If you have just a space, a new line, in one of included files and before ?php ... that will be considered an header sent (the default one, usually) every echo before the header will be considered an header sent. output after, and headers before, should usually be the last thing ever to send to the client, in any case (let's say tomorrow the same page should generate a PDF rather than HTML, you overwrite headers? bad practice and problems with some version of IE quite for sure) The only thing I could think about, common empty spaces problem a part, is a prepended file or a forced header for every request. To test this you simply need to create a file like this: ?php header('Content-Type: text/javascript'); echo 'alert(ok)'; ? If that page generates an header you could have UTF-8 BOM problems, a prepended file in the Apache configuration which is broken/bugged/crap, or something truly bad in the configuration. Date: Tue, 31 Mar 2009 10:20:24 -0300 From: titiolin...@gmail.com To: phps...@gmail.com CC: php-general@lists.php.net Subject: Re: [PHP] Problem with header(); I don't had the oportunity to test it yet, but today i will. Today i will make two tests: - Save the files without BOM. - If i dont have success i will disable the output buffering. Thanks to everybody for all support. Regards, Igor Escobar systems analyst interface designer www . igorescobar . com On Tue, Mar 31, 2009 at 12:39 AM, Phpster phps...@gmail.com wrote: Output buffering turned off? Bastien Sent from my iPod On Mar 30, 2009, at 15:03, Igor Escobar titiolin...@gmail.com wrote: Hi guys, probably everybody goes think: its the same problem ever HTML before header() functions ... but it is not. I has working on a project and this are a running in Windows (shame on me). Recently i migrate to *Ubuntu *and some problems occurred and that specifically i can't understand WHY this rappening Warning: Cannot modify *header* information - headers already sent by On my web server on the internet it's OK On my local web server on my work it's OK On my loca web server on my notebook it's the problem. This error occurs only in my notebook (recently that I migrate to linux and it does not already). Please, someone have any idea what the fuck is happening? Regards, Igor Escobar systems analyst interface designer www . igorescobar . com _ Drag n’ drop—Get easy photo sharing with Windows Live™ Photos. http://www.microsoft.com/windows/windowslive/products/photos.aspx
Re: [PHP] Problem with header();
2009/3/30 Igor Escobar titiolin...@gmail.com: Hi guys, probably everybody goes think: its the same problem ever HTML before header() functions ... but it is not. I has working on a project and this are a running in Windows (shame on me). Recently i migrate to *Ubuntu *and some problems occurred and that specifically i can't understand WHY this rappening Warning: Cannot modify *header* information - headers already sent by On my web server on the internet it's OK On my local web server on my work it's OK On my loca web server on my notebook it's the problem. Chances are good that php.ini on your notebook has output buffers switched off. Google it if you don't know what they are. This error occurs only in my notebook (recently that I migrate to linux and it does not already). Please, someone have any idea what the is happening? Please refrain from using language like that on this list. It's unnecessary inappropriate. -Stuart -- http://stut.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem with header();
Output buffering turned off? Bastien Sent from my iPod On Mar 30, 2009, at 15:03, Igor Escobar titiolin...@gmail.com wrote: Hi guys, probably everybody goes think: its the same problem ever HTML before header() functions ... but it is not. I has working on a project and this are a running in Windows (shame on me). Recently i migrate to *Ubuntu *and some problems occurred and that specifically i can't understand WHY this rappening Warning: Cannot modify *header* information - headers already sent by On my web server on the internet it's OK On my local web server on my work it's OK On my loca web server on my notebook it's the problem. This error occurs only in my notebook (recently that I migrate to linux and it does not already). Please, someone have any idea what the fuck is happening? Regards, Igor Escobar systems analyst interface designer www . igorescobar . com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem with header in an if
Jay Blanchard wrote: [snip] /* send the errors to the interface and exit*/ if('' !== $errorsReported){ for($i = 0; $i count($errorsReported); $i++){ echo $errorsReported[$i]; } unset($errorsReported); print_r($errorsReported); } else { /* reload the empty interface */ a quick echo statement here to check that this block is running when you expect it to might tell you something... but you have probably already plastered your code with echo/print statements to determine the flow :-) [/snip] Well, the array still appears, it is empty and unset (see modified code above) does not get rid of it. Here is how it comes back Array ( [0] = [1] = [2] = [3] = ) Well maybe its just me, but you are comparing an array with a string if ('' !== $errorsReported), which doesn't make any sense. Try this instead: if (is_array($errorsReported)) { echo implode(,$errorsReported); } else { header(); } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Problem with header in an if
[snip] /* send the errors to the interface and exit*/ if('' !== $errorsReported){ for($i = 0; $i count($errorsReported); $i++){ echo $errorsReported[$i]; } unset($errorsReported); print_r($errorsReported); } else { /* reload the empty interface */ a quick echo statement here to check that this block is running when you expect it to might tell you something... but you have probably already plastered your code with echo/print statements to determine the flow :-) [/snip] Well, the array still appears, it is empty and unset (see modified code above) does not get rid of it. Here is how it comes back Array ( [0] = [1] = [2] = [3] = ) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Problem with header in an if
[snip] /* send the errors to the interface and exit*/ if('' !== $errorsReported){ for($i = 0; $i count($errorsReported); $i++){ echo $errorsReported[$i]; } unset($errorsReported); print_r($errorsReported); } else { /* reload the empty interface */ Well, the array still appears, it is empty and unset (see modified code above) does not get rid of it. Here is how it comes back Array ( [0] = [1] = [2] = [3] = ) [/snip] The $errorsReported array does not test as 'empty', it only has no values. There are 4 keys set, so what I have to do is figure out how to not set them. /* check for errors */ $arrCheckItems = array( 'Name', 'Dept', 'Level', ); /* check for blanks */ foreach($_POST AS $key=$value){ if(in_array(niceName($key), $arrCheckItems)){ $errorsReported[] = notBlank($key, $value); } } Even if the return from notBlank is nothing, $errorReported[] gets set for each item passed in the foreach loop. I have tried using conditional returns in the function, but to no avail. Perhaps my logic is screwed on this. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Problem with header in an if SOLVED
[snip] /* check for errors */ $arrCheckItems = array( 'Name', 'Dept', 'Level', ); /* check for blanks */ foreach($_POST AS $key=$value){ if(in_array(niceName($key), $arrCheckItems)){ $errorsReported[] = notBlank($key, $value); } } Even if the return from notBlank is nothing, $errorReported[] gets set for each item passed in the foreach loop. I have tried using conditional returns in the function, but to no avail. Perhaps my logic is screwed on this. [/snip] I changed to the following code and it solves the problem ... foreach($_POST AS $key=$value){ if(in_array(niceName($key), $arrCheckItems)){ $nbr = notBlank($key, $value); if(!('' == $nbr)){ $errorsReported[] = $nbr; } } } Before I was directly assigning the value of the return from the notBlank function to $errorsReported. Now something only gets assigned to $errorsReported if there is something to assign. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem with header in an if SOLVED
Jay Blanchard wrote: [snip] /* check for errors */ $arrCheckItems = array( 'Name', 'Dept', 'Level', ); /* check for blanks */ foreach($_POST AS $key=$value){ if(in_array(niceName($key), $arrCheckItems)){ $errorsReported[] = notBlank($key, $value); } } Even if the return from notBlank is nothing, $errorReported[] gets set for each item passed in the foreach loop. I have tried using conditional returns in the function, but to no avail. Perhaps my logic is screwed on this. [/snip] I changed to the following code and it solves the problem ... foreach($_POST AS $key=$value){ if(in_array(niceName($key), $arrCheckItems)){ $nbr = notBlank($key, $value); if(!('' == $nbr)){ $errorsReported[] = $nbr; } } } ? // one less if :-)... foreach($_POST AS $key=$value){ if(in_array(niceName($key), $arrCheckItems) !('' == ($nbr = notBlank($key, $value { // error to report. $errorsReported[] = $nbr; } } // ...also array_filter() with only 1 arg (array) is handy for remove empty vals $errorsReported = array(); foreach($_POST AS $k = $v){ if(in_array(niceName($k), $arrCheckItems)) { $errorsReported[] = notBlank($k, $v); } } if (count($errorsReported = array_filter($errorsReported))) { // error msgs to report! } ? quote from manual: If the callback function is not supplied, array_filter() will remove all the entries of input that are equal to FALSE. See converting to boolean for more information. I do like array filter - also very handy in conjunction with create_function() :-) rgds, jochem Before I was directly assigning the value of the return from the notBlank function to $errorsReported. Now something only gets assigned to $errorsReported if there is something to assign. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Problem with header in an if
Jay Blanchard mailto:[EMAIL PROTECTED] on Thursday, March 24, 2005 12:34 PM said: I don't know if either of these two things will make a difference but here they are anyway. /* send the errors to the interface and exit*/ if('' !== $errorsReported){ Why not if(!empty($errorsReported))? } else { /* reload the empty interface */ header(Location: adminTicketMgmtCreationForm.php); } Also the Location header should(?) receive a FQDN (although I know it works sans FQDN) and I think I read in the manual or somewhere that you should put an exit; after it. .02 Chris. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem with header in an if
/* send the errors to the interface and exit*/ if('' !== $errorsReported){ for($i = 0; $i count($errorsReported); $i++){ echo $errorsReported[$i]; } } else { /* reload the empty interface */ header(Location: adminTicketMgmtCreationForm.php); } Jay, Maybe try... if(!empty($errorsReported)) { instead of... if('' !== $errorsReported){ David
RE: [PHP] Problem with header in an if
[snip] /* send the errors to the interface and exit*/ if('' !== $errorsReported){ for($i = 0; $i count($errorsReported); $i++){ echo $errorsReported[$i]; } } else { /* reload the empty interface */ header(Location: adminTicketMgmtCreationForm.php); } [/snip] I have tried ... 0 count($errorsReported) 0 != 0 !== isset($errorReported) !empty '' != '' !== I tried reversing the order in the statement itself, no go. And Chris, thanks for the heads up, I put the exit() and the FQDN in there. I am headed out for the afternoon, perhaps a clearer head will prevail in the morning! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Problem with header in an if
Jay Blanchard mailto:[EMAIL PROTECTED] on Thursday, March 24, 2005 1:00 PM said: I have tried ... 0 count($errorsReported) 0 != 0 !== isset($errorReported) !empty '' != '' !== Have you tried explicitly setting $errorsReported to to see where it goes? $errorsReported = ; if(!empty($errorsReported)) { // do loop } else { // do redirect } Also, are you sure your program is even GETTING that far? Maybe the program is stopping before the point in question. And Chris, thanks for the heads up, I put the exit() and the FQDN in there. In that case may I suggest the following function: function redirect($location) { header(Location: .FQDN_CONSTANT.$location); exit; } Makes things easier down the road. Chris. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem with header in an if
Jay Blanchard wrote: /* send the errors to the interface and exit*/ if('' !== $errorsReported){ for($i = 0; $i count($errorsReported); $i++){ echo $errorsReported[$i]; } } else { /* reload the empty interface */ a quick echo statement here to check that this block is running when you expect it to might tell you something... but you have probably already plastered your code with echo/print statements to determine the flow :-) header(Location: adminTicketMgmtCreationForm.php); } The above does not work on the else statement. If $errorsReported is blank the header statement does not work, the script just exits. I have had a long day and I may not be seeing something correctly, can anyone see an error with this? If so, can you tell me where I am going wrong? having read the other replies to this post I'm a little perplexed... I was wondering if adminTicketMgmtCreationForm.php isn't crashing? I sometimes get into a situation where an include file has a syntax error that causes complete failure (blank screen, nothing in log), I have had the same on occasion with require_once() statements that fail so maybe the redirect is working only the destination page is silently dying on you I assume that you are not outputting anything before the call to header. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] problem with header-dispotition in IE
adwinwijaya wrote: The error that I got just IE cannot download download.php from mysite.com .. IE was not able to open this site and bla bla bla. No hint in the error. I think the problem that I faced is with SSL. I try http://www.wazzup.co.nz/tutorials/protect_pdf/index.php and it didnt work on my web Why IE cannot work with SSL mode to download file ? Is there any solution ? Are you using session? Then you need to use session_cache_limiter('private_no_expire'); before starting the session. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] problem with header-dispotition in IE
adwinwijaya wrote: Hi all ... I have script that looks like : if(file_exists($filename)){ $len = filesize($filename); //header(Content-type: attachment/pdf); header('Content-Type: application/pdf'); //header(Content-Type: application/octet-stream); header(Content-Type: application/force-download); header(Content-Length: $len); if(preg_match(/MSIE/, $_SERVER[HTTP_USER_AGENT])){ header(Content-Disposition: attachment; filename=.$name..pdf,pdf); }else { header(Content-Disposition: attachment; filename=.$name..pdf,pdf); } //header(Content-Disposition: attachment; filename=personal_inventory_forms.pdf); readfile($filename); } else { echo $filename ; echo ' ERROR : file is not exist' ; } This script works very well on Mozilla, Opera and Safari..but doesnt work with IE. can someone help me to solve this problem ? I suppose you are trying to force IE to download the pdf file, but it is always displaying it - you did not tell what is your problem. IE determines the type of file from the extension, if it is a known extension it ignores the content-type header. You might want to try adding space char after the filename, I've heard it works. PS: Second param to header should be bool -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] problem with header-dispotition in IE
On Mon, 20 Sep 2004 10:58:46 +0200, Marek Kilimajer [EMAIL PROTECTED] wrote: I suppose you are trying to force IE to download the pdf file, but it is always displaying it - you did not tell what is your problem. IE determines the type of file from the extension, if it is a known extension it ignores the content-type header. You might want to try adding space char after the filename, I've heard it works. Apparently IE sometimes makes multiple requests for a URI and this can cause problems with large PDF files. http://support.microsoft.com/default.aspx?scid=kb;en-us;293792 - Brad -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] problem with Header(Location: home.php);
--- CBharadwaj [EMAIL PROTECTED] wrote: In conection.php I have written. SESSION_ START(); on successful login I am registering a session variable. SESSION_REGISTER(userId); Do this instead: session_start(); $_SESSION['userid'] = 'myuser'; Header(Location: home.php); Use an absolute URL: header('Location: http://example.org/home.php'); Warning: Cannot modify header information - headers already sent by (output started at E:\PHPMySql scripts\bugtrack\connection.php:3) in E:\PHPMySql scripts\bugtrack\index.php on line 117 This call to header() on line 117 of index.php generates an error, because line 3 of connection.php generated output. Calls to header() must come prior to output. You can either rearrange your code or use output buffering: http://www.php.net/ob_start Hope that helps. Chris = Chris Shiflett - http://shiflett.org/ PHP Security - O'Reilly Coming Fall 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] problem with Header(Location: home.php);
the following error occuring in above line. Warning: Cannot modify header information - headers already sent by (output started at E:\PHPMySql scripts\bugtrack\connection.php:3) in E:\PHPMySql scripts\bugtrack\index.php on line 117 Have you got any space before you output anything to the browser? I've found that often I've saved a file with a newline at the end by accident - meaning that PHP thinks I'm ready to start sending output and therefore any functions that modify the headers won't work because they've already been sent. Check connection.php around line 3 to see if there is anything sending output before you call session_* or Header(). BTW, you shouldn't use relative URIs in Location: headers, try using: header('Location: http://www.mydomain.com/path/to/home.php'); instead (this won't fix anything, but it's the correct way to do it according to the HTTP/1.1 standard). Hope this helps, Paul -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] problem with Header(Location: home.php);
On Thursday 12 August 2004 07:48 pm, CBharadwaj wrote: Hello, In conection.php I have written. SESSION_ START(); ^ Get rid of extra space and it should work Hth, Andre on successful login I am registering a session variable. SESSION_REGISTER(userId); on login failure I am redirecting to home page. Header(Location: home.php); the following error occuring in above line. Warning: Cannot modify header information - headers already sent by (output started at E:\PHPMySql scripts\bugtrack\connection.php:3) in E:\PHPMySql scripts\bugtrack\index.php on line 117 the connection file I have included in every page. why this error is occuring? Bharadwaj -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] problem with header(Location:home.php)
the connection file I have included in every page. why this error is occuring? check E:\PHPMySql scripts\bugtrack\connection.php for white space before or after ?php ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] problem with header(Location:home.php)
look the line 3 of connection.php Good luck On Wed, 8 Sep 2004 16:43:54 -0700, CBharadwaj [EMAIL PROTECTED] wrote: Hello, In conection.php I have written. SESSION_ START(); on successful login I am registering a session variable. SESSION_REGISTER(userId); on login failure I am redirecting to home page. Header(Location: home.php); the following error occuring in above line. Warning: Cannot modify header information - headers already sent by (output started at E:\PHPMySql scripts\bugtrack\connection.php:3) in E:\PHPMySql scripts\bugtrack\index.php on line 117 the connection file I have included in every page. why this error is occuring? Bharadwaj -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Pablo M. Rivas. http://pmrivas.ipupdater.com --- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] problem with header(Location:home.php)
Warning: Cannot modify header information - headers already sent by (output started at E:\PHPMySql scripts\bugtrack\connection.php:3) in E:\PHPMySql scripts\bugtrack\index.php on line 117 the connection file I have included in every page. why this error is occuring? You are getting this error because you have header output starting at line 3 in file connection.php. The warning is stating that the function, 'header(location: home.php);' cannot fire because you have started outputing header information. Your header() call is on line 117 of index.php. Header() can only be used if there has been no header information sent to the page. You will need to see what is on line 3 and probably line 2 of connection.php. alex hogan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem with header
Hi, Thursday, March 25, 2004, 9:17:31 AM, you wrote: PM Hello to all - just joined this list to see if I can enhance PM my pretty slim knowledge of PHP. PM I have a little script I cobbled together than I modified to use as a guestbook for a PM client's site. I am trying to get the script to call a PM success page if the mail in fact gets PM sent. I plan to also add a failure page if the validation PM routine (haven't added this yet) PM doesn't work. PM I have been experimenting with the statement PM header(Location:thanks.shtml); PM But no matter where I place it in the PHP file, I get the error message that says PM Headers already sent... PM To wit: PM ? PM include (/file with passwords and user id's in it); PM //a bunch of stuff to pull email recipient's address and id out of MySQL db PM //works fine PM //$enjoy, $visit, $test vars pulled from form that follows the script, no probs there PM $recipient=$to_name; PM $message=$enjoy.$visit.$text; PM $params['sendmail_path'] = '/usr/sbin/sendmail'; PM if ($submit){ PM mail($recipient, $subject, $message, PM From:\$from_name\$from_email\r\n . PM Reply-to: $from_email\r\n . PM X-Mailer: PHP/ . phpversion()); PM} ? PM So where in the world does the PM header(Location:thanks.shtml); PM statement go? And if I do an if/else thing on submit, where does the other statement go? PM header(Location:error.shtml); PM TIA for any advice you can offer. I must be really missing the point here. PM Cheers --- Phil Matt Any whitespace in any file before the ?php will cause data to be sent to the browser forcing the headers to be sent. So make sure the first line of your page has ?php and it is a good idea to drop the ? from included pages as there may be blank lines following which are just as bad. So the rule is, header() can go anywhere but before any output to the browser. -- regards, Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem with header
--- Phil Matt [EMAIL PROTECTED] wrote: header(Location:thanks.shtml); Two errors here: 1. There is a space after the colon. 2. The URL must be an absolute URL. But no matter where I place it in the PHP file, I get the error message that says Headers already sent... Read this message. It tells you exactly what is wrong and where. Chris = Chris Shiflett - http://shiflett.org/ PHP Security - O'Reilly Coming Fall 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] Problem with header redirect with register_globals off
Can you post some code? Marco -- php|architect - The magazine for PHP Professionals The first monthly worldwide magazine dedicated to PHP programmers Check us out on the web at http://www.phparch.com On Tue, 2002-11-12 at 08:52, pig pig wrote: Hi All, I am having problem with redirecting using header function with register_globals off. It works fine on my PC but not on the site as the register_globals is off on the server. When redirecting on the server it gave an CGI error: CGI Error The specified CGI application misbehaved by not returning a complete set of HTTP headers. The headers it did return are: I am using session to pass some variables to the target page, could this cause the problem? Is there a work around for this problem? Thanks in advance. CK Ong __ Do You Yahoo!? Great flight deals, travel info and prizes! http://sg.travel.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] Problem with header redirect with register_globals off
Could you post some code? David Russell IT Support Manager Barloworld Optimus (Pty) Ltd Tel: +2711 444-7250 Fax: +2711 444-7256 e-mail: [EMAIL PROTECTED] web: www.BarloworldOptimus.com -Original Message- From: pig pig [mailto:pigpig8080;yahoo.com.sg] Sent: 12 November 2002 03:52 PM To: [EMAIL PROTECTED] Subject: [PHP] Problem with header redirect with register_globals off Hi All, I am having problem with redirecting using header function with register_globals off. It works fine on my PC but not on the site as the register_globals is off on the server. When redirecting on the server it gave an CGI error: CGI Error The specified CGI application misbehaved by not returning a complete set of HTTP headers. The headers it did return are: I am using session to pass some variables to the target page, could this cause the problem? Is there a work around for this problem? Thanks in advance. CK Ong __ Do You Yahoo!? Great flight deals, travel info and prizes! http://sg.travel.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php smime.p7s Description: application/pkcs7-signature