You can use the HTTP_REFERER header.
<?php
$allowed_domains = array(
'a-good-domain.com',
'another-nice-one.org',
);
$allowed = false;
foreach ($allowed_domains as $a) {
if (preg_match("@https?://$a/.*@", $_SERVER['HTTP_REFERER'])) {
$allowed = true;
}
}
if ($allowed)
echo "Nice domain";
else
echo "Ugly domain";
Johan
2010-05-06 14:01:16