Issue with generating asx playlist with php
| From: | Dan Rossi | Date: | Mon, 29 Aug 2005 07:20:14 +0000 |
| Subject: | Issue with generating asx playlist with php | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-221494@lists.php.net to get a copy of this message | ||
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 ?