steviez Posted July 29, 2007 Share Posted July 29, 2007 Hi, I run a download site and when a user goes to the url to get a file eg: http://www.mysite.com/v/7905356/_SSOOK21_wellbeing_sub3.jpg.html This code is given in PHP: <?=SITE_URL;?>/d/<?php echo $rsFile->fields['key']; ?>/<?php echo time(); ?>/<?php echo $rsFile->fields['filename']; ?>.html The users have to wait 25 seconds before they can download unless they are a paid user but the link that my site gives out can be found in the page source and used over and over again by non paying users. Is there a way for me to make the link expire or not viable? Thanks Quote Link to comment Share on other sites More sharing options...
corbin Posted July 29, 2007 Share Posted July 29, 2007 Hmmmmm..... You could store temporary links in a database mapped to physical files, or you could do something like: download.php session_start(); if(isset($_POST['file'])) { //they submitted the form if($_SESSION['file_time'] >= (time() - 25)) { $_SESSION['file_time'] = 0; //output file } else { echo 'You didn\'t wait long enough!'; } } else { $_SESSION['file_time'] = time(); //output form that they have to click on after 25 seconds.... maybe a fancy little javascript count down or something too... } Quote Link to comment Share on other sites More sharing options...
AndyB Posted July 29, 2007 Share Posted July 29, 2007 perfect solution - http://www.onlamp.com/pub/a/php/2002/12/05/one_time_URLs.html Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.