Hi,
I have some links to download images from my site, and I don’t want any other site linking directly to those image download links other than from a page on my site.
So I wrote something like this:
[code=php]<?php
$referrer = $_SERVER[‘HTTP_REFERER’];
// CLEAN URL FACTOR
$url2 = strip_tags($referrer);
$url2_array = explode(“/”, $url2);
array_shift($url2_array); // First one is empty
if($url2_array[1] != “mydomain.com”) {
echo ”
<script language=”JavaScript”>
<!–
window.top.location.href=”http://mydomain.com”
–>
</script>
“;
}
?>
The script works fine, but the problem is that I’ve heard HTTP_REFERER is not all that reliable – that there will be some browsers that do not support it, and thus the variable $referrer will turn up null even when they were referred to the download page from a page on my site.
Is there a way around this?
Thanks for your time!