Protecting .Gif and .WMV files
Posted: Tue Jun 20, 2006 7:37 pm
feyd | Please use
Which will then restrict the video to logged in messages.
My problem is this, when I load the page in internet explorer, It works correctly and displays the logged in images / videos whilst logged in, and the error pictures otherwise.
However in Firefox it does not work for the video. I did a tcptrace and discovered that it is not passing the PHPSESSID cookie when it calls the server for the video (the second time)
Source code to my problem
http://dougwa.freepgs.com/test.zip
you will need to configure your server to use php for .gif and .wmvs to get it to work
Thanks ahead of time
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Hi there,
In order to protect .wmvs, and .gifs from being viewed except by being logged in I've written a few php scripts.
i.e /tester/test.wmv will show the correct video when logged in, and a "You are not logged in" video otherwise
To do this i've configured IIS to pass all .gif and .wmv through php-cgi.exe.
I have a dummy file test.wmv which contains session verification,
and outputs the real file, something like thisCode: Select all
<?php
session_start();
header("Cache-control: private");
header("Content-type: video/x-ms-wmv");
if(isset($_SESSION['name'])){
$file = 'content\test.wmv';
$fh = fopen($file, 'r');
$data = fread($fh, filesize($file));
echo $data;
fclose($file);
} else {
$file = 'content\error.wmv';
$fh = fopen($file, 'r');
$data = fread($fh, filesize($file));
echo $data;
fclose($file);
}
?>My problem is this, when I load the page in internet explorer, It works correctly and displays the logged in images / videos whilst logged in, and the error pictures otherwise.
However in Firefox it does not work for the video. I did a tcptrace and discovered that it is not passing the PHPSESSID cookie when it calls the server for the video (the second time)
Source code to my problem
http://dougwa.freepgs.com/test.zip
you will need to configure your server to use php for .gif and .wmvs to get it to work
Thanks ahead of time
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]