Forum Moderators: coopster
That's pretty straightforward. The visitors referrer (unless they block/disable it) is contained in the $_SERVER[HTTP_REFERER] server variable [php.net]. You can search this for your domain name using a php string function such as strpos [php.net]:
<?
// check for occurance of example.com in the referrer. strpos wil return 0 if it isn't found
if (strpos("example.com",$_SERVER[HTTP_REFERER])==0) {
echo "External or no referrer";
}
else {
echo "Internal referrer";
}
?>