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. Quote Link to comment 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 Quote Link to comment 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? Quote Link to comment 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.