Encrypting a link in PHP

Discussion in 'OT Technology' started by brds, Jun 4, 2007.

  1. brds

    brds OT Supporter

    Joined:
    Jun 26, 2006
    Messages:
    17,646
    Likes Received:
    15
    Location:
    Atlanta
    I have a site that contains videos that fellow OT'ers wanna see (sopranos, entourage, and a :naughty:couple others:naughty:.) I would like to make it so that once the user enters a username/password to view the download link, they are unable to view the address to the file or share it with anybody else. I currently have a php page that has a $hyperlink variable and then an $encrypted = md5($hyperlink) command. When i post the download link, and encrypted filename comes up, but when the user clicks it, it goes to a 404 page.

    Is there a way i can encrypt a hyperlink so that the user can't view the storage location of the file? Also, is there a way that i can make it so that the link will not work unless the user has gone through my login.php page?

    you can view my login page at www.ihaswebsite.com/vip/ but i took out the encryption part since it's not working.

    any help would be appreciated
     
  2. Cymric

    Cymric New Member

    Joined:
    May 8, 2007
    Messages:
    16
    Likes Received:
    0
    Location:
    Anywhere the body takes us...
    Are you using cookies or sessions in your login page?
     
  3. brds

    brds OT Supporter

    Joined:
    Jun 26, 2006
    Messages:
    17,646
    Likes Received:
    15
    Location:
    Atlanta
    Not exactly sure what's what (php newb). What i'm doing is, the login page is simply a form that sends the username & password to a php script which checks to make sure the username and password are both correct. It's not a multi-user script... just one username & password for everybody who goes to the site. Hope that helps
     
  4. uf20wop

    uf20wop OT Supporter

    Joined:
    Feb 22, 2004
    Messages:
    34,455
    Likes Received:
    1
    Location:
    PBG, FL
    rm -r *.*
     
  5. Slid.

    Slid. I'm a guy.

    Joined:
    Oct 25, 2001
    Messages:
    1,928
    Likes Received:
    0
    Location:
    NH
    Code:
    $path = "real-path-of-file.avi";
    
    header("Content-Type: application/octet-stream");
    $fn=fopen("$path","r");
    fpassthru($fn);
    If you named this file "super.php" then whenever someone viewed it a download of "real-path-of-file.avi" would begin. It doesn't sound like you're using a database so you could just have an array and/or if statements to define $path based off whatever file they want to download.
     
  6. P07r0457

    P07r0457 New Member

    Joined:
    Sep 20, 2004
    Messages:
    28,491
    Likes Received:
    0
    Location:
    Southern Oregon
    watch out because your ram usage is going to go through the roof!
     
  7. brds

    brds OT Supporter

    Joined:
    Jun 26, 2006
    Messages:
    17,646
    Likes Received:
    15
    Location:
    Atlanta
    que?
     
  8. P07r0457

    P07r0457 New Member

    Joined:
    Sep 20, 2004
    Messages:
    28,491
    Likes Received:
    0
    Location:
    Southern Oregon
    fpassthru eats memory like a motherfucker. Use it to post a link in OTAH and it'll start using a few hundred MB in short-order.
     
  9. o2

    o2 Witty Title Here OT Supporter

    Joined:
    Oct 4, 2005
    Messages:
    16,099
    Likes Received:
    12
    Location:
    Toronto
    Im actually interested in finding a good solution for this as well. Right now Im simply using the header("Location:"); but it just redirects to the full file path.

    If you wanna stream videos, you can mask it with a playlist, but for downloading files.. I dont know.
     
  10. o2

    o2 Witty Title Here OT Supporter

    Joined:
    Oct 4, 2005
    Messages:
    16,099
    Likes Received:
    12
    Location:
    Toronto
    Found a possible solution that might work for you, but my media is hosted on a different server.... so it wont work for me

    Code:
    [FONT=arial][SIZE=2][COLOR=#000000]<? 
    [email protected]("file.zip"); 
    Header("Content-type: application/zip"); 
    Header("Content-type: octet-stream"); 
    Header('Content-Disposition: attachment; filename="file.zip"'); 
    if($content_len!=FALSE) 
    { 
     Header("Content-length: $content_len"); 
    } 
    readfile("file.zip"); 
    ?> [/COLOR][/SIZE][/FONT]
     
  11. retorq

    retorq What up bitch??

    Joined:
    Dec 14, 2006
    Messages:
    6,061
    Likes Received:
    0
    Location:
    Mohave Desert
    Sorry I gotta ask, why is it when someone asks how to do something in general (burn a DVD) you jump up and down, cry illegal and not help but when this guy wants to do something that is obviously illegal, you help out??

    :rolleyes:

     
  12. P07r0457

    P07r0457 New Member

    Joined:
    Sep 20, 2004
    Messages:
    28,491
    Likes Received:
    0
    Location:
    Southern Oregon
    then lock the thread.

    :lockd:






    you bitch when I enforce the rules. you bitch when I turn the other cheek. So basically you're just a bitch faggot that likes to cry a lot and can never be satisfied. got it.
     
  13. o2

    o2 Witty Title Here OT Supporter

    Joined:
    Oct 4, 2005
    Messages:
    16,099
    Likes Received:
    12
    Location:
    Toronto
    He made a very valid point. the method described is faulty, and should not be used.
     
  14. retorq

    retorq What up bitch??

    Joined:
    Dec 14, 2006
    Messages:
    6,061
    Likes Received:
    0
    Location:
    Mohave Desert
    You're confused, I've NEVER bitched before, I just find it humorous that you won't help a guy make a DVD yet you'll give tips to some guy streaming the Sopranos and Entourage. :rofl:

     
  15. retorq

    retorq What up bitch??

    Joined:
    Dec 14, 2006
    Messages:
    6,061
    Likes Received:
    0
    Location:
    Mohave Desert
    You may be right, when I saw the first post mention the Sopranos I figured Jolly would be in here lecturing on copyrighted material again.

     

Share This Page