Jump to content

Unset() messes up video object


xl2000

Recommended Posts

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:

 

<? $_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:

 


<?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!

Link to comment
https://forums.phpfreaks.com/topic/145210-unset-messes-up-video-object/
Share on other sites

Nope, sorry... same result...

I also added error_reporting(E_ALL); ini_set('display_errors',TRUE); just to be sure. Strangely, no errors appear

 

BTW: I tried the same script for Flash movie (.flv) using an flash player, and that works OK, even with the unset.

I don't know why (or if) there is any difference between mov and flv

Nope, sorry... same result...

I also added error_reporting(E_ALL); ini_set('display_errors',TRUE); just to be sure. Strangely, no errors appear

 

BTW: I tried the same script for Flash movie (.flv) using an flash player, and that works OK, even with the unset.

I don't know why (or if) there is any difference between mov and flv

 

 

Just for kicks, try putting in a sleep() function right before the unset. Just to see...

 

Make it sleep for say, 10 seconds?

 

sleep(10);

 

 

Strangely enough, it works in FireFox, Chrome, Safari and Opera, but not in IE (6 & 7 tested anyway)

But I'm not sure I understand why though....

Changing the seconds doesn't seem to matter either....

 

BTW, thanks for the quick responses!

 

Another reason why I HATE IE...do you know how many wasted hours I spent trying to fix code because it worked in Firefox but not IE???

 

Unfortunately you will have to keep digging to find out, IE and FF have their own way of parsing HTML content so you may have to create conditionals for each browser and how to handle them...

 

 

Hmmm... I was affraid it would come to this....

I develop my stuf in FF, because of the very handy addons.

When it's finished, I try IE, almost allways not working right away.

Normally I fix all things myself, but this problem was bugging me for two days now.

If you, or anyone has any ideas, please let me know. I'll keep you posted of the progress anyway!

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.