Dear people,
My first forum post here, and I'm from The Netherlands, so please bare with me.
I'm trying to show some QuickTime movies (.mov) on my website, but prevent direct access.
Therefore I load a php file instead of a .mov file in my player, and pass on session variables to check if the player requested the video (instead of some user directly requesting it)
The player looks something like this:
Code:
<? $_SESSION["videorequestfile"] = "test.mov"; $_SESSION["videorequest"] = true; $_SESSION["playerrequest"] = true; ?>
<object name="video-big-quicktime" height="380" width="471" classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="http://www.apple.com/qtactivex/qtplugin.cab" >
<param name="src" value="../test/movobject.php" />
In this movobject.php file, the actual mov file is loaded, and the session variables are checked and unset.
The file is this:
Code:
<?php
@session_start();
if (isset($_SESSION["videorequest"]) && isset($_SESSION["videorequestfile"])) {
unset($_SESSION["videorequest"]);
$_SESSION["videosubrequest"] = true;
}
if (! isset($_SESSION["videosubrequest"]) || ! isset($_SESSION["videorequestfile"])) {
unset($_SESSION["videosubrequest"]);
unset($_SESSION["videorequestfile"]);
die ("Direct access to video is prohibited");
}
$mov = $_SERVER["DOCUMENT_ROOT"]."/upload/videos/".$_SESSION["videorequestfile"];
header('Content-type: video/quicktime');
header('Content-Length: '.filesize($mov));
$content = file_get_contents($mov);
print $content;
@unset($_SESSION["videosubrequest"]);
?>
The problem is, that I want the
$_SESSION["videosubrequest"] variable to be unset, because if it stays in the user's session, the direct access check doesn't work.
When removing the
@unset($_SESSION["videosubrequest"]); the player works fine, displays the movie perfectly. But with it, the movie is not played.
Can anyone tell me what I can do to fix this?
Any help is greatly appreciated!