1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Protecting file

Discussion in 'HTML, Graphics & Programming' started by paulsheff, 7 Mar 2006.

  1. paulsheff

    Hitman

    Joined: 16 May 2005

    Posts: 680

    Unix hosted, I need people to be able to log in with a supplied pin, checks their pin is valid, shows them a button to download a file, they click the link, db is updated to say they've downloaded the file, header redirect to fire open the file, pin is no longer valid...

    Now I think I'm pretty much ok with doing all that in PHP, but the file in question is one mp3 file (a promo sample) so the only way I want this to be accessed is via this process so if people direct link to try and dl it, it tells em to sod off... Well redirects to the login page.

    Any ideas?
     
  2. Beansprout

    Man of Honour

    Joined: 31 Jan 2004

    Posts: 16,316

    Location: Plymouth

    Use mod_rewrite to redirect any hits to the file to a PHP script which checks for authentication and outputs the file if authed, else redirects to the login page :)