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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.