Jump to content

Preventing a file caching


Eric_P

Recommended Posts

Hi , Im a flash developer about an hour ago i stumbled upon a php script which allows a flash file to access other images (and swfs) from protected directorys which have been chmodded to 101 with only exacute permission granted .

 

This is my wildest dream as a flash developer decompiler protection . So ive got it set up my loader .swf is preloading then displaying  (not refreshing and displaying a cached image) an image from a protected directory .

 

From the browser i have absolutly no way of accessign this file , Great nobody will be able to get my protected .swf files ! but then refresh and a cached cersion of the image is shown without transferig again .

 

 

The entire point of this is so the user has no way of accessing the files that are in the protected directory . So i need a way of prevent the files caching but not in a .html file that could be easily removed .

 

 

Here is my code

 

<?php

    // THE PATH TO THE PROTECTED FOLDER
    $dir = "files/protected-dir";

    $file = @$_GET[ "file" ];

    if( is_null( $file ) || !file_exists( $dir . "/" . $file ) )
    {
        exit();
    }

    // FOR SECURITY, MAKE SURE THE REQUESTED FILE IS ALLOWED
    // TO BE LOADED VIA THIS SCRIPT
    switch( $file )
    {
        case "image.jpg":
            // the file is allowed to be accessed
        break;

        default:
            exit();
    }

    // READ THE FILE CONTENTS
    $data = file_get_contents( $dir . "/" . $file );

    header( "content-type: image/jpeg" );
    header( "content-length: " . strlen( $data ) );

    // SPIT OUT THE FILE CONTENTS
    exit( $data );

?> 

 

And in acionscript

 

Importer.loadImage("Parser.php?file=image.jpg");

 

If it helps i also found this But im not expieranced with php i realy wouldnt know how to combine them

 

 

Any help appricated guys .

 

Thanks

Link to comment
https://forums.phpfreaks.com/topic/85629-preventing-a-file-caching/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.