Re: [PHP] Sessions and headers
> Try including "session_cache_limiter('public');" before your > session_start(); call at the top of the page. This is *exactly* what I needed!! It worked perfectly. Thank you Ed, John very much for your feedback with this issue! Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Sessions and headers
Try including "session_cache_limiter('public');" before your session_start(); call at the top of the page. ed -Original Message- From: Chris Boget [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 04, 2003 10:40 AM To: Ed Gorski; 'CPT John W. Holmes'; 'PHP General' Subject: Re: [PHP] Sessions and headers > Are you downloading these files over HTTPS://? Yes. But I just tried to force HTTP:// and that didn't change anything. thnx, Chris -- 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] Sessions and headers
> Are you downloading these files over HTTPS://? Yes. But I just tried to force HTTP:// and that didn't change anything. thnx, Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Sessions and headers
Are you downloading these files over HTTPS://? Ed -Original Message- From: Chris Boget [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 04, 2003 10:24 AM To: CPT John W. Holmes; PHP General Subject: Re: [PHP] Sessions and headers > What errors, exactly? Can you show some examples? The errors are not PHP. They are from the browser trying to open the data being sent from the server (the HTML or binary data) in the appropriate program. eg, Acrobat for PDF, Word for DOC, Excel for XL. For this particular case, I'm using the following header call: header( "Content-Type: application/pdf" ); and I'm following it up with PDF binary data. As everyone well knows, this will cause Acrobat to start up and the data displayed therein. Well, if any headers are sent to the browser prior to the above header() call, the app fails to load up and your browser gives you an error. In this case, the error I am getting is as follows: "Internet explorer cannot download YOURFILENAME Internet Explorer was not able to open this Internet site. The requested site is either unavailable or cannot be found. Please try again later." The offending function call that causes all this grief is "session_start()". When I comment out the call to session_start(), the PDF opens up just fine. When I leave the function call in, I get the above error. (And a quick note, I have trans-sid enabled) Since you need session_start() to start or resume a session and since that function call messes with any subsequent header() calls, I've not been able to use sessions in scripts that output data to Word, Acrobat, Excel, etc. and I need to do something about that. > I had problems like this with IE over SSL that was solved by changing the > session.cache_limiter. Does it work for other browsers at all or is it a PHP > error you're getting? It's a browser error I'm getting. And I get this problem on all browsers. thnx, Chris -- 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] Sessions and headers
> What errors, exactly? Can you show some examples? The errors are not PHP. They are from the browser trying to open the data being sent from the server (the HTML or binary data) in the appropriate program. eg, Acrobat for PDF, Word for DOC, Excel for XL. For this particular case, I'm using the following header call: header( "Content-Type: application/pdf" ); and I'm following it up with PDF binary data. As everyone well knows, this will cause Acrobat to start up and the data displayed therein. Well, if any headers are sent to the browser prior to the above header() call, the app fails to load up and your browser gives you an error. In this case, the error I am getting is as follows: "Internet explorer cannot download YOURFILENAME Internet Explorer was not able to open this Internet site. The requested site is either unavailable or cannot be found. Please try again later." The offending function call that causes all this grief is "session_start()". When I comment out the call to session_start(), the PDF opens up just fine. When I leave the function call in, I get the above error. (And a quick note, I have trans-sid enabled) Since you need session_start() to start or resume a session and since that function call messes with any subsequent header() calls, I've not been able to use sessions in scripts that output data to Word, Acrobat, Excel, etc. and I need to do something about that. > I had problems like this with IE over SSL that was solved by changing the > session.cache_limiter. Does it work for other browsers at all or is it a PHP > error you're getting? It's a browser error I'm getting. And I get this problem on all browsers. thnx, Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Sessions and headers
> When using PHP sessions, if the user's browser supports > cookies, PHP sets the session id as a cookie (so far as I > understand it). So when trying to use the session ID in a > script, a cookie request is sent to the browser to get the ID > and assigns it to the internal variable $PHPSESSID (again, > so far as I understand it). > My problem is this and I'm hoping someone has come up > with a workaround... > When I try to use the Header() function call (which I do alot > to set the content type such as PDF, doc, xl, etc), I'm getting > errors opening up the file due to previous headers already > having been sent - namely, the header call to get the cookie > value. What errors, exactly? Can you show some examples? I had problems like this with IE over SSL that was solved by changing the session.cache_limiter. Does it work for other browsers at all or is it a PHP error you're getting? ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Sessions and headers
Well you are partly right Chris. But the client automatically sends the cookie with the HTTP request. IE your request for a cookie doesn't send a separate request header to the client. You might want to check to see if you are accidentally outputting something else after you call session_start() (or before). I did something similar to what you are describing. I have the user log on, the php creates a file and prompts them to download. On the download page I check the session before I output anything and it works fine for me. Can you paste a bit of the non-functioning source code so that we can see the problem more clearly? ed -Original Message- From: Chris Boget [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 04, 2003 9:52 AM To: PHP General Subject: [PHP] Sessions and headers When using PHP sessions, if the user's browser supports cookies, PHP sets the session id as a cookie (so far as I understand it). So when trying to use the session ID in a script, a cookie request is sent to the browser to get the ID and assigns it to the internal variable $PHPSESSID (again, so far as I understand it). My problem is this and I'm hoping someone has come up with a workaround... When I try to use the Header() function call (which I do alot to set the content type such as PDF, doc, xl, etc), I'm getting errors opening up the file due to previous headers already having been sent - namely, the header call to get the cookie value. This problem prevents me from using sessions in scripts I write to output and open up Word, Acrobat, Excel, etc. and I am finding that to be an increasing problem as it requires that I come up with a different way to access the session data and open the script up to vulnerabilities. I've tried using ob_start() and ob_end_clean() before and after the session calls hoping that it might somehow solve my problem but it doesn't. Has anyone else come up against this problem? Have you found a workaround other than come up with a different way to do the same thing as code you already have and use to access session data? thnx, Chris -- 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