Re: [PHP] Headers on smart phone browsers
On Mon, 2012-02-06 at 18:09 -0600, Donovan Brooke wrote: Mari Masuda wrote: [snip] For a concrete example of responsive design in action, point your browser to http://www.sasquatchfestival.com/ and then slowly make the window wider/skinnier to see how the design adapts to different viewport sizes. Very nice... makes for an easy display to a wide range of circumstances I think.. especially image resizing (in the blog example), which looks pretty smooth. But, in both the examples, it appears it can produce a choppy user experience when resizing the window as well... I suppose that resizing could be viewed as one of those 80/20 percent rule things.. meaning, window resizing is probably not a prevalent action for a user and it could be argued that one shouldn't code a site worrying too much about dynamic window resizing... but then there is a form of resizing, which is turning your iPAD to landscape view, etc.. I suppose one could probably still do some UA detection and serve up content based on the type of UA (ie. mobile, IE, game-based) and at that point, still incorporate responsive web design, but to that more-limited-category of UA's. Donovan -- D Brooke There is only one drawback to using CSS media queries to alter the way a page is displayed on different resolutions, and that is that any media (i.e. background images, etc) referenced in a stylesheet is downloaded, regardless of if it is ever used. So if you have two background images for the body, one large for nice wide screens, and a smaller one for smaller screens, they will both be downloaded by the browser. The way around this is to use Javascript to load only the stylesheets required, but then you're relying on Javascript and you don't need media queries. It's a pain finding the right balance. -- Thanks, Ash http://www.ashleysheridan.co.uk
Re: [PHP] Headers on smart phone browsers
There is only one drawback to using CSS media queries to alter the way a page is displayed on different resolutions, and that is that any media (i.e. background images, etc) referenced in a stylesheet is downloaded, regardless of if it is ever used. Another one worth mentionning is that a lot of mobile devices still in use do not support media queries - their being a relatively recent development. Same goes for javascript, even if it claims to support it. Older Blackberrys claim JS support but fail miserably in real life. Marc -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Headers on smart phone browsers
On Feb 6, 2012, at 4:01 PM, Stuart Dallas wrote: Generally speaking you're better off with a design that automatically adapts to the viewport on which it's being displayed. While there's more than one reason for this, the overriding reason is that the same software (i.e. the same user agent) could be running on any size of device, from watch to huge flat panel screen on a wall. I think the world needs to move on from is it a mobile device or not to accepting the reality which is that the browser / OS is irrelevant, and that the way your site renders should be purely based upon the size of the display. Responsive designs such as that described in the A List Apart article Mari posted are fantastic tools for achieving this goal. -Stuart Agreed. Not only the size of the display -- but what's a size of a pixel? http://www.alistapart.com/articles/a-pixel-identity-crisis/ Presentation is a difficult problem to solve, but I don't think PHP enters into the equation. From my view, the only thing that PHP can do is device-sniff, which is clearly a losing proposition. I believe that a presentation solution will be solved by presentation languages (i.e, client-side). Cheers, tedd _ t...@sperling.com http://sperling.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Headers on smart phone browsers
Nice article!! You should read up on responsive web design. http://www.alistapart.com/articles/responsive-web-design/ should get you started. HTH!= -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Headers on smart phone browsers
1) Do smart phones use the same browsers as the desktop, or do they have their own stripped down versions of browsers? Different browsers, some of which are worse than IE (see Blackberry). 2) When a browser broadcasts its header telling the server what kind of browser is involved, do they broadcast anything in the header to indicate that they're being run on a smart phone? Nothing so specific or easy to identify as i am a smartphone. Depending on your target audience, simple regex checks for the strings iphone, android, etc. can do the trick, but if you want specific details about the device... 3) Bonus question: Is there a preferred method amongst coders to determine what type of environment is being browsed from, so as to serve up the proper type of page (desktop or smart phone version of a webpage)? ... the WURFL database and things akin to it or based on / stolen from it can help parse the header string and return a plethora of information about it (screen size, AJAX ability, markup capacity, etc). Marc -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Headers on smart phone browsers
Paul M Foster wrote: This is sort of obliquely related to PHP. I don't have a smart phone, but I need to know a couple of things: 1) Do smart phones use the same browsers as the desktop, or do they have their own stripped down versions of browsers? 2) When a browser broadcasts its header telling the server what kind of browser is involved, do they broadcast anything in the header to indicate that they're being run on a smart phone? 3) Bonus question: Is there a preferred method amongst coders to determine what type of environment is being browsed from, so as to serve up the proper type of page (desktop or smart phone version of a webpage)? Paul Hi Paul, I think this is a great PHP conversation.. and I don't understand why GOTO threads always get way more replies than something like this ;-) Diverse User Agent compatibility is going to be more and more of a challenge for us.. gone are the days of a few known browsers that are viewing our sites. From bots, to browsers, to mobile devices, to game UA's, to app UA's.., to IE's stubborn outlook on the web... the idea of user experience is growing complicated! ;-) I really liked Mari's posted link to the a list apart blog about responsive web design using media query (CSS).. however, it seems to me that it takes the use of many languages and techniques in many cases to get the job done... user agent serving (using PHP or JS or alike), flexible CSS and web design, and a keen eye on your target audience may all play apart. However, this is a PHP list.. and I think we can better approach this topic by limiting our scope to talk about how PHP could be useful. My first question, being that my first language is not PHP, is; is their any core PHP mobile detection functions/tools that exist? I have a running list of mobile UA's that I picked up somewhere that I often use and edit to distribute content accordingly. I also have a PHP mobile detection script that I picked up somewhere. I'm sure these things can be found via google as well. The problem, as Mari's link suggests, is that UA list's and browser sniffing scripts need maintaining quite regularly, since mobile UA's are being added on a weekly basis perhaps. Many of my projects do some PC UA (browser) sniffing.. especially for IE., as IE has it's own system that it uses for how to render content. Anyway, I'm happy to share what I have.. but like I said, PHP is not my first language, so I am interested to see what the more established PHP'ers may have to say. Donovan -- D Brooke -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Headers on smart phone browsers
On Mon, Feb 6, 2012 at 12:58 AM, Paul M Foster pa...@quillandmouse.comwrote: This is sort of obliquely related to PHP. I don't have a smart phone, but I need to know a couple of things: 1) Do smart phones use the same browsers as the desktop, or do they have their own stripped down versions of browsers? Both, although more and more smart phones join the ranks of the desktop-quality browser every day (iPhone and Android both have very capable browsers, with the iPhone's omission of flash support being the biggest difference between these two.) 2) When a browser broadcasts its header telling the server what kind of browser is involved, do they broadcast anything in the header to indicate that they're being run on a smart phone? Yes, but that gets complicated quickly: http://www.zytrax.com/tech/web/mobile_ids.html 3) Bonus question: Is there a preferred method amongst coders to determine what type of environment is being browsed from, so as to serve up the proper type of page (desktop or smart phone version of a webpage)? To supplement the alistapart link already mentioned, here's another recent writeup: http://dev.opera.com/articles/view/how-to-serve-the-right-content-to-mobile/ I develop mobile games and websites, and I never use the User Agent to alter site/presentation. Media queries and types are the way I handle this (sometimes creating separate mobile resources, but most of the time creating designs that adapt accordingly.) All this to say, I don't use PHP to handle this aspect of the development. Adam -- Nephtali: A simple, flexible, fast, and security-focused PHP framework http://nephtaliproject.com
Re: [PHP] Headers on smart phone browsers
On Mon, 2012-02-06 at 14:28 -0600, Donovan Brooke wrote: Paul M Foster wrote: This is sort of obliquely related to PHP. I don't have a smart phone, but I need to know a couple of things: 1) Do smart phones use the same browsers as the desktop, or do they have their own stripped down versions of browsers? 2) When a browser broadcasts its header telling the server what kind of browser is involved, do they broadcast anything in the header to indicate that they're being run on a smart phone? 3) Bonus question: Is there a preferred method amongst coders to determine what type of environment is being browsed from, so as to serve up the proper type of page (desktop or smart phone version of a webpage)? Paul Hi Paul, I think this is a great PHP conversation.. and I don't understand why GOTO threads always get way more replies than something like this ;-) Diverse User Agent compatibility is going to be more and more of a challenge for us.. gone are the days of a few known browsers that are viewing our sites. From bots, to browsers, to mobile devices, to game UA's, to app UA's.., to IE's stubborn outlook on the web... the idea of user experience is growing complicated! ;-) I really liked Mari's posted link to the a list apart blog about responsive web design using media query (CSS).. however, it seems to me that it takes the use of many languages and techniques in many cases to get the job done... user agent serving (using PHP or JS or alike), flexible CSS and web design, and a keen eye on your target audience may all play apart. However, this is a PHP list.. and I think we can better approach this topic by limiting our scope to talk about how PHP could be useful. My first question, being that my first language is not PHP, is; is their any core PHP mobile detection functions/tools that exist? I have a running list of mobile UA's that I picked up somewhere that I often use and edit to distribute content accordingly. I also have a PHP mobile detection script that I picked up somewhere. I'm sure these things can be found via google as well. The problem, as Mari's link suggests, is that UA list's and browser sniffing scripts need maintaining quite regularly, since mobile UA's are being added on a weekly basis perhaps. Many of my projects do some PC UA (browser) sniffing.. especially for IE., as IE has it's own system that it uses for how to render content. Anyway, I'm happy to share what I have.. but like I said, PHP is not my first language, so I am interested to see what the more established PHP'ers may have to say. Donovan -- D Brooke Keeping a PHP angle to this, have you looked at using an up-to-date browscap.ini file with PHP? Basically, you can use that to read in the raw user agent string from the browser, and it then finds a matching entry in the ini file and gives you back some values about what it can assume about that device, such as whether it is known to support Java (although this is something you should be careful of, as it only tells you if it's is supported, not if there is an available JVM), if it is a mobile or search bot, what version of CSS it should support, etc. I use it myself in a personal web stats script, and as long as you keep the copy of the ini file recent, you should be OK. -- Thanks, Ash http://www.ashleysheridan.co.uk
Re: [PHP] Headers on smart phone browsers
On 6 Feb 2012, at 05:58, Paul M Foster wrote: This is sort of obliquely related to PHP. I don't have a smart phone, but I need to know a couple of things: There are simulators available for most smartphones. 1) Do smart phones use the same browsers as the desktop, or do they have their own stripped down versions of browsers? The trend is certainly moving towards full desktop capability, but personally I still think that if you expect a significant amount of traffic from mobile devices then your site should adapt accordingly. 2) When a browser broadcasts its header telling the server what kind of browser is involved, do they broadcast anything in the header to indicate that they're being run on a smart phone? Yes, but there's no standard at the moment so detection requires something similar to https://gist.github.com/1124666. That code is pretty old, and I can't remember where I got it, but at the time it worked really well. 3) Bonus question: Is there a preferred method amongst coders to determine what type of environment is being browsed from, so as to serve up the proper type of page (desktop or smart phone version of a webpage)? Generally speaking you're better off with a design that automatically adapts to the viewport on which it's being displayed. While there's more than one reason for this, the overriding reason is that the same software (i.e. the same user agent) could be running on any size of device, from watch to huge flat panel screen on a wall. I think the world needs to move on from is it a mobile device or not to accepting the reality which is that the browser / OS is irrelevant, and that the way your site renders should be purely based upon the size of the display. Responsive designs such as that described in the A List Apart article Mari posted are fantastic tools for achieving this goal. -Stuart -- Stuart Dallas 3ft9 Ltd http://3ft9.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Headers on smart phone browsers
On Mon, Feb 6, 2012 at 3:50 PM, Adam Richardson simples...@gmail.comwrote: On Mon, Feb 6, 2012 at 12:58 AM, Paul M Foster pa...@quillandmouse.comwrote: This is sort of obliquely related to PHP. I don't have a smart phone, but I need to know a couple of things: 1) Do smart phones use the same browsers as the desktop, or do they have their own stripped down versions of browsers? Both, although more and more smart phones join the ranks of the desktop-quality browser every day (iPhone and Android both have very capable browsers, with the iPhone's omission of flash support being the biggest difference between these two.) 2) When a browser broadcasts its header telling the server what kind of browser is involved, do they broadcast anything in the header to indicate that they're being run on a smart phone? Yes, but that gets complicated quickly: http://www.zytrax.com/tech/web/mobile_ids.html 3) Bonus question: Is there a preferred method amongst coders to determine what type of environment is being browsed from, so as to serve up the proper type of page (desktop or smart phone version of a webpage)? To supplement the alistapart link already mentioned, here's another recent writeup: http://dev.opera.com/articles/view/how-to-serve-the-right-content-to-mobile/ Apologies, I sent the wrong link last time: http://dev.opera.com/articles/view/the-mobile-web-optimization-guide/ Adam
Re: [PHP] Headers on smart phone browsers
the way your site renders should be purely based upon the size of the display. Although I mostly agree with this statement, it ignores the most interesting aspects of mobile technology, such as being able to ask the user for their GPS location and deliver content accordingly. I worked on some real estate websites that would show the user the houses for sale within a certai distance from where they were standing, and then leverage Google Maps for a get directions from where you are feature. The Mobile Web list has had some interesting discussions regarding this stuff... http://groups.yahoo.com/group/mobile-web/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Headers on smart phone browsers
On 6 Feb 2012, at 21:12, Marc Guay wrote: the way your site renders should be purely based upon the size of the display. Although I mostly agree with this statement, it ignores the most interesting aspects of mobile technology, such as being able to ask the user for their GPS location and deliver content accordingly. I worked on some real estate websites that would show the user the houses for sale within a certai distance from where they were standing, and then leverage Google Maps for a get directions from where you are feature. The Mobile Web list has had some interesting discussions regarding this stuff... http://groups.yahoo.com/group/mobile-web/ On the contrary, my statement dealt only with the way a site renders, not the content it renders. We should definitely be taking advantage of the additional features of mobile devices where it makes sense because that's where the real game-changing power lies. -Stuart -- Stuart Dallas 3ft9 Ltd http://3ft9.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Headers on smart phone browsers
On Mon, Feb 06, 2012 at 02:28:42PM -0600, Donovan Brooke wrote: Paul M Foster wrote: This is sort of obliquely related to PHP. I don't have a smart phone, but I need to know a couple of things: 1) Do smart phones use the same browsers as the desktop, or do they have their own stripped down versions of browsers? 2) When a browser broadcasts its header telling the server what kind of browser is involved, do they broadcast anything in the header to indicate that they're being run on a smart phone? 3) Bonus question: Is there a preferred method amongst coders to determine what type of environment is being browsed from, so as to serve up the proper type of page (desktop or smart phone version of a webpage)? Paul Hi Paul, I think this is a great PHP conversation.. and I don't understand why GOTO threads always get way more replies than something like this ;-) See religion (n), defs 1-10. Diverse User Agent compatibility is going to be more and more of a challenge for us.. gone are the days of a few known browsers that are viewing our sites. From bots, to browsers, to mobile devices, to game UA's, to app UA's.., to IE's stubborn outlook on the web... the idea of user experience is growing complicated! ;-) Well, cursory research shows there are at least 12 different major layout engines underneath modern browsers. Multiply that by versions of same, different OSes on which each run, versions of the OSes themselves, etc. etc. etc. I don't envy the job of any piece of code which tries to analyze all this. Plus, I believe that in the future, handhelds (specifically smart phones) will approach desktops in screen resolution. I really liked Mari's posted link to the a list apart blog about responsive web design using media query (CSS).. however, it seems to me that it takes the use of many languages and techniques in many cases to get the job done... user agent serving (using PHP or JS or alike), flexible CSS and web design, and a keen eye on your target audience may all play apart. Not to mention that W3C has all but abandoned its efforts to standardize HTML5. They will likely follow the path of browsers in simple de facto standardization. However, this is a PHP list.. and I think we can better approach this topic by limiting our scope to talk about how PHP could be useful. My first question, being that my first language is not PHP, is; is their any core PHP mobile detection functions/tools that exist? From what I've seen, only the get_browser() function, which depends on the existence of a browsecap file, which may or may not be installed on your system. And if it is, it's 300K in size, and introduces significant latency to page loads as a result. I have a running list of mobile UA's that I picked up somewhere that I often use and edit to distribute content accordingly. I also have a PHP mobile detection script that I picked up somewhere. I'm sure these things can be found via google as well. The problem, as Mari's link suggests, is that UA list's and browser sniffing scripts need maintaining quite regularly, since mobile UA's are being added on a weekly basis perhaps. I suspect that's more as a result of everything sniffer scripts do. They don't just detect the platform, but a variety of other things as well. Many of my projects do some PC UA (browser) sniffing.. especially for IE., as IE has it's own system that it uses for how to render content. Anyway, I'm happy to share what I have.. but like I said, PHP is not my first language, so I am interested to see what the more established PHP'ers may have to say. How about this: those of you with iPhones, Androids and the like, point your phones at a page which reports $_SERVER['HTTP_USER_AGENT'] (like a page which runs the phpinfo() function), and post what you get back from that exercise and what device made the query. I'd like to see if there is anything significant which indicates handheld platforms. Paul -- Paul M. Foster http://noferblatz.com http://quillandmouse.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Headers on smart phone browsers
On Mon, Feb 06, 2012 at 09:02:34PM +, Ashley Sheridan wrote: [snip] Keeping a PHP angle to this, have you looked at using an up-to-date browscap.ini file with PHP? Basically, you can use that to read in the raw user agent string from the browser, and it then finds a matching entry in the ini file and gives you back some values about what it can assume about that device, such as whether it is known to support Java (although this is something you should be careful of, as it only tells you if it's is supported, not if there is an available JVM), if it is a mobile or search bot, what version of CSS it should support, etc. I use it myself in a personal web stats script, and as long as you keep the copy of the ini file recent, you should be OK. The issue with this (according to the get_browser() docs) is that the browsecap file is 300K long, will get longer, and significantly slows loading of your applications. Moreover, the parsing of the UA string and other data is far more extensive than anything I'd want or could use. The only thing I'd want to know is whether I'm serving pages to a handheld or desktop device. From what I've seen, pages built for handheld devices (see, for example, yahoo.mobi) are considerably stripped down, often with no CSS styling. For now, if I have to make the decision on whether to serve up desktop or handheld versions of a page, all I want to know is a yes or no answer to the question of, Is this a handheld? The native PHP get_browser() function appears to be overkill for that, and may, in fact be insufficient. That was the origin of the original questions-- was there some definitive way of knowing the platform when the page request came in. And from all the research I've done, the answer is, No. The UA string may not work as intended. There are javascript sniffers and CSS triggers, but neither are they definitive. For example, the CSS triggers test for resolution or screen width or the like. This is fine, so long as handhelds remain at crappy resolutions. But I don't expect that to be the case forever. Paul -- Paul M. Foster http://noferblatz.com http://quillandmouse.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Headers on smart phone browsers
Ashley Sheridan wrote: [snip] Keeping a PHP angle to this, have you looked at using an up-to-date browscap.ini file with PHP? Basically, you can use that to read in the raw user agent string from the browser, and it then finds a matching entry in the ini file and gives you back some values about what it can assume about that device, such as whether it is known to support Java (although this is something you should be careful of, as it only tells you if it's is supported, not if there is an available JVM), if it is a mobile or search bot, what version of CSS it should support, etc. I use it myself in a personal web stats script, and as long as you keep the copy of the ini file recent, you should be OK. Interesting, I will check that out. Donovan -- D Brooke -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Headers on smart phone browsers
Stuart Dallas wrote: On 6 Feb 2012, at 21:12, Marc Guay wrote: the way your site renders should be purely based upon the size of the display. Although I mostly agree with this statement, it ignores the most interesting aspects of mobile technology, such as being able to ask the user for their GPS location and deliver content accordingly. I worked on some real estate websites that would show the user the houses for sale within a certai distance from where they were standing, and then leverage Google Maps for a get directions from where you are feature. The Mobile Web list has had some interesting discussions regarding this stuff... http://groups.yahoo.com/group/mobile-web/ On the contrary, my statement dealt only with the way a site renders, not the content it renders. We should definitely be taking advantage of the additional features of mobile devices where it makes sense because that's where the real game-changing power lies. -Stuart Right, the OP doesn't state the purpose exactly (design, function, etc..)... but even if it was design, as noted in Mari's link toward the bottom, responsive web design is not supported the same in all platforms... this is why I think, in many situations, a mix of UA detection and versatile design is still relevant (even in design). Donovan -- D Brooke -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Headers on smart phone browsers
On Mon, Feb 06, 2012 at 04:04:28PM -0500, Adam Richardson wrote: On Mon, Feb 6, 2012 at 3:50 PM, Adam Richardson [1]simples...@gmail.com wrote: On Mon, Feb 6, 2012 at 12:58 AM, Paul M Foster [2]pa...@quillandmouse.com wrote: This is sort of obliquely related to PHP. I don't have a smart phone, but I need to know a couple of things: 1) Do smart phones use the same browsers as the desktop, or do they have their own stripped down versions of browsers? Both, although more and more smart phones join the ranks of the desktop-quality browser every day (iPhone and Android both have very capable browsers, with the iPhone's omission of flash support being the biggest difference between these two.) � 2) When a browser broadcasts its header telling the server what kind of browser is involved, do they broadcast anything in the header to indicate that they're being run on a smart phone? Yes, but that gets complicated quickly: [3]http://www.zytrax.com/tech/web/mobile_ids.html � This gets directly at the answer, but also proves that there's no practical way of using the information. There are simply too many variations, and more to come. Great reference. I didn't find it in my prior research on Google. 3) Bonus question: Is there a preferred method amongst coders to determine what type of environment is being browsed from, so as to serve up the proper type of page (desktop or smart phone version of a webpage)? To supplement the alistapart link already mentioned, here's another recent writeup: [4]http://dev.opera.com/articles/view/how-to-serve-the-right-content-to-mobile/ Apologies, I sent the wrong link last time: [5]http://dev.opera.com/articles/view/the-mobile-web-optimization-guide/ Adam Thanks, Paul -- Paul M. Foster http://noferblatz.com http://quillandmouse.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Headers on smart phone browsers
On Mon, Feb 06, 2012 at 09:01:45PM +, Stuart Dallas wrote: On 6 Feb 2012, at 05:58, Paul M Foster wrote: This is sort of obliquely related to PHP. I don't have a smart phone, but I need to know a couple of things: There are simulators available for most smartphones. 1) Do smart phones use the same browsers as the desktop, or do they have their own stripped down versions of browsers? The trend is certainly moving towards full desktop capability, but personally I still think that if you expect a significant amount of traffic from mobile devices then your site should adapt accordingly. 2) When a browser broadcasts its header telling the server what kind of browser is involved, do they broadcast anything in the header to indicate that they're being run on a smart phone? Yes, but there's no standard at the moment so detection requires something similar to https://gist.github.com/1124666. That code is pretty old, and I can't remember where I got it, but at the time it worked really well. 3) Bonus question: Is there a preferred method amongst coders to determine what type of environment is being browsed from, so as to serve up the proper type of page (desktop or smart phone version of a webpage)? Generally speaking you're better off with a design that automatically adapts to the viewport on which it's being displayed. While there's more than one reason for this, the overriding reason is that the same software (i.e. the same user agent) could be running on any size of device, from watch to huge flat panel screen on a wall. I think the world needs to move on from is it a mobile device or not to accepting the reality which is that the browser / OS is irrelevant, and that the way your site renders should be purely based upon the size of the display. Responsive designs such as that described in the A List Apart article Mari posted are fantastic tools for achieving this goal. I'm inclined to agree. In fact, my daughter, who owns an iPhone, hates the mobile-only webpages and will normally opt to see the full (desktop) website, even on her iPhone. She'd rather gesture around the original website than see a vastly simplified version with everything vertically stacked, as it often is on strictly mobile sites. Paul -- Paul M. Foster http://noferblatz.com http://quillandmouse.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Headers on smart phone browsers
Paul M Foster wrote: [snip] How about this: those of you with iPhones, Androids and the like, point your phones at a page which reports $_SERVER['HTTP_USER_AGENT'] (like a page which runs the phpinfo() function), and post what you get back from that exercise and what device made the query. I'd like to see if there is anything significant which indicates handheld platforms. Paul Logical, but I can save you that step :-) as I've been there done that.. Here is a PHP script (uses $_SESSION) for mobile users that I have found to work fairly well. I'm absolutely sure that it contains false positives, and potentially other minor bugs.. as it's just hard to keep up with the ever changing UA's... but it's a start. If it gets munged from email returns, I can zip it up. Donovan *INCLUDE IN HEAD --start ?php // ** Make sure to replace URL with your mobile URL below ** // Head include('device_detect.php');// session_start(); $is_mobile = mobile_device_detect(); if ($is_mobile) { header(Location: URL); die(); } ? --end SAVE TO A FILE CALLED 'device_detect.php' --start ?php // device_detect.php function mobile_device_detect(){ //check if force pc is requested $forcepc = isset($_REQUEST['forcepc']) ? $_REQUEST['forcepc']: 'false'; if ($forcepc == 'true') { $_SESSION['forcepc'] = 'true'; return false; } else if (isset($_SESSION['forcepc'])) { $forcepc = $_SESSION['forcepc']; if ($forcepc == 'true') { return false; } } else { $_SESSION['forcepc'] = 'false'; } if (isset($_SESSION['mobiledevicedetect'])) { return $_SESSION['mobiledevicedetect']; } //check if a profile header is indicated //this is a very good indication it is a mobile device if (isset($_SERVER['HTTP_X_WAP_PROFILE']) || isset($_SERVER['HTTP_PROFILE'])) { $_SESSION['mobiledevicedetect'] = true; return true; } $user_agent = $_SERVER['HTTP_USER_AGENT']; // get the user agent value - this should be cleaned to ensure no nefarious input gets executed $accept = $_SERVER['HTTP_ACCEPT']; // get the accept header value switch(true){ // using a switch against the following statements which could return true is more efficient than the previous method of using if statements case (eregi('ipod',$user_agent)||eregi('iphone',$user_agent)); // we find the words iphone or ipod in the user agent $_SESSION['mobiledevicedetect'] = true; return true; break; case (preg_match('/(nokia|sonyericsson|samsung|up.browser|up.link)/i',$user_agent)); // we find palm os in the user agent - the i at the end makes it case insensitive $_SESSION['mobiledevicedetect'] = true; return true; break; case (eregi('android',$user_agent)); // we find android in the user agent $_SESSION['mobiledevicedetect'] = true; return true; break; case (eregi('opera mini',$user_agent)); // we find opera mini in the user agent $_SESSION['mobiledevicedetect'] = true; return true; break; case (eregi('blackberry',$user_agent)); // we find blackberry in the user agent $_SESSION['mobiledevicedetect'] = true; return true; break; case (preg_match('/(palm os|palm|hiptop|avantgo|plucker|xiino|blazer|elaine|treo)/i',$user_agent)); // we find palm os in the user agent - the i at the end makes it case insensitive $_SESSION['mobiledevicedetect'] = true; return true; break; case (preg_match('/(windows ce; ppc;|windows ce; smartphone;|windows ce; iemobile)/i',$user_agent)); // we find windows mobile in the user agent - the i at the end makes it case insensitive $_SESSION['mobiledevicedetect'] = true; return true; break; case ((strpos($accept,'text/vnd.wap.wml')0)||(strpos($accept,'application/vnd.wap.xhtml+xml')0)); // is the device showing signs of support for text/vnd.wap.wml or application/vnd.wap.xhtml+xml $_SESSION['mobiledevicedetect'] = true; return true; break; case
Re: [PHP] Headers on smart phone browsers
Mari Masuda wrote: [snip] For a concrete example of responsive design in action, point your browser to http://www.sasquatchfestival.com/ and then slowly make the window wider/skinnier to see how the design adapts to different viewport sizes. Very nice... makes for an easy display to a wide range of circumstances I think.. especially image resizing (in the blog example), which looks pretty smooth. But, in both the examples, it appears it can produce a choppy user experience when resizing the window as well... I suppose that resizing could be viewed as one of those 80/20 percent rule things.. meaning, window resizing is probably not a prevalent action for a user and it could be argued that one shouldn't code a site worrying too much about dynamic window resizing... but then there is a form of resizing, which is turning your iPAD to landscape view, etc.. I suppose one could probably still do some UA detection and serve up content based on the type of UA (ie. mobile, IE, game-based) and at that point, still incorporate responsive web design, but to that more-limited-category of UA's. Donovan -- D Brooke -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Headers on smart phone browsers
This is sort of obliquely related to PHP. I don't have a smart phone, but I need to know a couple of things: 1) Do smart phones use the same browsers as the desktop, or do they have their own stripped down versions of browsers? 2) When a browser broadcasts its header telling the server what kind of browser is involved, do they broadcast anything in the header to indicate that they're being run on a smart phone? 3) Bonus question: Is there a preferred method amongst coders to determine what type of environment is being browsed from, so as to serve up the proper type of page (desktop or smart phone version of a webpage)? Paul -- Paul M. Foster http://noferblatz.com http://quillandmouse.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Headers on smart phone browsers
On Feb 5, 2012, at 9:58 PM, Paul M Foster wrote: [snip] 3) Bonus question: Is there a preferred method amongst coders to determine what type of environment is being browsed from, so as to serve up the proper type of page (desktop or smart phone version of a webpage)? [snip] You should read up on responsive web design. http://www.alistapart.com/articles/responsive-web-design/ should get you started. HTH! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Headers already sent
Thanks. That was the problem. I spent a day trying to debug this. Smash head against wall first, ask questions later. That's my methodology as well. :) Marc -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Headers already sent
Perhaps your server is configured to have output buffering enabled by default? Check php.ini / phpinfo(). --Larry Garfield On 11/11/2011 12:12 AM, Kranthi Krishna wrote: Hi all, I am missing something pretty obvious here. The PHP Manual says Remember that header() must be called before any actual output is sent, either by normal HTML tags, blank lines in a file, or from PHP.. A simple test case shows otherwise I have the following code test ?php setcookie(TestCookie, 'test'); nothing more nothing less.. only this code in a file I get the output in the browser (test) AND the cookie is set (verified by live HTTP headers). Any ides on why this is happening ? Linux localhost 2.6.40-4.fc15.i686 #1 SMP Fri Jul 29 18:54:39 UTC 2011 i686 Apache 2.0 Handler Zend Engine v2.3.0, Xdebug v2.1.2 PHP 5.3.6 Kranthi. http://goo.gl/e6t3 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Headers already sent
Hi, Perhaps your server is configured to have output buffering enabled by default Thanks. That was the problem. I spent a day trying to debug this. Kranthi. http://goo.gl/e6t3 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] headers help
Hello all, I must confess I know the very basics on this language and have even less knowledge about http headers. I wish you could help me out on this: I have a form that sends html e-mails and an optional file as attachment. The issue is that, if the file is NOT send, the e-mail receives two times the same content, one that gets read by the mail clients as HTML properly, and, a literal print of my $message string variable that contains: html head /head boby tableMy form contents/table /body /html I believe that the reason for this lies on the $header options, probably on line number 8 ? Here is the, what I believe, is the relevant code: http://pastebin.com/5ywdK0UU What should I do, to avoid this extra html code on the e-mail messages ? Thanks in advance, Márcio
[PHP] headers: setting right for browser to force reload at a certain point in time
Hi All, We have an application that generates dynamic ebooks. One of the (minor) problems (but yet annoying) is that when a user comes back to an ebook, they have to actually delete the cache and reload the page to not get the cached version which might be wrong because the content or even the flash application is updated. It would be neat if we could force a reload of the page, but only with a special condition like the ebook being updated or the swf. The swf and also the other resources are not reloaded though, because it is a get request. Is there a way to force a reload of the browser by maybe changing the headers? Or do we have to do some fancy stuff like storing a cookie with the time and sending it back via ajax or something like that? Just setting the header would be nice... Maybe the easiest would be to change the link (add a number or something) of the html page and have a rewrite for all the relative urls as well. Regards, Tim Tim-Hinnerk Heuer http://www.ihostnz.com Henny Youngman - When I told my doctor I couldn't afford an operation, he offered to touch-up my X-rays.
Re: [PHP] headers: setting right for browser to force reload at a certain point in time
German Geek wrote: Hi All, We have an application that generates dynamic ebooks. One of the (minor) problems (but yet annoying) is that when a user comes back to an ebook, they have to actually delete the cache and reload the page to not get the cached version which might be wrong because the content or even the flash application is updated. Deleting the cache should not be necessary, a reload should be enough. (it certainly is with Firefox). It would be neat if we could force a reload of the page, but only with a special condition like the ebook being updated or the swf. The swf and also the other resources are not reloaded though, because it is a get request. The request type has nothing to do with it - the browser will do a conditional GET if the local copy is expired. Just set the right expiry time on your files when you serve them, then they will automatically be checked by the browser. /Per -- Per Jessen, Zürich (2.8°C) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] headers: setting right for browser to force reload at a certain point in time
Yes, that's what i thought, but with my FF 3.0 the resources (swf,png,jpg) don't get reloaded. I have to reload the page (after deleting cache). Something to do with the Apache configuration? ?? Thanks for the reply. Tim-Hinnerk Heuer http://www.ihostnz.com Laurence J. Peter - If two wrongs don't make a right, try three. 2009/2/23 Per Jessen p...@computer.org German Geek wrote: Hi All, We have an application that generates dynamic ebooks. One of the (minor) problems (but yet annoying) is that when a user comes back to an ebook, they have to actually delete the cache and reload the page to not get the cached version which might be wrong because the content or even the flash application is updated. Deleting the cache should not be necessary, a reload should be enough. (it certainly is with Firefox). It would be neat if we could force a reload of the page, but only with a special condition like the ebook being updated or the swf. The swf and also the other resources are not reloaded though, because it is a get request. The request type has nothing to do with it - the browser will do a conditional GET if the local copy is expired. Just set the right expiry time on your files when you serve them, then they will automatically be checked by the browser. /Per -- Per Jessen, Zürich (2.8°C) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] headers: setting right for browser to force reload at a certain point in time
German Geek wrote: Yes, that's what i thought, but with my FF 3.0 the resources (swf,png,jpg) don't get reloaded. I have to reload the page (after deleting cache). Something to do with the Apache configuration? Hi Tim, Try loading up just a single file in FF - one of your graphics for instance - then hit Ctrl-i to get the info page. That will tell you exactly how FF sees the file - expiry time etc. /Per -- Per Jessen, Zürich (2.6°C) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] headers: setting right for browser to force reload at a certain point in time
2009/2/23 Per Jessen p...@computer.org German Geek wrote: Yes, that's what i thought, but with my FF 3.0 the resources (swf,png,jpg) don't get reloaded. I have to reload the page (after deleting cache). Something to do with the Apache configuration? Hi Tim, Try loading up just a single file in FF - one of your graphics for instance - then hit Ctrl-i to get the info page. That will tell you exactly how FF sees the file - expiry time etc. Hi Per, Thanks. But: This didn't work. ctrl+i brought up my bookmarks. ?? Do i need a special plugin/extension? Have web developer etc. I have Firebug but in the net tab the cached resources don't show up when reloading the page, i guess because they are not reloaded... So, i can't think of a way how to see that information when it is in cache. I had followed some examples on the web talking about the e-tag header which changes the checksum when the file changes, also i remember setting the expiry to yesterday and things like that... However it all didn't work. Anyway, i might just force a reload by changing the links every time dynamically, although it seems a bit overkill :-S. Tim-Hinnerk Heuer http://www.ihostnz.com P. J. O'Rourke - Everybody knows how to raise children, except the people who have them. /Per -- Per Jessen, Zürich (2.6°C) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] headers: setting right for browser to force reload at a certain point in time
German Geek wrote: This didn't work. ctrl+i brought up my bookmarks. ?? Do i need a special plugin/extension? Have web developer etc. Nope, this is standard FF. Ctrl+i should give you the Page Info window. Try looking for that in your menubar and pulldowns. -- Per Jessen, Zürich (3.1°C) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Can Safari 3 be forced to cache a large jpeg with PHP headers?
Chris wrote: Rob Gould wrote: I am creating a touch-screen kiosk application, using a full-screen version of Safari 3.1, and was wondering if there's a way I can force Safari to cache a large background image JPEG. What I'm finding is that Safari 3 will sometimes cache my large 1.1 MB background image (1680x1050), and display perfectly fine, but on occassion Safari 3 will think about the cache and Flash the screen white for a millisecond and then draw the screen. Firefox doesn't seem to have this problem, so unfortunately this is a Safari 3 only issue. I really only want to cache this ONE image - - - nothing else. Is that possible? How are you sending it? through a php script or through a normal html tag? If it's through a php script, try setting a far-future expiry header. Yeah PHP can send out appropriate headers to tell the browser to cache the content delivered. You just use header() with appropriate Cache-Control and Pragma etc. headers. There are lots of good resources out there on how to do this so just google around now you know the concept :) Col -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Can Safari 3 be forced to cache a large jpeg with PHP headers?
I am creating a touch-screen kiosk application, using a full-screen version of Safari 3.1, and was wondering if there's a way I can force Safari to cache a large background image JPEG. What I'm finding is that Safari 3 will sometimes cache my large 1.1 MB background image (1680x1050), and display perfectly fine, but on occassion Safari 3 will think about the cache and Flash the screen white for a millisecond and then draw the screen. Firefox doesn't seem to have this problem, so unfortunately this is a Safari 3 only issue. I really only want to cache this ONE image - - - nothing else. Is that possible? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Can Safari 3 be forced to cache a large jpeg with PHP headers?
Rob Gould wrote: I am creating a touch-screen kiosk application, using a full-screen version of Safari 3.1, and was wondering if there's a way I can force Safari to cache a large background image JPEG. What I'm finding is that Safari 3 will sometimes cache my large 1.1 MB background image (1680x1050), and display perfectly fine, but on occassion Safari 3 will think about the cache and Flash the screen white for a millisecond and then draw the screen. Firefox doesn't seem to have this problem, so unfortunately this is a Safari 3 only issue. I really only want to cache this ONE image - - - nothing else. Is that possible? How are you sending it? through a php script or through a normal html tag? If it's through a php script, try setting a far-future expiry header. -- Postgresql php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] headers-excel file-bad data
On Tue, July 31, 2007 12:32 pm, blackwater dev wrote: I have an excel file that I am generating. If I copy over the generated file and then open it in excel, it works fine, if I try to let the user download it using the headers below, when I then open it excel complains that it is an unrecognizable format and the info is garbled...any ideas??? Thanks! header('Pragma: public'); header(Expires: Mon, 26 Jul 1997 05:00:00 GMT); // Date in the past header('Last-Modified: '.gmdate('D, d M Y H:i:s') . ' GMT'); header('Cache-Control: no-store, no-cache, must-revalidate'); // HTTP/1.1 header('Cache-Control: pre-check=0, post-check=0, max-age=0'); // HTTP/1.1 header (Pragma: no-cache); header(Expires: 0); header('Content-Transfer-Encoding: none'); header('Content-Type: application/vnd.ms-excel;'); // This should work for IE Opera header(Content-type: application/x-msexcel); // This should work for the rest header('Content-Disposition: attachment; filename=myfile.xls'); readfile(/tmp/myfile.xls); Copy it over how?... Plus, I gotta tell ya, all those goofy extra headers are simply NOT doing what you think they are... First of all, unless you add a , TRUE as a second arg, each header() call with the same XXX: start is REPLACING the previous ones. So you are ALWAYS using Content-type: application/x-msexcel and you might as well rip the rest of them out. Some headers can have multiple instances (Cache-control) but you only get ONE Content-type. Period. You should also compare the actual bytes of the file you get from the download with the file you copied over. Did PHP add something or strip something out? Usually this problem has a self-evident solution once you identify the problem, so I'll say no more in this vein. And, finally, if you want to support legacy browsers and all kinds of gotchas with downloads, read this rant: http://richardlynch.blogspot.com/2006/06/php-downloads-content-disposition.html ymmv -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] headers-excel file-bad data
Hello, I have an excel file that I am generating. If I copy over the generated file and then open it in excel, it works fine, if I try to let the user download it using the headers below, when I then open it excel complains that it is an unrecognizable format and the info is garbled...any ideas??? Thanks! header('Pragma: public'); header(Expires: Mon, 26 Jul 1997 05:00:00 GMT); // Date in the past header('Last-Modified: '.gmdate('D, d M Y H:i:s') . ' GMT'); header('Cache-Control: no-store, no-cache, must-revalidate'); // HTTP/1.1 header('Cache-Control: pre-check=0, post-check=0, max-age=0');// HTTP/1.1 header (Pragma: no-cache); header(Expires: 0); header('Content-Transfer-Encoding: none'); header('Content-Type: application/vnd.ms-excel;'); // This should work for IE Opera header(Content-type: application/x-msexcel);// This should work for the rest header('Content-Disposition: attachment; filename=myfile.xls'); readfile(/tmp/myfile.xls);
Re: [PHP] headers-excel file-bad data
At 1:32 PM -0400 7/31/07, blackwater dev wrote: Hello, I have an excel file that I am generating. If I copy over the generated file and then open it in excel, it works fine, if I try to let the user download it using the headers below, when I then open it excel complains that it is an unrecognizable format and the info is garbled...any ideas??? Yes, an idea -- this might be due to a bug that's found in excel files if a value exist (or doesn't) in the first cell or column of the spreadsheet. I vaguely remember running into that several years ago. You can Google excel bug first cell HTH, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] headers and newline at end of script
I'm looking for an opinion on programming style. Basicaly, I make systems using PEAR::DB and PEAR::HTML_Template_IT. This last one puts all the HTML away from the PHP code, which has made life much easier. Now, sometimes I warning messages like this one: PHP Warning: Cannot modify header information - headers already sent in I know what it means, so I just look for newlines at the end of my PHP scripts, especially after the closing ? and delete them. Now, my question is: Is it a bad practice to NOT close the script with the PHP closing ?? I mean, just leave the script without a closing PHP simbols, as this scripts are included? -- 21:50:04 up 2 days, 9:07, 0 users, load average: 0.92, 0.37, 0.18 - Lic. Martín Marqués | SELECT 'mmarques' || Centro de Telemática| '@' || 'unl.edu.ar'; Universidad Nacional| DBA, Programador, del Litoral | Administrador - -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] headers and newline at end of script
Martin Marques wrote: I'm looking for an opinion on programming style. Basicaly, I make systems using PEAR::DB and PEAR::HTML_Template_IT. This last one puts all the HTML away from the PHP code, which has made life much easier. Now, sometimes I warning messages like this one: PHP Warning: Cannot modify header information - headers already sent in I know what it means, so I just look for newlines at the end of my PHP scripts, especially after the closing ? and delete them. Now, my question is: Is it a bad practice to NOT close the script with the PHP closing ?? I mean, just leave the script without a closing PHP simbols, as this scripts are included? I never add the final closing '?' in any script for this very reason. whether it's bad practice or I don't know (can't be any worse than the flamewar on internals@lists.php.net though ;-) -- 21:50:04 up 2 days, 9:07, 0 users, load average: 0.92, 0.37, 0.18 - Lic. Martín Marqués | SELECT 'mmarques' || Centro de Telemática| '@' || 'unl.edu.ar'; Universidad Nacional| DBA, Programador, del Litoral | Administrador - -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] headers and newline at end of script
Jochem Maas wrote: Martin Marques wrote: I'm looking for an opinion on programming style. Basicaly, I make systems using PEAR::DB and PEAR::HTML_Template_IT. This last one puts all the HTML away from the PHP code, which has made life much easier. Now, sometimes I warning messages like this one: PHP Warning: Cannot modify header information - headers already sent in I know what it means, so I just look for newlines at the end of my PHP scripts, especially after the closing ? and delete them. Now, my question is: Is it a bad practice to NOT close the script with the PHP closing ?? I mean, just leave the script without a closing PHP simbols, as this scripts are included? I never add the final closing '?' in any script for this very reason. 'Cause you're a SLACKER!!! -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] headers and newline at end of script
On Thu, 2006-07-20 at 11:30, John Nichel wrote: Jochem Maas wrote: Martin Marques wrote: I'm looking for an opinion on programming style. Basicaly, I make systems using PEAR::DB and PEAR::HTML_Template_IT. This last one puts all the HTML away from the PHP code, which has made life much easier. Now, sometimes I warning messages like this one: PHP Warning: Cannot modify header information - headers already sent in I know what it means, so I just look for newlines at the end of my PHP scripts, especially after the closing ? and delete them. Now, my question is: Is it a bad practice to NOT close the script with the PHP closing ?? I mean, just leave the script without a closing PHP simbols, as this scripts are included? I never add the final closing '?' in any script for this very reason. 'Cause you're a SLACKER!!! Some of the best coders are slackers... because they find better ways to code to prevent having to write so much code :) But to answer the question... http://marc.theaimsgroup.com/?l=php-devm=106896286829744w=2 http://marc.theaimsgroup.com/?l=php-devm=106896382030183w=2 Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] headers and newline at end of script
John Nichel wrote: Jochem Maas wrote: Martin Marques wrote: I'm looking for an opinion on programming style. Basicaly, I make systems using PEAR::DB and PEAR::HTML_Template_IT. This last one puts all the HTML away from the PHP code, which has made life much easier. Now, sometimes I warning messages like this one: PHP Warning: Cannot modify header information - headers already sent in I know what it means, so I just look for newlines at the end of my PHP scripts, especially after the closing ? and delete them. Now, my question is: Is it a bad practice to NOT close the script with the PHP closing ?? I mean, just leave the script without a closing PHP simbols, as this scripts are included? I never add the final closing '?' in any script for this very reason. 'Cause you're a SLACKER!!! no chance of me getting that code-bitch job you've been forced to write a 'test' for then? ;-) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] headers and newline at end of script
On Thu, 20 Jul 2006 11:30:14 -0400, John Nichel [EMAIL PROTECTED] wrote: Jochem Maas wrote: I never add the final closing '?' in any script for this very reason. 'Cause you're a SLACKER!!! What the hell is a SLACKER??? -- - Lic. Martín Marqués | SELECT 'mmarques' || Centro de Telemática| '@' || 'unl.edu.ar'; Universidad Nacional| DBA, Programador, del Litoral | Administrador - -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] headers and newline at end of script
I'd explain but it'd be too much work. James Kilbride -Original Message- From: Martin Marques [mailto:[EMAIL PROTECTED] Sent: Thursday, July 20, 2006 2:32 PM To: John Nichel Cc: php-general@lists.php.net Subject: Re: [PHP] headers and newline at end of script On Thu, 20 Jul 2006 11:30:14 -0400, John Nichel [EMAIL PROTECTED] wrote: Jochem Maas wrote: I never add the final closing '?' in any script for this very reason. 'Cause you're a SLACKER!!! What the hell is a SLACKER??? -- - Lic. Martín Marqués | SELECT 'mmarques' || Centro de Telemática| '@' || 'unl.edu.ar'; Universidad Nacional| DBA, Programador, del Litoral | Administrador - -- 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] headers and newline at end of script
He never said he didn't want you to do his coding, simply that you were a slacker. Considering he's self proclaimed 'lazy' just means the two of you should get on great and you'll probably understand his code better. James Kilbride SNIPPAGE(Jochem Maas wrote:) no chance of me getting that code-bitch job you've been forced to write a 'test' for then? ;-) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] headers and newline at end of script
On Thu, 2006-07-20 at 14:39, Kilbride, James P. wrote: He never said he didn't want you to do his coding, simply that you were a slacker. Considering he's self proclaimed 'lazy' just means the two of you should get on great and you'll probably understand his code better. Won't work because John needs to hire someone to do his work for him so he can better excel at slacking himself. Cheers, Rob. James Kilbride SNIPPAGE(Jochem Maas wrote:) no chance of me getting that code-bitch job you've been forced to write a 'test' for then? ;-) -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] headers and newline at end of script
Jochem Maas wrote: Martin Marques wrote: On Thu, 20 Jul 2006 11:30:14 -0400, John Nichel [EMAIL PROTECTED] wrote: Jochem Maas wrote: I never add the final closing '?' in any script for this very reason. 'Cause you're a SLACKER!!! What the hell is a SLACKER??? I'm a slacker. Which is why you aren't up for the job here. The slacker position belongs to me. -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] headers and newline at end of script
Martin Marques wrote: On Thu, 20 Jul 2006 11:30:14 -0400, John Nichel [EMAIL PROTECTED] wrote: Jochem Maas wrote: I never add the final closing '?' in any script for this very reason. 'Cause you're a SLACKER!!! What the hell is a SLACKER??? I'm a slacker. -- - Lic. Martín Marqués | SELECT 'mmarques' || Centro de Telemática| '@' || 'unl.edu.ar'; Universidad Nacional| DBA, Programador, del Litoral | Administrador - -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] headers already sent.
At 10:30 PM 04/07/2006, you wrote: Comment inline: Thanks, I just found that out after, well I don't want to say how long it took smile. Is that just the way things are in PHP or is there a command / configuration to make something like this more obvious? Hmmm. maybe the IDE I'm using? Using EnginSite. Is there a better one for a Windows Environment ? ( head banging against wall ) -Pete P. Guethlein wrote: (Know enough to be dangerous beginner...) Routine for a web login asked user name and password. User Name is entered correctly. Password is Incorrect. Next Try. User Name is enter correctly. Password is Entered Correctly. PHP notifies me on the html output that I am logged in. However, an error is appearing in text above the html output. It states Warning: Cannot modify header information - headers already sent by (output started at D:\webpages\\users.inc:11) in D:\webpages\\web\loginfunctions.php on line 26 Users.inc is == ?php $domain = 'localhost'; $admin = 'x'; $user = 'x'; $web = 'x'; $password = 'xx'; $site = 'x'; $leads = 'x'; ? This gap right here, it's outputting a carriage return and/or linefeed. headers get sent on the first character of output being sent. ?php // Configuration settings for My Site // Email Settings $mailsite['from_name'] = 'x Website'; // from email name $mailsite['from_email'] = '[EMAIL PROTECTED]'; // from email address // Just in case we need to relay to a different server, // provide an option to use external mail server. $mailsite['smtp_mode'] = 'enabled'; // enabled or disabled $mailsite['smtp_host'] = 'mail..xxx;mail.x2.xxx'; $mailsite['smtp_port'] = '25'; $mailsite['smtp_username'] = null; ? === Line 26 from the loginfunctions.php file is //now redirect the user to whatever page they wanted. header('Location: index.php?href='.$link); == I can anticipate what the problem is with the notification that PHP gives me with the headers already output. However, it says 'headers already sent by users.inc', huh? Suggestions of where to look on this bug is appreciated! -Pete -- 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] headers already sent.
There is no real way of knowing if output is going to be sent before a header or not, unless its a very simple page. Your best bet is to investigate the output buffering functions here: http://www.php.net/manual/en/ref.outcontrol.php HTH Steve P. Guethlein [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] At 10:30 PM 04/07/2006, you wrote: Comment inline: Thanks, I just found that out after, well I don't want to say how long it took smile. Is that just the way things are in PHP or is there a command / configuration to make something like this more obvious? Hmmm. maybe the IDE I'm using? Using EnginSite. Is there a better one for a Windows Environment ? ( head banging against wall ) -Pete P. Guethlein wrote: (Know enough to be dangerous beginner...) Routine for a web login asked user name and password. User Name is entered correctly. Password is Incorrect. Next Try. User Name is enter correctly. Password is Entered Correctly. PHP notifies me on the html output that I am logged in. However, an error is appearing in text above the html output. It states Warning: Cannot modify header information - headers already sent by (output started at D:\webpages\\users.inc:11) in D:\webpages\\web\loginfunctions.php on line 26 Users.inc is == ?php $domain = 'localhost'; $admin = 'x'; $user = 'x'; $web = 'x'; $password = 'xx'; $site = 'x'; $leads = 'x'; ? This gap right here, it's outputting a carriage return and/or linefeed. headers get sent on the first character of output being sent. ?php // Configuration settings for My Site // Email Settings $mailsite['from_name'] = 'x Website'; // from email name $mailsite['from_email'] = '[EMAIL PROTECTED]'; // from email address // Just in case we need to relay to a different server, // provide an option to use external mail server. $mailsite['smtp_mode'] = 'enabled'; // enabled or disabled $mailsite['smtp_host'] = 'mail..xxx;mail.x2.xxx'; $mailsite['smtp_port'] = '25'; $mailsite['smtp_username'] = null; ? === Line 26 from the loginfunctions.php file is //now redirect the user to whatever page they wanted. header('Location: index.php?href='.$link); == I can anticipate what the problem is with the notification that PHP gives me with the headers already output. However, it says 'headers already sent by users.inc', huh? Suggestions of where to look on this bug is appreciated! -Pete -- 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] headers already sent.
(Know enough to be dangerous beginner...) Routine for a web login asked user name and password. User Name is entered correctly. Password is Incorrect. Next Try. User Name is enter correctly. Password is Entered Correctly. PHP notifies me on the html output that I am logged in. However, an error is appearing in text above the html output. It states Warning: Cannot modify header information - headers already sent by (output started at D:\webpages\\users.inc:11) in D:\webpages\\web\loginfunctions.php on line 26 Users.inc is == ?php $domain = 'localhost'; $admin = 'x'; $user = 'x'; $web = 'x'; $password = 'xx'; $site = 'x'; $leads = 'x'; ? ?php // Configuration settings for My Site // Email Settings $mailsite['from_name'] = 'x Website'; // from email name $mailsite['from_email'] = '[EMAIL PROTECTED]'; // from email address // Just in case we need to relay to a different server, // provide an option to use external mail server. $mailsite['smtp_mode'] = 'enabled'; // enabled or disabled $mailsite['smtp_host'] = 'mail..xxx;mail.x2.xxx'; $mailsite['smtp_port'] = '25'; $mailsite['smtp_username'] = null; ? === Line 26 from the loginfunctions.php file is //now redirect the user to whatever page they wanted. header('Location: index.php?href='.$link); == I can anticipate what the problem is with the notification that PHP gives me with the headers already output. However, it says 'headers already sent by users.inc', huh? Suggestions of where to look on this bug is appreciated! -Pete -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] headers already sent.
Comment inline: P. Guethlein wrote: (Know enough to be dangerous beginner...) Routine for a web login asked user name and password. User Name is entered correctly. Password is Incorrect. Next Try. User Name is enter correctly. Password is Entered Correctly. PHP notifies me on the html output that I am logged in. However, an error is appearing in text above the html output. It states Warning: Cannot modify header information - headers already sent by (output started at D:\webpages\\users.inc:11) in D:\webpages\\web\loginfunctions.php on line 26 Users.inc is == ?php $domain = 'localhost'; $admin = 'x'; $user = 'x'; $web = 'x'; $password = 'xx'; $site = 'x'; $leads = 'x'; ? This gap right here, it's outputting a carriage return and/or linefeed. headers get sent on the first character of output being sent. ?php // Configuration settings for My Site // Email Settings $mailsite['from_name'] = 'x Website'; // from email name $mailsite['from_email'] = '[EMAIL PROTECTED]'; // from email address // Just in case we need to relay to a different server, // provide an option to use external mail server. $mailsite['smtp_mode'] = 'enabled'; // enabled or disabled $mailsite['smtp_host'] = 'mail..xxx;mail.x2.xxx'; $mailsite['smtp_port'] = '25'; $mailsite['smtp_username'] = null; ? === Line 26 from the loginfunctions.php file is //now redirect the user to whatever page they wanted. header('Location: index.php?href='.$link); == I can anticipate what the problem is with the notification that PHP gives me with the headers already output. However, it says 'headers already sent by users.inc', huh? Suggestions of where to look on this bug is appreciated! -Pete -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] headers .vs javascript location.href
chris, i'd already asked/explained the error. to reiterate, the error i'm getting is the error that's generated when you try to use the php 'header' function, and it throws a warning/error regarding 'headers already being sent...' the soln appears to be to use the php buffering functions, as this is supposed to stop output from being generated/posted, allowing the app to 'buffer' the output until the page is displayed. i've tried to use an 'ob_start()' as the very 1st line in the index.php page that's being displayed. i've also tried to insert the 'ob_start()' in a number of various places within the app with no change... my question was how/what could i possibly do, short of using the javascript soln, which seems to work... i also stated that i could readily provide the code that i'm creating if anyone wanted to take an actual look. and as i also stated, yeah, it could/should be cleaned up, but for now, it's a test app... -bruce -Original Message- From: Chris Shiflett [mailto:[EMAIL PROTECTED] Sent: Sunday, September 18, 2005 8:20 PM To: [EMAIL PROTECTED] Cc: 'php' Subject: Re: [PHP] headers .vs javascript location.href bruce wrote: need to talk to someone to figure out how/what i need to do to use the php 'headers' function, as opposed to the javascript 'location.href'. i've tried to implement the buffering functions, but still get the same error... is there someone that i can talk to about this, who ha experience/understanding of what's going on. i've thought about rewriting what i have to this point, but i've got code interspersed with html... yeah.. i know... cleaning it up would probably make things easier/better, but this is a quick/dirty test.. and i don't claim to be a web developer! You need to ask a question if you want to receive an answer. If your question really is whether there is anyone you can talk to, then the answer is yes. There are quite a few people on this list who know a great deal about the topics you mention. (You might want to start by clarifying the reference to the same error.) Chris -- Chris Shiflett Brain Bulb, The PHP Consultancy http://brainbulb.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] headers .vs javascript location.href
bruce wrote: i'd already asked/explained the error. to reiterate, the error i'm getting is the error that's generated when you try to use the php 'header' function, and it throws a warning/error regarding 'headers already being sent...' If you're absolutely certain that your script produces no output prior to the point where you call header(), then you might want to check to see whether an error is being generated - with display_errors enabled, these are included in the output stream. Also, just copy/paste your exact error here, and also include the lines indicated in the message (and a few lines before/after). I bet someone on this list can spot the problem. Hope that helps. Chris -- Chris Shiflett Brain Bulb, The PHP Consultancy http://brainbulb.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] headers .vs javascript location.href
On Sep 19, 2005, at 5:08 PM, Chris Shiflett wrote: bruce wrote: i'd already asked/explained the error. to reiterate, the error i'm getting is the error that's generated when you try to use the php 'header' function, and it throws a warning/error regarding 'headers already being sent...' If you're absolutely certain that your script produces no output prior to the point where you call header(), then you might want to check to see whether an error is being generated - with display_errors enabled, these are included in the output stream. Also, just copy/paste your exact error here, and also include the lines indicated in the message (and a few lines before/after). I bet someone on this list can spot the problem. Hope that helps. Chris -- Chris Shiflett Brain Bulb, The PHP Consultancy http://brainbulb.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php This is just a guess here bruce, but do you have any whitespace/line breaks before the PHP code starts? If so then you are generating output before you even get to the code. If you are using a config file of any kind you'll also need to make sure it has no whitespace/ line breaks before or after the code blocks. Again: just a guess. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] headers .vs javascript location.href
bruce wrote: need to talk to someone to figure out how/what i need to do to use the php 'headers' function, as opposed to the javascript 'location.href'. i've tried to implement the buffering functions, but still get the same error... is there someone that i can talk to about this, who ha experience/understanding of what's going on. i've thought about rewriting what i have to this point, but i've got code interspersed with html... yeah.. i know... cleaning it up would probably make things easier/better, but this is a quick/dirty test.. and i don't claim to be a web developer! You need to ask a question if you want to receive an answer. If your question really is whether there is anyone you can talk to, then the answer is yes. There are quite a few people on this list who know a great deal about the topics you mention. (You might want to start by clarifying the reference to the same error.) Chris -- Chris Shiflett Brain Bulb, The PHP Consultancy http://brainbulb.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] headers .vs javascript location.href
hi.. need to talk to someone to figure out how/what i need to do to use the php 'headers' function, as opposed to the javascript 'location.href'. i've tried to implement the buffering functions, but still get the same error... is there someone that i can talk to about this, who ha experience/understanding of what's going on. i've thought about rewriting what i have to this point, but i've got code interspersed with html... yeah.. i know... cleaning it up would probably make things easier/better, but this is a quick/dirty test.. and i don't claim to be a web developer! thanks -bruce [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] headers and session
Hi Alessandro try this as well (Put these lines before and after your redirect/header statement); session_write_close(); header( Location: .$PHPcmd ); exit(); hope this helps Angelo Zanetti Z Logic www.zlogic.co.za Alessandro Rosa wrote: Hi to all, I got a problem while storing session variables. ?php session_start(); header( Cache-control: private ); require_once(config.inc.php); $_SESSION['session_psw'] = $_POST['txtPassword']; $_SESSION['session_user'] = $_POST['txtIdUtente']; $PHPcmd = $GLOBALS['gestionale_path_name'].test/2.php ; header( Location: .$PHPcmd ); ? After the call to header(...), the values of session variables are lost. I think I should fix this up with some settings in my php.ini Could you help me, please? Alessandro Rosa -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] headers and session
Hi to all, I got a problem while storing session variables. ?php session_start(); header( Cache-control: private ); require_once(config.inc.php); $_SESSION['session_psw'] = $_POST['txtPassword']; $_SESSION['session_user'] = $_POST['txtIdUtente']; $PHPcmd = $GLOBALS['gestionale_path_name'].test/2.php ; header( Location: .$PHPcmd ); ? After the call to header(...), the values of session variables are lost. I think I should fix this up with some settings in my php.ini Could you help me, please? Alessandro Rosa -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] headers and session
Does config.inc.php have any whitespace following the closing ? tag, or does it output any HTML? That could be your culprit. What happens if you do your $_SESSION setting *before* the require, but directly after the initial header() call? He knew that header may give problems with whitespaces, but this was not the case. With regard to your secondo question, it works ! that is, the code now looks like: ?php session_start(); $_SESSION['session_psw'] = $_POST['txtPassword']; $_SESSION['session_user'] = $_POST['txtIdUtente']; header( Cache-control: private ); require_once(config.inc.php); $PHPcmd = $GLOBALS['gestionale_path_name'].test/2.php ; header( Location: .$PHPcmd ); ? But could someone explain me why ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] headers and session (2)
I want to thank you all for previous helpings. Really the first code was easy to be solved, but this is how it shall work out. This is a program running locally and the trouble is that session vars are stored in local files. I must avoid to store a plain text password therein, thus I need to crypt and save it into session. When 2.php file just displays session data (it is test environemnt), but the output is blank ! Suggest a different approach ? Alessandro Rosa ?php session_start(); require_once('crypting.php'); require_once(dirname(__FILE__).'/../mysql_wrap/mysql_man.php'); $handle_db = connect_to_mysql_server(); $psw = $_POST['txtPassword']; $psw = encrypt( $psw, get_crypt_key() ); sql_disconnect( $handle_db ); $_SESSION['session_user'] = $_POST['txtIdUtente']; $_SESSION['session_password'] = $psw; session_cache_limiter('private'); require_once(config.inc.php); $PHPcmd = $GLOBALS['gestionale_path_name'].phpcode/login/2.php ; header( Location: .$PHPcmd ); ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] headers and session (question)
Here's below the solution (the encryption will be shortly performed into login.php). 1 ?php 2 session_start(); 3 $_SESSION['session_user'] = $_POST['txtIdUtente']; 4 $_SESSION['session_password'] = $_POST['txtPassword']; 5 $PHPcmd = login.php ; 6 header( Location: .$PHPcmd ); 7 ? But a QUESTION now : if line 5 is replaced by these two lines, say here 5a and 5b: 5a require_once(config.inc.php); 5b $PHPcmd = $GLOBALS['gestionale_path_name'].phpcode/login/login.php ; this does not work (meaning user and psw are not passed to login.php); but again the below code works again: 5a require_once(config.inc.php); 5b $PHPcmd = $gestionale_path_name.phpcode/login/login.php ; Thanks, Alessandro -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Headers already sent error
Pls Make sure that outside your ?php and ? tags, these is no any blankspace or sth else. Best regards, Yang Shiqi -Original Message- From: Chris [mailto:[EMAIL PROTECTED] Sent: Thursday, February 03, 2005 3:44 PM To: [php] PHP General List Subject: Re: [PHP] Headers already sent error Tim Burgan wrote: Hello, I'm receiving an error Cannot modify header information - headers already sent by XXX. In my php, I have a heap of code, then use header(Location: blah.php); to redirect the user. I get this error on the webhost, but not on my local host. I've searched and found that this can be caused by spaces after the closing php tag, but I don't have any. What could this be? Tim Rest assured, *something* is getting output before you try that header() call. Anything outside of PHP tags (carriage rturns/line feeds/spaces) any echo or print. To help you figure it out, try doing something like exit('STARTOFBODY'); instead of the header call. Then view the source of the ouput and see what precedes that 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
[PHP] Headers already sent error
Hello, I'm receiving an error Cannot modify header information - headers already sent by XXX. In my php, I have a heap of code, then use header(Location: blah.php); to redirect the user. I get this error on the webhost, but not on my local host. I've searched and found that this can be caused by spaces after the closing php tag, but I don't have any. What could this be? Tim -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Headers already sent error
On Thu, 2005-02-03 at 12:59 +1030, Tim Burgan wrote: Hello, I'm receiving an error Cannot modify header information - headers already sent by XXX. In my php, I have a heap of code, then use header(Location: blah.php); to redirect the user. I get this error on the webhost, but not on my local host. I've searched and found that this can be caused by spaces after the closing php tag, but I don't have any. What could this be? Tim try adding: ob_start(); to the top of your file -Robby -- /*** * Robby Russell | Owner.Developer.Geek * PLANET ARGON | www.planetargon.com * Portland, OR | [EMAIL PROTECTED] * 503.351.4730 | blog.planetargon.com * PHP/PostgreSQL Hosting Development * --- Now hosting PostgreSQL 8.0! --- / -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Headers already sent error
Tim Burgan wrote: Hello, I'm receiving an error Cannot modify header information - headers already sent by XXX. In my php, I have a heap of code, then use header(Location: blah.php); to redirect the user. I get this error on the webhost, but not on my local host. I've searched and found that this can be caused by spaces after the closing php tag, but I don't have any. What could this be? Tim Rest assured, *something* is getting output before you try that header() call. Anything outside of PHP tags (carriage rturns/line feeds/spaces) any echo or print. To help you figure it out, try doing something like exit('STARTOFBODY'); instead of the header call. Then view the source of the ouput and see what precedes that Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Headers Again
PETCOL wrote: Unfortunately history tells me that php like ColdFusion will one day be bought out by the big corporates, or at least they'll have a considerable financial vested interest in it. Not likely. Since PHP is open source if Zend decided to change the license I'm certain it would be forked and continued as an open source project. This is the basis of why open source software is so popular and also why there is negligible gain to be had by Zend in changing the license. At which time we hope way off in the future, we'll all have to start paying for support and maintenance contracts. EVen if it did happen you'd be in no different a position than you are now. This mailing list is primarily user-supported and would likely continue even if PHP became a commercial product (which it won't - see above). If you want commercial support for PHP you can get it. And you'll pay for it. Allaire owned ColdFusion, the developer network was extremely co-operative, then joint venture between Macromedia and Allaire, now if you want good old assistance you need a Devnet contract. ColdFusion was never open source (afaik). That's the difference. For more info on what 'open source' actually means, see http://www.opensource.org/docs/definition.php -- Stuart -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Headers Again
--- PETCOL [EMAIL PROTECTED] wrote: Unfortunately history tells me that php like ColdFusion will one day be bought out by the big corporates, or at least they'll have a considerable financial vested interest in it. There's nothing to buy. Welcome to open source. 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] Headers Again
Stuart, Unfortunately history tells me that php like ColdFusion will one day be bought out by the big corporates, or at least they'll have a considerable financial vested interest in it. At which time we hope way off in the future, we'll all have to start paying for support and maintenance contracts. Allaire owned ColdFusion, the developer network was extremely co-operative, then joint venture between Macromedia and Allaire, now if you want good old assistance you need a Devnet contract. Cheers, I'm going to bed. Col Stuart [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] PETCOL wrote: Stuart Thank you. Don't thank me[1], thank them. Preferably with cash[2]. [1] I will accept cash if offered. [2] http://marc.theaimsgroup.com/?q=about#Begware -- Stuart -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Headers Again
Jason, What I shock, 307,000 entries returned. Maybe someone with ability greater or other than I, should give some serious consideration to a solution or work around. I've been using ColdFuion for 7 years and I can do a cflocation url=anotherlocation.htm anywhere in the page, no matter if I've run CFML, Javascript it still works. Sorry I'm just frustrated. Regards Col Jason Wong [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Tuesday 17 February 2004 09:57, PETCOL wrote: I have authenticated a user, after that I want to take them to another page: Header(Location: welcome.php); But I get the following error? error Cannot modify header information - headers already sent error Suggestions? google? -- 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 -- /* I don't want to achieve immortality through my work. I want to achieve immortality through not dying. -- Woody Allen */
Re: [PHP] Headers Again
On Tuesday 17 February 2004 16:37, PETCOL wrote: What you're asking is a VERY FAQ. Something that's asked almost every other day. The list archives will have plenty of answers. What I shock, 307,000 entries returned. If you don't want to trawl through those search results then read the error message again (carefully, all of it). If you still haven't figured it then read the manual entry for header(), every single line, then correlate what is said with the error message. Maybe someone with ability greater or other than I, should give some serious consideration to a solution or work around. All the info you need is in the archives. I've been using ColdFuion for 7 years and I can do a cflocation url=anotherlocation.htm anywhere in the page, no matter if I've run CFML, Javascript it still works. You can do that as well, again, all the info you need is in the archives. Sorry I'm just frustrated. I'm sure regulars on the list are just as frustrated at how often this question crops up and at how little research people do before asking another FAQ. -- 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 -- /* Losing your drivers' license is just God's way of saying BOOGA, BOOGA! */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Headers Again
Jason, I appreciate people get just as frustrate by reading repetative posts. Alliare and Macromedias forums for ColdFusion and other software, allow a search through the entire post, archive everything. Which always avoid this problem of a newsgroup. Maybe I'm wrong, but I don't thing there's a search like this for a newsgroup? If you do happen to know, as it would appear you may, the url of the answer to the original question, then could you simply supply it. I'm new to this code, I appreciate any assistance, and I will troll through archives etc to get it. However, if some kind sole can save me 3 hours work, I'll also appreciate it, which is probably why this list get repetative posts. Cheers, relax, and have a nice day. Col Jason Wong [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Tuesday 17 February 2004 16:37, PETCOL wrote: What you're asking is a VERY FAQ. Something that's asked almost every other day. The list archives will have plenty of answers. What I shock, 307,000 entries returned. If you don't want to trawl through those search results then read the error message again (carefully, all of it). If you still haven't figured it then read the manual entry for header(), every single line, then correlate what is said with the error message. Maybe someone with ability greater or other than I, should give some serious consideration to a solution or work around. All the info you need is in the archives. I've been using ColdFuion for 7 years and I can do a cflocation url=anotherlocation.htm anywhere in the page, no matter if I've run CFML, Javascript it still works. You can do that as well, again, all the info you need is in the archives. Sorry I'm just frustrated. I'm sure regulars on the list are just as frustrated at how often this question crops up and at how little research people do before asking another FAQ. -- 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 -- /* Losing your drivers' license is just God's way of saying BOOGA, BOOGA! */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Headers Again
Got to agree with Jason's comments - as I'm sure all other regulars on the list will do. I've just had a quick look at the php.net site, done a search for header and halfway down the first page returned found this: Remember that header() must be called before any actual output is sent, either by normal HTML tags, blank lines in a file, or from PHP. It is a very common error to read code with include(), or require(), functions, or another file access function, and have spaces or empty lines that are output before header() is called. The same problem exists when using a single PHP/HTML file. Not hard is it? Regards, Michael Egan -Original Message- From: PETCOL [mailto:[EMAIL PROTECTED] Sent: 17 February 2004 09:22 To: [EMAIL PROTECTED] Subject: Re: [PHP] Headers Again Jason, I appreciate people get just as frustrate by reading repetative posts. Alliare and Macromedias forums for ColdFusion and other software, allow a search through the entire post, archive everything. Which always avoid this problem of a newsgroup. Maybe I'm wrong, but I don't thing there's a search like this for a newsgroup? If you do happen to know, as it would appear you may, the url of the answer to the original question, then could you simply supply it. I'm new to this code, I appreciate any assistance, and I will troll through archives etc to get it. However, if some kind sole can save me 3 hours work, I'll also appreciate it, which is probably why this list get repetative posts. Cheers, relax, and have a nice day. Col Jason Wong [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Tuesday 17 February 2004 16:37, PETCOL wrote: What you're asking is a VERY FAQ. Something that's asked almost every other day. The list archives will have plenty of answers. What I shock, 307,000 entries returned. If you don't want to trawl through those search results then read the error message again (carefully, all of it). If you still haven't figured it then read the manual entry for header(), every single line, then correlate what is said with the error message. Maybe someone with ability greater or other than I, should give some serious consideration to a solution or work around. All the info you need is in the archives. I've been using ColdFuion for 7 years and I can do a cflocation url=anotherlocation.htm anywhere in the page, no matter if I've run CFML, Javascript it still works. You can do that as well, again, all the info you need is in the archives. Sorry I'm just frustrated. I'm sure regulars on the list are just as frustrated at how often this question crops up and at how little research people do before asking another FAQ. -- 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 -- /* Losing your drivers' license is just God's way of saying BOOGA, BOOGA! */ -- 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] Headers Again
PETCOL wrote: Alliare and Macromedias forums for ColdFusion and other software, allow a search through the entire post, archive everything. Which always avoid this problem of a newsgroup. Maybe I'm wrong, but I don't thing there's a search like this for a newsgroup? http://marc.theaimsgroup.com/?l=php-general -- Stuart -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re[2]: [PHP] Headers Again
Hello PETCOL, Tuesday, February 17, 2004, 8:37:15 AM, you wrote: google? P What I shock, 307,000 entries returned. Assuming you're running Windows, do what I do and download the Windows CHM help file version of the PHP manual. It includes standard search capabilities, so clicking on Search and entering header will bring you back exactly what you need to know. In this case it's the top 2 results. Takes like 3 minutes at the most. Then if the manual description doesn't help enough you can check out the on-line annotated manual and post messages to this list without receiving sarcastic replies back again. P I've been using ColdFuion for 7 years and I can do a P cflocation url=anotherlocation.htm anywhere in the page, no P matter if I've run CFML, Javascript it still works. Yes, ASP does similar with Response.Redirect - but you're in PHP land now so why not get yourself a copy of the PHP bible? It'll save you SO much hassle. -- Best regards, Richard Davey http://www.phpcommunity.org/wiki/296.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Headers Again
Stuart Thank you. Stuart [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] PETCOL wrote: Alliare and Macromedias forums for ColdFusion and other software, allow a search through the entire post, archive everything. Which always avoid this problem of a newsgroup. Maybe I'm wrong, but I don't thing there's a search like this for a newsgroup? http://marc.theaimsgroup.com/?l=php-general -- Stuart -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Headers Again
Michael, So are you answering my problem not, really just antaganising it. I've tried ob_end_flush(); it didn't work, maybe it's a server configuration issue. Maybe it's just php can not do it? So pleased to hear the php community is here to help each other. For those of you who are making the effort I thank you. Col Michael Egan [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Got to agree with Jason's comments - as I'm sure all other regulars on the list will do. I've just had a quick look at the php.net site, done a search for header and halfway down the first page returned found this: Remember that header() must be called before any actual output is sent, either by normal HTML tags, blank lines in a file, or from PHP. It is a very common error to read code with include(), or require(), functions, or another file access function, and have spaces or empty lines that are output before header() is called. The same problem exists when using a single PHP/HTML file. Not hard is it? Regards, Michael Egan -Original Message- From: PETCOL [mailto:[EMAIL PROTECTED] Sent: 17 February 2004 09:22 To: [EMAIL PROTECTED] Subject: Re: [PHP] Headers Again Jason, I appreciate people get just as frustrate by reading repetative posts. Alliare and Macromedias forums for ColdFusion and other software, allow a search through the entire post, archive everything. Which always avoid this problem of a newsgroup. Maybe I'm wrong, but I don't thing there's a search like this for a newsgroup? If you do happen to know, as it would appear you may, the url of the answer to the original question, then could you simply supply it. I'm new to this code, I appreciate any assistance, and I will troll through archives etc to get it. However, if some kind sole can save me 3 hours work, I'll also appreciate it, which is probably why this list get repetative posts. Cheers, relax, and have a nice day. Col Jason Wong [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Tuesday 17 February 2004 16:37, PETCOL wrote: What you're asking is a VERY FAQ. Something that's asked almost every other day. The list archives will have plenty of answers. What I shock, 307,000 entries returned. If you don't want to trawl through those search results then read the error message again (carefully, all of it). If you still haven't figured it then read the manual entry for header(), every single line, then correlate what is said with the error message. Maybe someone with ability greater or other than I, should give some serious consideration to a solution or work around. All the info you need is in the archives. I've been using ColdFuion for 7 years and I can do a cflocation url=anotherlocation.htm anywhere in the page, no matter if I've run CFML, Javascript it still works. You can do that as well, again, all the info you need is in the archives. Sorry I'm just frustrated. I'm sure regulars on the list are just as frustrated at how often this question crops up and at how little research people do before asking another FAQ. -- 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 -- /* Losing your drivers' license is just God's way of saying BOOGA, BOOGA! */ -- 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] Headers Again
PETCOL wrote: Stuart Thank you. Don't thank me[1], thank them. Preferably with cash[2]. [1] I will accept cash if offered. [2] http://marc.theaimsgroup.com/?q=about#Begware -- Stuart -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re[2]: [PHP] Headers Again
Hello PETCOL, Tuesday, February 17, 2004, 11:52:25 AM, you wrote: P I've tried ob_end_flush(); it didn't work, maybe it's a server P configuration issue. Maybe it's just php can not do it? Have a look at the headers_sent() function to see *where* your script is outputting the headers you don't want it to. -- Best regards, Richard Davey http://www.phpcommunity.org/wiki/296.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Headers Again
On Tuesday 17 February 2004 17:21, PETCOL wrote: Alliare and Macromedias forums for ColdFusion and other software, allow a search through the entire post, archive everything. Which always avoid this problem of a newsgroup. Maybe I'm wrong, but I don't thing there's a search like this for a newsgroup? Umm, did you take a look at my signature? If you do happen to know, as it would appear you may, the url of the answer to the original question, then could you simply supply it. I do not know the url of the answer to the original question off hand. But I can assure you that a quick search of the archives will uncover plenty of answers. I'm new to this code, I appreciate any assistance, and I will troll through archives etc to get it. However, if some kind sole can save me 3 hours work, I'll also appreciate it, which is probably why this list get repetative posts. The trouble with this list is that it is too friendly and useful! People use it as the first resort instead of using the manual, the archives and of course google. -- 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 -- /* If there is any realistic deterrent to marriage, it's the fact that you can't afford divorce. -- Jack Nicholson */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Headers Again
[EMAIL PROTECTED] Petcol: Jason, What I shock, 307,000 entries returned. Maybe someone with ability greater or other than I, should give some serious consideration to a solution or work around. I've been using ColdFuion for 7 years and I can do a cflocation url=anotherlocation.htm anywhere in the page, no matter if I've run CFML, Javascript it still works. Sorry I'm just frustrated. Regards Col Put ob_start(); in the beginning of the script. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Headers Again
Hi, I have authenticated a user, after that I want to take them to another page: Header(Location: welcome.php); But I get the following error? error Cannot modify header information - headers already sent error Suggestions? Col -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Headers Again
PETCOL wrote: Hi, I have authenticated a user, after that I want to take them to another page: Header(Location: welcome.php); But I get the following error? error Cannot modify header information - headers already sent error Suggestions? Don't send output to the browser before you try to send headers(). -- 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] Headers Again
On Tuesday 17 February 2004 09:57, PETCOL wrote: I have authenticated a user, after that I want to take them to another page: Header(Location: welcome.php); But I get the following error? error Cannot modify header information - headers already sent error Suggestions? google? -- 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 -- /* I don't want to achieve immortality through my work. I want to achieve immortality through not dying. -- Woody Allen */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Headers and sessions in php .cgi
Hi there, I have a problem setting my headers right with php running as .cgi. I have to specify a Content-type for the cgi file to work. But how should I do both that and start a session? I have a few options: #! /usr/local/bin/php ?php session_start(); print 'Content-type: text/html' . \n\n; This way $_SESSION['count'] stays unset even though I say $_SESSION['count'] = 1; in my program. To swap the two lines won't work because I heard \n\n terminates the header portion. Anyway, here goes: #! /usr/local/bin/php ?php print 'Content-type: text/html' . \n\n; session_start(); Now I get Warning: session_start(): Cannot send session cookie - headers already sent by... line 3 and then Warning: session_start(): Cannot send session cache limiter - headers already sent I have tried replacing print 'Content-type: text/html' . \n\n; by print 'Content-type: text/html' . \n; (one \n instead of two) with exactly the same result. With no \n at all I only get Warning: session_start(): Cannot send session cache limiter - headers already sent. The next thing I try is to replace print 'Content-type: text/html' and the \n's by sending the same text in header(). This variety gives me a 500 Internal Server Error independant on the number of \n's. Anyway, here's all my code. No matter what I do it always prints Your visit number 1. $_SESSION['count'] doesn't get increased at all! #! /usr/local/bin/php ?php print 'Content-type: text/html' . \n\n; session_start(); print 'html' . \n; print 'body' . \n; if (!isset($_SESSION['count'])) { $_SESSION['count'] = 1; } else { $_SESSION['count']++; } print 'Your visit number ' . $_SESSION['count'] . \n; print '/body' . \n; print '/html' . \n; ? I hope you can help me out getting my headers straight. Regards, Børge -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Headers and sessions in php .cgi
On Sat, 10 Jan 2004 17:44:18 +0100 (MET), you wrote: I have a problem setting my headers right with php running as .cgi. I have to specify a Content-type for the cgi file to work. But how should I do both that and start a session? I have a few options: #! /usr/local/bin/php ?php session_start(); print 'Content-type: text/html' . \n\n; This way $_SESSION['count'] stays unset even though I say $_SESSION['count'] = 1; in my program. To swap the two lines won't work because I heard \n\n terminates the header portion. Anyway, here goes: Stupid question: Have you tried header ('Content-type: text/html'); I'm pretty sure it will work. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Headers and sessions in php .cgi
--- Børge Strand [EMAIL PROTECTED] wrote: I have a problem setting my headers right with php running as .cgi. I have to specify a Content-type for the cgi file to work. But how should I do both that and start a session? Try using header() instead of print to set Content-Type. 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] Headers and sessions in php .cgi
I have a problem setting my headers right with php running as .cgi. I have to specify a Content-type for the cgi file to work. But how should I do both that and start a session? I have a few options: #! /usr/local/bin/php ?php session_start(); print 'Content-type: text/html' . \n\n; This way $_SESSION['count'] stays unset even though I say $_SESSION['count'] = 1; in my program. To swap the two lines won't work because I heard \n\n terminates the header portion. Anyway, here goes: Stupid question: Have you tried Well, there's one thing I have found out here and that is that there's no such thing as a stupid question. I've tried searching for Content-type and session_start without getting any wiser :-( header ('Content-type: text/html'); I'm pretty sure it will work. Tried it, didn't word I'm afraid. The text inside doesn't contain anything that's treated differently by and '. -- Børge -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Headers and sessions in php .cgi
I have a problem setting my headers right with php running as .cgi. I have to specify a Content-type for the cgi file to work. But how should I do both that and start a session? Try using header() instead of print to set Content-Type. Hope that helps. Thanks Chris. I tried that (see original post). Then I get a 500 error in my browser and bad header in error_log. Guess I'll have to take session_start() apart and see what it does. This all worked in 4.2, though, where I used .cgi files without a die-hard need for Content-type. As I said in a previous post, everything works when I run my program as a .php file without Content-type. So I guess there's a conflict between the Content-type header and those inserted by session_start() in 4.3.4. Thanks for any help, I'm on a bad deadline and my ISP changed PHP version without telling! -- Børge -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Headers Problem
Beauford wrote: I'm getting the following error. My question is, where would I use the ob_start() and ob_end_flush() function so I can get rid of this. I have read the PHP manual, but not quite getting it.Or if there is a better way? Don't work around the problem with output buffering; try fixing it. Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /usr/local/apache/htdocs/supreme/updates/update-corrections-write.php: 2) in /usr/local/apache/php/includes/restricted.inc on line 1 You must have session_start() before any output. You've placed it on line 1 of restricted.inc, but output was started on line 2 of update-corrections-write.php. If you're going to include restricted.inc and start a session, include it before there is output. Just a clarification, session_start() is on the first line of restricted.inc and restricted.inc is included on the first line of update-corrections-input.php. All update-corrections-write.php does is write info to a database and includes update-corrections-input.php on the last line. So I'm still not understanding where the output from update-corrections-write.php is coming from. Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Headers Problem
From: Beauford [EMAIL PROTECTED] Just a clarification, session_start() is on the first line of restricted.inc and restricted.inc is included on the first line of update-corrections-input.php. All update-corrections-write.php does is write info to a database and includes update-corrections-input.php on the last line. So I'm still not understanding where the output from update-corrections-write.php is coming from. Sounds like you have a blank line as the first line in update-corrections-write.php. If ?php isn't the very first thing in the file, then this isn't going to work. ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Headers Problem
Yes, there was a blank line. Now I just have to test it to see if that was it. One other question though. It appears that Windows does not have this problem - the site in question is on a Linux box. Why would this be? The two sites are identical, I just use the Windows one for developing and testing. I have looked at both php.ini files, and other than the OS specific stuff, they are the same as well. Thanks again... -Original Message- From: CPT John W. Holmes [mailto:[EMAIL PROTECTED] Sent: December 24, 2003 8:52 AM To: Beauford Cc: 'PHP' Subject: Re: [PHP] Headers Problem From: Beauford [EMAIL PROTECTED] Just a clarification, session_start() is on the first line of restricted.inc and restricted.inc is included on the first line of update-corrections-input.php. All update-corrections-write.php does is write info to a database and includes update-corrections-input.php on the last line. So I'm still not understanding where the output from update-corrections-write.php is coming from. Sounds like you have a blank line as the first line in update-corrections-write.php. If ?php isn't the very first thing in the file, then this isn't going to work. ---John Holmes... -- 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] Headers Problem
I'm getting the following error. My question is, where would I use the ob_start() and ob_end_flush() function so I can get rid of this. I have read the PHP manual, but not quite getting it.Or if there is a better way? This is how the files work. update-corrections-input.php (user inputs info by a form). This file includes another file - restricted.inc. The form in update-corrections-input.php calls update-corrections-write.php which processes the input and then includes update-corrections-input.php again. So basically it just brings the user back to the form again. Any input is appreciated Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /usr/local/apache/htdocs/supreme/updates/update-corrections-write.php:2) in /usr/local/apache/php/includes/restricted.inc on line 1 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Headers Problem
Beauford wrote: I'm getting the following error. My question is, where would I use the ob_start() and ob_end_flush() function so I can get rid of this. I have read the PHP manual, but not quite getting it.Or if there is a better way? Don't work around the problem with output buffering; try fixing it. Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /usr/local/apache/htdocs/supreme/updates/update-corrections-write.php:2) in /usr/local/apache/php/includes/restricted.inc on line 1 You must have session_start() before any output. You've placed it on line 1 of restricted.inc, but output was started on line 2 of update-corrections-write.php. If you're going to include restricted.inc and start a session, include it before there is output. -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals www.phparch.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Headers Sent Message
Could someone help me out with this. I had this problem about a year ago with another site and I can't for the life of me remember what I had to do to fix it. I am in a oscommerce application, however I think it is really a php problem. I get this message when ever I try to update the admin portion of the site: Warning: Cannot modify header information - headers already sent by (output started at /home/virtual/site1/fst/var/www/html/admin3/includes/application_top.php:267 ) in /home/virtual/site1/fst/var/www/html/admin3/includes/functions/general.php on line 18 Assistance would be appreciated. Thanks. Mark Roberts, Roberts Computing Systems Webmaster Services $29.50/mo mailto:[EMAIL PROTECTED]
Re: [PHP] Headers Sent Message
From: Mark Roberts [EMAIL PROTECTED] Could someone help me out with this. I had this problem about a year ago with another site and I can't for the life of me remember what I had to do to fix it. I am in a oscommerce application, however I think it is really a php problem. I get this message when ever I try to update the admin portion of the site: Warning: Cannot modify header information - headers already sent by (output started at /home/virtual/site1/fst/var/www/html/admin3/includes/application_top.php:267 ) in /home/virtual/site1/fst/var/www/html/admin3/includes/functions/general.php on line 18 I always get yelled at for answering these questions and doing the whole take my hand and follow along as we read this together... but oh well... output started at .../application_top.php:267 means that application_top.php has output on line 267. You cannot send any header information (header(), setcookie(), session_start(), etc) after there is output. general.php is trying to send header information on line 18, after application_top.php has been included and already caused output. ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Headers Sent Message
--- Mark Roberts [EMAIL PROTECTED] wrote: Warning: Cannot modify header information - headers already sent by (output started at /home/virtual/site1/fst/var/www/html/admin3/includes/application_top.php:267 ) in /home/virtual/site1/fst/var/www/html/admin3/includes/functions/general.php on line 18 Go to this script: application_top.php Look at line 267. Something is being output there, or perhaps there is something on that line that generates an error. In this script: general.php You are doing something that outputs a header on line 18, and the output from application_top.php happens prior to this, which cannot happen. Hope that helps. Chris = Chris Shiflett - http://shiflett.org/ PHP Security Handbook Coming mid-2004 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] Headers Sent Message
Mark Roberts wrote: Could someone help me out with this. I had this problem about a year ago with another site and I can't for the life of me remember what I had to do to fix it. I am in a oscommerce application, however I think it is really a php problem. I get this message when ever I try to update the admin portion of the site: Warning: Cannot modify header information - headers already sent by (output started at /home/virtual/site1/fst/var/www/html/admin3/includes/application_top.php:267 ) in /home/virtual/site1/fst/var/www/html/admin3/includes/functions/general.php on line 18 You are lucky I have the files opened right now. The errors you report are only the last one, the first and main problem is that this line failed: include(DIR_WS_CLASSES . 'language.php'); // application_top.php:267 It generated a warning and the headers and then the html body was send. Basicly your main language file is missing. Marek -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Headers, outputting a file ..
Hi All, I feel almost ashamed for having to ask this question. Mostlly because I know it's been asked so many tmes but I just don't seem to be able to get it working. I want to secure some files from viewing by putting them in a different folder than the document root. Then, through a simple Content class output them to the browser, and of course have this browser display the page correctly. This file comes from an admin user upload, and can be of any time. pdf, doc, jpg, xls, well .. don't need to name all existing file extensions, do I? And I just know the answer has been given in a previous post, which I just cannot find on the archives. Here's the deal: 110 $File = $this-Get($User); 111 112 foreach($File['Headers'] as $H) header($H);; 113 readfile($File['Path']); Which I think is perfectly valid code for outputting this file. Now, several examples of what $File will contain after the call to $this-Get($User) ;) 1: Array ( [Headers] = Array ( [0] = Content-Type: image/pjpeg [1] = Content-Disposition: attachment; filename=duuude.jpg [2] = Accept-Ranges: bytes [3] = Conent-Length: 23256 ) [Path] = /home/wouter/projects/mspa.nl/files/duuude.jpg ) 1: Array ( [Headers] = Array ( [0] = Content-Type: application/msword [1] = Content-Disposition: attachment; filename=Modulehandleiding.doc [2] = Accept-Ranges: bytes [3] = Conent-Length: 156672 ) [Path] = /home/wouter/projects/mspa.nl/files/Modulehandleiding.doc ) 1: Array ( [Headers] = Array ( [0] = Content-Type: application/pdf [1] = Content-Disposition: attachment; filename=Interviewschema.pdf [2] = Accept-Ranges: bytes [3] = Conent-Length: 40141 ) [Path] = /home/wouter/projects/mspa.nl/files/Interviewschema.pdf ) As for the first one, it works. It shows me the image on my screen .. The word document and pdf file are shown as they would look like if they're opened in notepad or such. Any help is widely appriciated .. ;) Wouter Ps. To clearify: $this is the internal instance of my Content class, $User is passed onto the function to check if he is allowed to view the content. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php