mcmuney Posted January 27, 2011 Share Posted January 27, 2011 Can php encrypt a link so that it's hidden or expires after a download or x number of days? An example of this use would be on music download sites. Link to comment https://forums.phpfreaks.com/topic/225806-is-it-possible-to-encrypt-a-download-link-using-php/ Share on other sites More sharing options...
Bradley99 Posted January 27, 2011 Share Posted January 27, 2011 You can use base64_encode php function on your scripts to hide or encrypt your real url. For example, lets say you have your url like this: http://www.example.com/?song_id=451 well, if you use this code: echo '<a href="http://www.example.com/?song_id='.base64_encode ('451').'">Song 451</a>'; you should see the url like this: http://www.example.com/?song_id=NDUx so now all you have to do is decode it in your browser like this in php: echo base64_decode('NDUx'); the output will be 451 thats it i hope that helps Link to comment https://forums.phpfreaks.com/topic/225806-is-it-possible-to-encrypt-a-download-link-using-php/#findComment-1165775 Share on other sites More sharing options...
mcmuney Posted January 27, 2011 Author Share Posted January 27, 2011 That does help to explain the encryption process, but how will the encrypted link expire. Let's say I use this link (http://www.example.com/?song_id=NDUx), what's to keep the user who downloads it to send it out to all their friends from also being able to download the file? Link to comment https://forums.phpfreaks.com/topic/225806-is-it-possible-to-encrypt-a-download-link-using-php/#findComment-1165786 Share on other sites More sharing options...
Bradley99 Posted January 27, 2011 Share Posted January 27, 2011 http://www.phpsuccesstools.com/do.php?p=scripts Go down to Click Based Expiration Link Login with password: opensesame And your done. Link to comment https://forums.phpfreaks.com/topic/225806-is-it-possible-to-encrypt-a-download-link-using-php/#findComment-1165790 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.