Jump to content

Unique Link Download


elementz

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

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.