Page 1 of 1

How Can I Secure My Links ?

Posted: Mon Jan 02, 2006 12:12 pm
by saqib389
i have a music website.. and many of persons use my links in their site..
i have login registration system in my site also.....
can any one tell me that how can i secure my links

i mean whenver some other person want to put my link into their site.. then there would not b download any thing....

coz my bandwidth is very much used if ppl used my links.. so please guyz if any one can tell me how can i secure my links.. that ppl cant uses into their sites.....


any one can write the code ????

Posted: Mon Jan 02, 2006 12:23 pm
by Burrito
you could send the file down with header()'s and check to see if a session var is set on your site...

If the session var isn't set, don't send it

Posted: Mon Jan 02, 2006 12:52 pm
by josh
If your site does not use sessions, you can also put a random token into the download link, and insert it into a mysql table, and then on the page that sends the file for downloading you check for the presence of a valid token

Posted: Mon Jan 02, 2006 12:54 pm
by John Cartwright
I would probably keep all your music outside the web directory, so only YOUR script has access to the music via header(), as burrito suggested, in combination with readfile().

Posted: Mon Jan 02, 2006 1:12 pm
by saqib389
thx guyz
but not 100% clear...

can one refer me anyY code that will help me more.....

Posted: Mon Jan 02, 2006 2:36 pm
by John Cartwright

Posted: Mon Jan 02, 2006 2:42 pm
by Chris Corbyn
It sounds like you're talking about Hot Linking. Most hosts provide support for Hot Link protection which means that certain files can only be accessed from your own server. If someone links to a file from elsewhere you just get redirected.

Apache supports it as far as I know but I've never set it up myself.

Posted: Mon Jan 02, 2006 2:44 pm
by John Cartwright
d11wtq wrote:It sounds like you're talking about Hot Linking. Most hosts provide support for Hot Link protection which means that certain files can only be accessed from your own server. If someone links to a file from elsewhere you just get redirected.

Apache supports it as far as I know but I've never set it up myself.
True.. but I like to get my hands dirty with a download script, because its much easier to handle statistical information without having to read through the great logs of apache ;)