Onosa Posted September 9, 2007 Share Posted September 9, 2007 Hello, I've made a little game at http://www.mysticcrusade.com/world/map.php and I have a little problem with it. Every character is loaded with player.php, so sometimes player A will look like player B, but it shouldn't. I'm 99% sure this is a cache problem. The computer thinks that image player A should look like image player B, so it doesn't create player B, but it should! Well, this is at the top of my code at player.php header("Content-type: image/jpeg"); header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // always modified header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); // HTTP/1.1 header("Cache-Control: no-store, no-cache, must-revalidate max-age=0"); header("Cache-Control: post-check=0, pre-check=0", false); // HTTP/1.0 header("Pragma: no-cache"); but it will still mess up some times. In the game, you can change from a guy to a girl. walk around as one gender, change your gender, then walk around the same path. Sometimes it will load correctly, haha. Oh, it's easy and free to sign up. You sign up when you log in the first time. Quote Link to comment https://forums.phpfreaks.com/topic/68535-i-have-a-little-cache-problem/ Share on other sites More sharing options...
TheFilmGod Posted September 9, 2007 Share Posted September 9, 2007 Well I think it should have worked. I mean it looks right. Quote Link to comment https://forums.phpfreaks.com/topic/68535-i-have-a-little-cache-problem/#findComment-344535 Share on other sites More sharing options...
Onosa Posted September 9, 2007 Author Share Posted September 9, 2007 Well I think it should have worked. I mean it looks right. haha well, thanks. I thought so too. Quote Link to comment https://forums.phpfreaks.com/topic/68535-i-have-a-little-cache-problem/#findComment-344554 Share on other sites More sharing options...
TheFilmGod Posted September 9, 2007 Share Posted September 9, 2007 Well you know browsers always vary. And they hate to be told to change cache settings. I guess its not something you can control. like IE... Quote Link to comment https://forums.phpfreaks.com/topic/68535-i-have-a-little-cache-problem/#findComment-344555 Share on other sites More sharing options...
Onosa Posted September 9, 2007 Author Share Posted September 9, 2007 well, i looked at some answers, and apparently trying to do what i've been doing is pointless. Sending that code with the image won't stop it from being cached, but putting that code on the page that supports the image should stop it. so I now have the cache preventing code on both map.php and player.php. player.php is where the jpg is made and map.php is the world that people play on. Anyway, I still have the problem so what should I do now? Quote Link to comment https://forums.phpfreaks.com/topic/68535-i-have-a-little-cache-problem/#findComment-344616 Share on other sites More sharing options...
d22552000 Posted September 9, 2007 Share Posted September 9, 2007 one problem with your code: your modified date says GMT. this would only work if your system time was 0gmt. you have to apply your timezone change to it (- or + up to 12) I am PST (-8:00 GMT) If I loaded this page, it would say it was last modified 8 hours ago. Quote Link to comment https://forums.phpfreaks.com/topic/68535-i-have-a-little-cache-problem/#findComment-344624 Share on other sites More sharing options...
Onosa Posted September 9, 2007 Author Share Posted September 9, 2007 one problem with your code: your modified date says GMT. this would only work if your system time was 0gmt. you have to apply your timezone change to it (- or + up to 12) I am PST (-8:00 GMT) If I loaded this page, it would say it was last modified 8 hours ago. As true as that is, i should not matter! The page is suppose to expire years before you even look at the page. Quote Link to comment https://forums.phpfreaks.com/topic/68535-i-have-a-little-cache-problem/#findComment-344773 Share on other sites More sharing options...
d22552000 Posted September 9, 2007 Share Posted September 9, 2007 but the browser owuld liten to the modified after hte expired cause the modified was after the expired. LOL! I myself use this: header('Pragma: public'); header('Pragma: no-cache'); header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); header('Last-Modified: '.gmdate('D, d M Y H:i:s O') . ' GMT'); header('Cache-Control: no-store, no-cache, must-revalidate'); header('Cache-Control: pre-check=0, post-check=0, max-age=0'); the O is the timezone offset. Quote Link to comment https://forums.phpfreaks.com/topic/68535-i-have-a-little-cache-problem/#findComment-344940 Share on other sites More sharing options...
Onosa Posted September 10, 2007 Author Share Posted September 10, 2007 Okay so I used... header('Pragma: public'); header('Pragma: no-cache'); header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); header('Last-Modified: '.gmdate('D, d M Y H:i:s O') . ' GMT'); header('Cache-Control: no-store, no-cache, must-revalidate'); header('Cache-Control: pre-check=0, post-check=0, max-age=0'); ...and I'm sure it would work better, but i noticed something... when I clear my cache and look at the webpage, i see it loading. When I reload the page, it doesn't need to load anything except for the avatar (if it worked properly). This is because the cache is saved So, all in all, nothing is working for me. Is it working for anyone else? remember, it's free and easy to look at the page. There are no ads or anything, this is all just for me and my club. Quote Link to comment https://forums.phpfreaks.com/topic/68535-i-have-a-little-cache-problem/#findComment-345076 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.