Hi, I am new to php scripting.
I just learned about this "Generating One-Time URLs with PHP"
Please visit this link for more info http://www.onlamp.com/pub/a/php/2002...time_URLs.html
My question is that How Could I use this code that generates this special link to the file and use it into object player.
I think this may be confusing to many.
This is the code to embedded a MS Media Player.
And This PHP code generates Url that can be accessed one single time.<embed id="wmplayer" pluginspage="http://www.microsoft.com/Windows/MediaPlayer/" src="PUT THE VIDEO LINK HERE" width="419" height="350" type="application/x-mplayer2" volume="0" showtracker="0" showpositioncontrols="0" showgotobar="0" showdisplay="0" showaudiocontrols="1" showcontrols="1" sendplaystatechangeevents="-1" sendmousemoveevents="0" sendmouseclickevents="0" sendkeyboardevents="0" senderrorevents="-1" sendwarningevents="-1" sendopenstatechangeevents="-1" enabletracker="-1" enablefullscreencontrols="1" enablepositioncontrols="-1" enablecontextmenu="0" enabled="-1" displaysize="4" displaymode="0" allowchangedisplaysize="-1" allowscan="-1" autosize="-1" autostart="1" allowfullscreen="true" bgcolor="#000000"><noembed></noembed>
What I am trying to do is that I want to use this code with the embedded Media Player. On the embedded media player where it asked for the source "src="PUT THE VIDEO LINK HERE" I want to use the "http://".$_SERVER['HTTP_HOST']."/get_file.php?q=$token" link that is being generated by the script to it.<?
/*
* generate_url.php
*
* Script for generating URLs that can be accessed one single time.
*
*/
/* Generate a unique token: */
$token = md5(uniqid(rand(),1));
/* This file is used for storing tokens. One token per line. */
$file = "/tmp/urls.txt";
if( !($fd = fopen($file,"a")) )
die("Could not open $file!");
if( !(flock($fd,LOCK_EX)) )
die("Could not aquire exclusive lock on $file!");
if( !(fwrite($fd,$token."\n")) )
die("Could not write to $file!");
if( !(flock($fd,LOCK_UN)) )
die("Could not release lock on $file!");
if( !(fclose($fd)) )
die("Could not close file pointer for $file!");
/* Parse out the current working directory for this script. */
$cwd = substr($_SERVER['PHP_SELF'],0,strrpos($_SERVER['PHP_SELF'],"/"));
/* Report the one-time URL to the user: */
print "Use this URL to download the secret file:<br><br>\n";
print "<a href='http://".$_SERVER['HTTP_HOST'].
"$cwd/get_file.php?q=$token'>\n";
print "http://".$_SERVER['HTTP_HOST']."/get_file.php?q=$token</a>\n";
?>
So This will make it hard for people to leech my video. But how do i use both scripts together and make this happen.
So basically I want the embedded media player source to read this link "http://".$_SERVER['HTTP_HOST']."/get_file.php?q=$token" to play. How do i make it work out.
So on the media player it should open the generated link and play.



Reply With Quote

Bookmarks