Jump to content

Recommended Posts

You could make a mysql table and use a code like this :

[code]
<?

include("configfile");

                            $sel = mysql_query("SELECT * FROM downloads WHERE name='dowload'");
                   while ($download = mysql_fetch_array($sel)){


if($download[times] <= 5){
//5 is max number of downloads
echo "<a href=download.zip >Download.zip</a><br>";
}else{
echo "No downloads."
}

if (url = "www.yoursite.com/download.zip"){

mysql_query("UPDATE downloads set times=$download[times]+1 WHERE name='download'");

[/code]


I think that may work
Link to comment
https://forums.phpfreaks.com/topic/6794-unique-link-download/#findComment-24704
Share on other sites

You don't want people to have the actual address to the file. I suggest using the header() to pass content type and pass the content of the file to the user if the proper conditions are met. Alternatively you could create temporary downloads that expire after 24 hours or something. You could have temporary directory and move the files the user requests to that directory if the criteria is met then have the file removed in 24 hours.
Link to comment
https://forums.phpfreaks.com/topic/6794-unique-link-download/#findComment-24754
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.