Jump to content

Is it possible to encrypt a download link using php?


mcmuney

Recommended Posts

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

 

 

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?

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.