Jump to content

[SOLVED] Please help me !


steviez

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/62253-solved-please-help-me/
Share on other sites

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

Link to comment
https://forums.phpfreaks.com/topic/62253-solved-please-help-me/#findComment-309847
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.