PDA

View Full Version : attachements.php ?


etones
10-20-2002, 10:53 AM
Is there a simple way to make sure that attachments stored in the DB cant be hot linked by extrernal sites?

Secondly, is there a hack that will only allow you to se an attachment if you are a registed member?

Cheers,
Taz

Chris M
10-20-2002, 11:06 AM
@etones - Just set the attachments to "display a link to the attachment", then set Guest viewing permissions "can download attachments" to NO...

As for the attachments protection :

Open up attachment.php (root folder)

Find :

<?php
add after it
$referers = array ('www.yoursite.com','yoursite.com','123.456.7.8');

function check_referer($referers){
if (count($referers)){
$found = false;
$temp = explode('/',getenv("HTTP_REFERER"));
$referer = $temp[2];
for ($x=0; $x < count($referers); $x++){
if (ereg ($referers[$x], $referer)) {
$found = true;
}
}
if (!$found){
exit;
}
return $found;
} else {
return true;
}
}

check_referer($referers);

Change "yoursite.com", "www.yoursite.com", and "123.456.7.8" to the proper values:)

123.456.7.8 = your site's IP address;)

You can also do the same for avatar.php, if you dont want them to be able to view your avatars off your site:)

i.e.

My Profile with Avatar (http://www.darkblazes.com/forums/member.php?s=&action=getinfo&userid=1) <- Viewing from my site

http://www.darkblazes.com/forums/avatar.php?userid=1&dateline=1034425026 <- My avatar - Cant view it:)

Satan

etones
10-20-2002, 11:10 AM
nice one hellsatan, appreciate that one! :D

Cheers,
Taz

Chris M
10-20-2002, 11:14 AM
No probs:)

I found this a while back on vB.org myself - Its very useful:)

Satan