Jump to content

I have a little cache problem


Onosa

Recommended Posts

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.

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.