Caching on shared server - security issue for local cache directory?
<p>I am working with this script: <a href="http://www.cforcoding.com/2009/05/supercharging-javascript-part-4-caching.html" rel="nofollow">http://www.cforcoding.com/2009/05/supercharging-javascript-part-4-caching.html</a></p>

<p>Basically the instructions recommend not to use caching if it will be used on a shared server. </p>

<p>Now I am using another script which dynamically generates a gif image from a font file and the text I provide and stores it in a local cache drive. Here is part of that code:</p>

<pre><code>$hash = md5(basename($font_file) . $font_size . $font_color .
        $background_color . $transparent_background . $text) ;
$cache_filename = $cache_folder . '/' . $hash . $extension ;
if($cache_images &amp;&amp; ($file = @fopen($cache_filename,'rb'))) {
header('Content-type: ' . $mime_type) ;
while(!feof($file))
    print(($buffer = fread($file,$send_buffer_size))) ;
fclose($file) ;
exit ;
}
</code></pre>

<p>So my 2 questions are:</p>

<p>1) For the code I pasted here, is there any security issue?</p>

<p>2) And can I just use this piece of code which is used for caching with the website url I provided at the beginning ( <a href="http://www.cforcoding.com/2009/05/supercharging-javascript-part-4-caching.html" rel="nofollow">http://www.cforcoding.com/2009/05/supercharging-javascript-part-4-caching.html</a> ) Basically replace their caching method with this one to avoid security issues as mentioned. Or do you recommend some other method?</p>
