|
Posted by Dan Rossi on 08/29/05 10:20
Hi there I am trying to use php to output an asx playlist but depends
on a special hash in the url to prevent hotlinking. I am using a
session to store a generated token when generating the url to display
in an embedded player. The token is added in the filename and I am
using rewrite rules to load another php script which does a check of
the hash in the querystring with the token stored in the session.
However its having unexpected results. When i add the check for the
session token the media player either doesnt player in PC or outputs
playlist format not recognised in Mac. If i do a check for the hash
only its ok. Here is an example
if ($_GET['h'] && $_GET['filename'] && $this->hash) {
$file = WMSERVER.Feeds_Hotlink_Check::strip_paths($_GET['filename']);
$this->filename = preg_replace('/stream/','wmv',$file);
$this->tpl->compile('playlist.html');
header("Content-Type: video/x-ms-wmv");
die(trim($this->tpl->outputObject($this)));
}
breaks with this
if ($_GET['h'] && $_GET['filename'] && $this->token) {
$file = WMSERVER.Feeds_Hotlink_Check::strip_paths($_GET['filename']);
$this->filename = preg_replace('/stream/','wmv',$file);
$this->tpl->compile('playlist.html');
header("Content-Type: video/x-ms-wmv");
die(trim($this->tpl->outputObject($this)));
}
ideally i want it to look like
if ($_GET['h'] && $_GET['filename'] &&
(strcmp($this->token,$this->hash)==0)) {
$file = WMSERVER.Feeds_Hotlink_Check::strip_paths($_GET['filename']);
$this->filename = preg_replace('/stream/','wmv',$file);
$this->tpl->compile('playlist.html');
header("Content-Type: video/x-ms-wmv");
die(trim($this->tpl->outputObject($this)));
}
they are being set earlier in the script like so
$this->token = trim($_SESSION['token']);
$this->hash = trim($_GET['h']);
any ideas ?
Navigation:
[Reply to this message]
|