A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: Flash video protection

  1. #1
    AS3 Mod
    Join Date
    Sep 2007
    Location
    O-H-I-O
    Posts
    2,385

    Flash video protection

    I currently am storing my .flv files in the cgi-bin directory for protection from being easily stolen. What I want to do is have a script that will allow me to embed files via this method:

    Psuedo: <embed src="flashvideo.php?filename=testfile.flv"></embed>

    Then my script will of coarse point to the correct path and allow the flash video player to read the data.

    I currently have a script started that does all this and outputs the data with the header() function but doesn't seem to be doing the trick.

    PHP Code:
    <?PHP
    $filename 
    $_GET['filename'];

    if(!
    $filename || empty($filename) || !preg_match('/./',$filename))
    {
        die(
    "Invalid filename");
    }

    if(isset(
    $filename) && !empty($filename))
    {
        
    $dir "/dir-to-my-files/";
        
    $file_extension strtolower(substr(strrchr($filename,"."),1));
        
        
    // required for IE, otherwise Content-disposition is ignored
        
    if(ini_get('zlib.output_compression')) ini_set('zlib.output_compression''Off');
        
        
    header("Cache-Control: no-store, no-cache, must-revalidate"); // HTTP/1.1
        
    header("Cache-Control: post-check=0, pre-check=0"false);
        
    header("Pragma: no-cache"); // HTTP/1.0
        
    header("Content-Type: video/x-flv");
        
    header('Content-Length: ' filesize($dir $filename));
        
    header('Content-Disposition: inline; filename="' $filename '"');
        
    header("Content-Transfer-Encoding: binary\n");
        
    readfile($dir $filename);
        exit();
    }
    ?>
    Any suggestions?

  2. #2
    Registered User
    Join Date
    Feb 2001
    Posts
    13,039
    Hi,

    I am doing something similar quite often, but using fpassthru() instead of readfile(). I have never used the "inline" part.

    BTW: you should add a bit more code (e.g. a php session), otherwise retrieving the file via the php is no more complicated than without

    Musicman

  3. #3
    AS3 Mod
    Join Date
    Sep 2007
    Location
    O-H-I-O
    Posts
    2,385
    Yeah I will work on all that once I get the functionality working :d Thank you for the recommendation, I will look up fpassthru() and see what I can come up with.

  4. #4

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center