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