[PHP] Internet Explorer Caching
I've been having problems with Internet Explorer caching php programs. I'm using the following code: header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 header("Pragma", "no-cache"); header("Expires", "-1"); And it used to work, but now, according to Windows Explorer its giving it 3 hours to expire. Charlene -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Internet Explorer Caching
Yes, I'm sure. Changes I make to a database are reflected in the database but not on the form. It's only IE. It works fine in FireFox or SeaMonkey. Charlene Richard Heyes wrote: Charlene wrote: I've been having problems with Internet Explorer caching php programs. I'm using the following code: header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 header("Pragma", "no-cache"); header("Expires", "-1"); And it used to work, but now, according to Windows Explorer its giving it 3 hours to expire. Are you sure? By default PHP pages/scripts don't send any caching headers and hence don't get cached. You can check this using: http://www.fiddlertool.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Internet Explorer Caching
I forgot to mention in my question that only IE appears to cache. And with the way my PHP program goes, I'm constantly changing the URL as I go through the application to modify data and status message. But whenever I return the the edit page, the old data is showing up. Charlene Richard Lynch wrote: On Wed, August 29, 2007 10:43 am, Charlene wrote: I've been having problems with Internet Explorer caching php programs. I'm using the following code: header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 header("Pragma", "no-cache"); header("Expires", "-1"); And it used to work, but now, according to Windows Explorer its giving it 3 hours to expire. The second argument to header() function will allow you to send "duplicate" headers for the same header-name. header("Pragma: no-cache"); header("Pragma: must-revalidate"); This is usually NOT what you want for headers, as MOST of them allow only ONE instance. So header("Pragma", "no-cache"); is sending a SECOND "Pragma" header. Actually, as you have no ":" in there, it probably is sending it with no ":", so it's really the first completely bogus "Pragma" header which is doing absolutely nothing, and isn't a "Pragma:" header at all. I guess technically it's maybe not bogus... You're allowed to extend the HTTP protocol and send "extra" headers, but they're supposed to start by "X-" by convention... //legit header("X-my-custom-header: 42"); //certainly not convention; probably not legit header("My-custom-header: 42"); But it's sure not the "Pragma: no-cache" header you MEANT to send. Ditto for Expires. And double-ditto for the -1 value for "Expires", which I do not think is a valid value. Now IE may have decided to stop doing an interpretive dance around the bogus headers you have been sending, and has decided it's time to make you send the REAL headers. Personally, I think it should never have let you get away with it in the first place, but that's IE for ya. ULTIMATELY, however, if you really really really want MS IE nor any intermediary servers to cache something, your best bet is to add some random bit to the URL: can't cache this There is no combination of headers for no-cache that will actually WORK for *ALL* legacy browsers. Please Note: When I say *ALL* legacy browsers, I'm including everything back to NCSA Mosiac and corporate re-branded IE with their own nifty logo in place of the IE logo. AT&T, for example, does/did this for their employees -- and the version number may match exactly with the publicly-available IE, but they don't behave the same, in my experience. :-( Given that it's a heck of a lot easier to generate a random URL than fiddle with so-called "no-cache" headers every time a bug report from some browser you never even heard of rolls in, I strongly recommend using a random URL. YMMV -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Internet Explorer Caching
I had used something similar in another iteration of trying to fix the caching problem in IE. I tried these lines again, and they don't work. It is only IE that is caching. Charlene Satyam wrote: I'm sending these headers: header('Cache-Control: no-cache, must-revalidate'); // HTTP/1.1 header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); // Date in the past I don't remember where I took them from, but they are working fine for me. Satyam - Original Message - From: "Richard Heyes" <[EMAIL PROTECTED]> To: "Charlene" <[EMAIL PROTECTED]> Cc: Sent: Wednesday, August 29, 2007 5:50 PM Subject: Re: [PHP] Internet Explorer Caching Charlene wrote: I've been having problems with Internet Explorer caching php programs. I'm using the following code: header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 header("Pragma", "no-cache"); header("Expires", "-1"); And it used to work, but now, according to Windows Explorer its giving it 3 hours to expire. Are you sure? By default PHP pages/scripts don't send any caching headers and hence don't get cached. You can check this using: http://www.fiddlertool.com -- Richard Heyes +44 (0)844 801 1072 http://www.websupportsolutions.co.uk Knowledge Base and HelpDesk software that can cut the cost of online support -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.5.484 / Virus Database: 269.12.10/977 - Release Date: 28/08/2007 16:29 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Internet Explorer Caching
Unfortunately I don't have a choice. I have to be able to handle IE. And IE is caching the page. I can see it in my Temporary Internet Files folder. And the Expiration Date is 3 hours after the file is created. If I delete the file, a new one is created and the Expiration Date is 3 hours after the new file is created. Charlene Richard Lynch wrote: On Wed, August 29, 2007 2:10 pm, Charlene wrote: I forgot to mention in my question that only IE appears to cache. And with the way my PHP program goes, I'm constantly changing the URL as I go through the application to modify data and status message. But whenever I return the the edit page, the old data is showing up. Ah! "old data" as in "This is what you typed into the form last time you were here, so this is what you must want in the form this time, no matter what is in the HTML for the default value, because we are Microsoft, and our users are stupid and this is what they want"? You're pretty much dealing with a browser behaviour, I think, and people dumb enough to use IE actually expect it to work that way, and trying to fix it is probably a mistake. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Internet Explorer Caching
Unfortunately I don't have a choice. I have to be able to handle IE. And IE is caching the page. I can see it in my Temporary Internet Files folder. And the Expiration Date is 3 hours after the file is created. If I delete the file, a new one is created and the Expiration Date is 3 hours after the new file is created. Charlene Richard Lynch wrote: On Wed, August 29, 2007 2:10 pm, Charlene wrote: I forgot to mention in my question that only IE appears to cache. And with the way my PHP program goes, I'm constantly changing the URL as I go through the application to modify data and status message. But whenever I return the the edit page, the old data is showing up. Ah! "old data" as in "This is what you typed into the form last time you were here, so this is what you must want in the form this time, no matter what is in the HTML for the default value, because we are Microsoft, and our users are stupid and this is what they want"? You're pretty much dealing with a browser behaviour, I think, and people dumb enough to use IE actually expect it to work that way, and trying to fix it is probably a mistake. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Internet Explorer Caching - Solved
Charlene wrote: I've been having problems with Internet Explorer caching php programs. I'm using the following code: header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 header("Pragma", "no-cache"); header("Expires", "-1"); And it used to work, but now, according to Windows Explorer its giving it 3 hours to expire. Charlene I am using sessions, and it appears to work differently in PHP5 than PHP4 (not fully tested as to verification of that statement). So I needed to add a line of code before the session_start function: session_cache_expire(0); session_start(); Charlene -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] GD Library
I have the GD Library installed, but I don't see any of the fonts. What is the preferred location to download fonts (standard fonts like Arial, Verdana, etc.) and which directory should they be stored in? Charlene -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Shopping Carts/Checkout Software
Micah Gersten wrote: Try Zencart. Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com Thank you for your recommendation, but I really need either reasons why to use a particular product from experience or reference to an article which support your recommendation. I don't want to start a flame war, but I really would like to hear from all about their experiences with different products. Especially if you used hooks in your PHP code to work with a particular product. Also, I would like to know about the problems with a specific product and would you would never use again. Charlene -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Shopping Carts/Checkout Software
Micah Gersten wrote: ZenCart Reasons: PHP-based Open Source lots if plugins Take a look at this: http://en.wikipedia.org/wiki/Zen_Cart Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com Charlene wrote: Micah Gersten wrote: Try Zencart. Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com It doesn't look like zencart includes a checkout system. I really need the complete system. Otherwise, what I see at their site looks interesting. In searching for the website for zencart, I discovered a commercial product that looks like it would work and it uses XML to import product information into its system. I'm trying to figure out if zencart would use this method also. Charlene -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Missing characters when processing scripts
I have a semi -random problem that characters in the php script are dropped. A very noticible instance is in a statement like: $query = "SELECT junk FROM table"; $result = mysql_query( $query, $handle) or die (mysql_error()); I get an error message from the die function like: "Error SELECT jnk FROM table... As you can see the error message has the SELECT statement with one character dropped (this is much more rare than single quotes or semicolons being dropped - but it definitely shows that the error isn't in the code). If I wait a minute and do a browser refresh, the error goes away and either there is another character dropped or it works. This problem was noticed in January a month after we upgraded PHP on our server to 4.3.10. Thanks in advance Charlene -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Problem with IE7 caching
I have a problem with IE7. It has a tendency to cache output produced by PHP. It occurs in a few ways: * I make a minor change to a php program, but you can't see it in IE7, but can in FF. CTRL-Refresh does not make it work. * I modify data using a form in IE7. When I click on a link to return to the form the old data is still there, but if I hit CTRL-Refresh the new values are there. I have set up some caching to try to fix the second issue, but I'm not sure if I've chosen the right header lines: $now = time (); $prety_lmtime = gmdate ('D, d M Y H:i:s', $now). ' GMT'; $prety_emtime = gmdate ('D, d M Y H:i:s', $now + $interval). ' GMT'; // Backwards Compatibility header ("Last Modified: $prety_lmtime"); header ("Expires: $prety_emtime"); // HTTP/1.1 Support header ("Cache-Control: private, max-age=$interval,s-maxage=0"); I got this code from a book. I don't want to prevent caching completely because I want to be able to go back to the form when there is an error in validation of fields before entering it into the db. But I do want to be able to see the new data after it is entered in the db. Charlene
Re: [PHP] Problem with IE7 caching
I tried this and it doesn't work. I still have to do the CTRL-Refresh to get it to refresh the page. On May 7, 2010, at 2:27 PM, Karl DeSaulniers wrote: Try, header('Cache-control: private, no-cache, must-revalidate');> header('Expires: 0'); http://www.w3.org/Protocols/rfc2616/rfc2616-sec13.html On May 7, 2010, at 2:06 PM, Charlene Wroblewski wrote: header ("Cache-Control: private, max-age=$interval,s-maxage=0"); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem with IE7 caching
Karl DeSaulniers wrote: On May 7, 2010, at 2:06 PM, Charlene Wroblewski wrote: I have a problem with IE7. It has a tendency to cache output produced by PHP. It occurs in a few ways: * I make a minor change to a php program, but you can't see it in IE7, but can in FF. CTRL-Refresh does not make it work. * I modify data using a form in IE7. When I click on a link to return to the form the old data is still there, but if I hit CTRL-Refresh the new values are there. I have set up some caching to try to fix the second issue, but I'm not sure if I've chosen the right header lines: $now = time (); $prety_lmtime = gmdate ('D, d M Y H:i:s', $now). ' GMT'; $prety_emtime = gmdate ('D, d M Y H:i:s', $now + $interval). ' GMT'; // Backwards Compatibility header ("Last Modified: $prety_lmtime"); header ("Expires: $prety_emtime"); // HTTP/1.1 Support header ("Cache-Control: private, max-age=$interval,s-maxage=0"); I got this code from a book. I don't want to prevent caching completely because I want to be able to go back to the form when there is an error in validation of fields before entering it into the db. But I do want to be able to see the new data after it is entered in the db. Charlene Sounds like you need attach the data somehow when hitting that return link. Maybe an array $newData = array();//fill this array with the new values On your form page, set up a if(isset($newData)){ //fill form fields } I did notice that on your header, you did not have "no-cache". header ("Cache-Control: private, no-cache, max-age=$interval,s-maxage=0"); Actually, I should have looked at which caching code I was using for the second problem. This is the code: header ("Expires: 0"); header ("pragma: no-cache"); // HTTP/1.1 Support header ("Cache-Control: no-cache,no-store,max-age=0,s-maxage=0, must-revalidate"); About storing the values, I really would rather the browser keep track of form input if I can. It could get confusing trying to store temporary information, especially since the form is being used to modify a client profile as well as create a new password for the first time in the application (not my choice - I'd rather do passwords first and then allow them to modify info). Charlene -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] working on a template system...
*joining the fray a little late* What is the difference between this, Smarty and template.inc? I have found Smarty to be unusable in my situation where a graphic designer needs to be able to edit the html and is easily confused by non-html. So, I am using template.inc which is apparently old (PHP 3) but seems to work great even with PHP 4.1. Another question is whether it will work with PHP 5? Charlene sempsteen wrote: hi, i'm working on a template system. Basically i'm building raw contents in arrays and then put them in templates by some special tags. for loop systems my basic array structure is like this: $array['key'][]['keyword'] = ... for example, for a bulletin board system, array structure for categories is something like this: $array['categories'][]['text_category_name'] = ... it is looped through database recordset, so final array for 2 categories can be: $array['categories'][0]['text_category_name'] = 'programming' $array['categories'][1]['text_category_name'] = 'life' template file structure for loops is something like this (ex, categories): [$text_category_name$] i can easily loop this template and replace [$text_category_name] for every category set in the array. after removing the comment tags i get the final content: programming life But i'm stuck with nested loops. For example i want to put related forums after each categories. array structure is: $array['categories'][0]['text_category_name'] = programming $array['categories'][0]['forums'][0]['text_forum_name'] = php $array['categories'][0]['forums'][1]['text_forum_name'] = ruby $array['categories'][1]['text_category_name'] = life $array['categories'][1]['forums'][0]['text_forum_name'] = music $array['categories'][1]['forums'][1]['text_forum_name'] = sports template structure is: [$text_category_name$] [$text_forum_name$] i've written some functions, used them recursively but it didn't work. actually i couldn't find the true logic. note that it isn't a limited array. it can have messages under each forums, peoples under each messages, so on.. help me find the true approach to handle this. thank you. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Question about templates
I have been using template.inc for templates. It works very well so that I can just work on coding and a designer can make the page look good. But I noticed that there are several versions (some of which don't seem to work), and its no longer in the phplib. Is there some reason not to use it? And if that's the case what would be the substitute? I have looked at Smarty and it doesn't seem to be as useful the way I'm using templates. Charlene -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php