Quote:
|
Originally Posted by rowan
I looked at this a few times and all I can see is code to send the contents of an image from a mysql db. Where's the hotlink protection?
|
I was thinking more along the lines of using sessions to make the call. But as pointed out, browsers set to not accept cookies by default would get locked out.
Then I thought of the javascript solution below. You could maybe only implement the javascript if there was no referer value, that way not locking out those that have javascript turned off...unless you have javascript off and referer set to zero, but then in that case scenario, you're prolly up to no good anyways....
Quote:
|
Originally Posted by borked
Code:
<script language=javascript>
//Beginning of "test.js" file
var accepted_domains=new Array("yourdomain.com","www.yourdomain.com")
var domaincheck=document.location.href //retrieve the current URL of user browser
var accepted_ok=false //set acess to false by default
if (domaincheck.indexOf("http")!=-1){ //if this is a http request
for (r=0;r<accepted_domains.length;r++){
if (domaincheck.indexOf(accepted_domains[r])!=-1){ //if a match is found
accepted_ok=true //set access to true, and break out of loop
break
}
}
}
else
accepted_ok=true
if (!accepted_ok){
alert("Fuck off linking to my images!!")
history.back(-1)
}
</script>
<img src="image123.jpg">
|