Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Page 1 of 3 123 LastLast
Results 1 to 15 of 33
  1. #1
    New Coder
    Join Date
    Mar 2008
    Posts
    20
    Thanks
    2
    Thanked 0 Times in 0 Posts

    PHP Coding Request- PHP Redirect with Timestamp

    I am brand new to the PHP world and a friend of mine did the majority of the legwork to get my website up and running. However, I have one final task and it's proving to be the more arduous for me because I don't know what I'm doing...

    To break it down, I would like to have streaming media on my website without hosting it. I chose Flyupload as the host because it's compatible with a streaming divx player, so long as the file is in divx avi. Anyway, Flyupload links are encoded with Base64 time encryption. If the link gives a time that isn't recently, Flyupload denies direct access to that file and the link is then broken (and useless for streaming).

    Someone on another forum found a way to work this out by redirecting the flyupload link using PHP to attach a current base64 timestamp to that link, to fool Flyupload into thinking it's a recent file. So long as the file stays recent, the file stays active.

    My question to you guys is what is a simple PHP code I can use to produce a redirected link with a base64 encoded timestamp so I can link to media?

    Before my friend left for vacation (and left me stuck with this problem), he did the following simple code just to test the idea:

    PHP Code:
    <a href=http://www4.flyupload.com/dl?fid=5167274&t=<?php print base64_encode(time()); $url =$_GET['http://www4.flyupload.com/dl?fid=5167274']; ?>>Link</a>
    What this did was produce a download link for a movie that stays constant because the time stamp stays current. So the proof of concept works and can be found here.

    I have found a site that does something similar to what I'm looking to do here... Except I don't need a massive amount of media, just a few.

    I am looking for the simplest solution to this problem. I know a lot of you guys are absolutely brilliant, so any help would be greatly appreciated. Also, I spend hours on end doing fruitless work, I will likely continue the trend until this one gets solved. Thank you for any and all assistance... I've been banging my head on the wall with this one.

  • #2
    Super Moderator Inigoesdr's Avatar
    Join Date
    Mar 2007
    Location
    Florida, USA
    Posts
    3,647
    Thanks
    2
    Thanked 406 Times in 398 Posts
    That seems to be working; what are you asking?

  • #3
    New Coder
    Join Date
    Mar 2008
    Posts
    20
    Thanks
    2
    Thanked 0 Times in 0 Posts
    The proof of concept download link is only a download link and not a stream-friendly link. If I were to use the very same link to stream media, it would fail ten minutes from now because it's not running through that PHP redirect, which attaches the current timestamp.

    What I'm asking is if anyone knows how to PHP a link so that it redirects through a PHP page that will attach a timestamp before it connects to flyupload and how to link to it in a media player using the typical src=" ". Without a proper redirected link, they will all continue to die. I really don't know PHP at all, so I'm not very helpful.

    If there's another way of doing it, I'm all ears. This is all I've been able to figure out so far...

  • #4
    Super Moderator Inigoesdr's Avatar
    Join Date
    Mar 2007
    Location
    Florida, USA
    Posts
    3,647
    Thanks
    2
    Thanked 406 Times in 398 Posts
    If you knew the id for the file(say if it were passed in the URL), and the specific server you redirect to doesn't matter, you could do something like this:
    PHP Code:
    <?php
    $fid 
    intval($_GET['fid']);
    header('Location: http://www4.flyupload.com/dl?fid=' $fid '&t=' base64_encode(time()));
    ?>
    You would point the user to yoursite.com/page.php?fid=5167274 and they should be redirected to the stream automatically.
    Last edited by Inigoesdr; 03-05-2008 at 03:27 AM. Reason: Fixed a typo

  • #5
    New Coder
    Join Date
    Mar 2008
    Posts
    20
    Thanks
    2
    Thanked 0 Times in 0 Posts
    I feel like you're on to something. My friend was playing around with some very similar code before he took his flight out of here but he didn't get to finish it up. I tried using your code, exactly as you typed, same formatting as you posted, and I got the following error:


    Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in /home/bobc25/public_html/fly.php on line 3

    Anything I can do to make this code run without error?

    ...Thanks so much for the quick replies, you guys are fast...

  • #6
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    Post fly.php please. The code posted by Ini has no errors in it so it must be something in how you implemented the code.
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #7
    New Coder
    Join Date
    Mar 2008
    Posts
    20
    Thanks
    2
    Thanked 0 Times in 0 Posts
    This is the PHP I copied and pasted...

    PHP Code:
    <?php
    $fid 
    intval($_GET['fid']);
    header('Location: http://www4.flyupload.com/dl?fid=986890' ' . $fid . '&t= . base64_encode(time());
    ?>
    Unless I missed something, I don't understand what's wrong with it. Would it be more feasible for someone to attach the PHP they know is correct and I'll upload it to the server, do it that way?

  • #8
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    You have too many quotes
    PHP Code:
    dl?fid=986890' ' $fid 
    Remove the first one.
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #9
    New Coder
    Join Date
    Mar 2008
    Posts
    20
    Thanks
    2
    Thanked 0 Times in 0 Posts
    Now I've got the following error in its place:

    "Parse error: syntax error, unexpected ';' in /home/bobc25/public_html/fly.php on line 3"

    Thanks again for the quick replies... Much appreciated...

    Using the following PHP:

    PHP Code:
    <?php
    $fid 
    intval($_GET['fid']);
    header('Location: http://www4.flyupload.com/dl?fid=986890  ' $fid '&t=' base64_encode(time());
    ?>
    Last edited by lifemisled; 03-05-2008 at 02:14 AM. Reason: More Helpful With PHP Included...

  • #10
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    Missing a ) before the ;
    PHP Code:
    <?php
    $fid 
    intval($_GET['fid']);
    header('Location: http://www4.flyupload.com/dl?fid=' $fid '&t=' base64_encode(time()));
    ?>
    Last edited by _Aerospace_Eng_; 03-05-2008 at 02:23 AM.
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #11
    Super Moderator Inigoesdr's Avatar
    Join Date
    Mar 2007
    Location
    Florida, USA
    Posts
    3,647
    Thanks
    2
    Thanked 406 Times in 398 Posts
    Quote Originally Posted by _Aerospace_Eng_ View Post
    Missing a ) before the ;
    Whoops.

  • #12
    New Coder
    Join Date
    Mar 2008
    Posts
    20
    Thanks
    2
    Thanked 0 Times in 0 Posts
    The PHP was parsed correctly this time and I have uploaded it. I am checking to see if the links work currently.

    I appreciate all of your help and I will post back here with the results asap. Thanks again...

    PS- Assuming this code works well, and I suspect it may, is there a way to reference multiple links in the same php, so I don't have to Fly1, Fly2, and so on?

  • #13
    New Coder
    Join Date
    Mar 2008
    Posts
    20
    Thanks
    2
    Thanked 0 Times in 0 Posts
    Alright, I have officially tried 5-6 different links using the PHP and it seems to be working. The real proof is how it holds up overnight but it's looking great. Thank you so much for helping me work this out because I've been going nuts trying to figure it out...

    To close this mess up, if there's anyway to add multiple links in the same PHP, it would save me a TON of time.

    Thank you for all the quick hits and knowledgeable answers. This place goes above and beyond what I anticipated when I first posted my query. Thank you guys so much.

  • #14
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    Not sure what you mean. Once you call the header it goes to the next site and stops parsing your php. Be more clear on what it is that you are trying to do.
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #15
    New Coder
    Join Date
    Mar 2008
    Posts
    20
    Thanks
    2
    Thanked 0 Times in 0 Posts
    I am looking to post about 10-20 videos residing on Flyupload severs. Now that we've got a working redirect, I'm trying to figure out if it's possible to code the PHP so that I can reference all 10-20 links in the same PHP so that I don't have to use an individual PHP for every movie I want to stream. If it's not possible I'll get to work on a bunch of PHP's but I was hoping there was a simpler way...

    I hope this makes a bit more sense... If it doesn't I'll be happy to try to clarify some more.


  •  
    Page 1 of 3 123 LastLast

    Posting Permissions

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