Results 1 to 3 of 3

Thread: How do I use php code in html page. Plz help me. This may be simple answer for many

  1. #1
    Join Date
    Mar 2007
    Posts
    17
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Smile How do I use php code in html page. Plz help me. This may be simple answer for many

    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.

    <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>
    And This PHP code generates Url that can be accessed one single time.

    <?
    /*
    * 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";

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

    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.

  2. #2
    Join Date
    Dec 2004
    Posts
    83
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by Dinold View Post
    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.



    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.

    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.
    I would recommend streaming your videos instead. It's a lot easier, and a lot safer because they can't download the file. Most hosting providers offer streaming service, at least good ones do.

    Look into streaming, I think this is your best option rather than script above.

    viktor

  3. #3
    Join Date
    Mar 2007
    Posts
    17
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Smile

    Can you tell me another way. My hosting service does not provide this.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •