Alright, I hate to submit 4 in a row, but this is a challenge for me. The only thing I don't know what to do with is the case where they have both cookies and referrers disabled. Maybe in that case, I could compare database logs of ip addresses and times. That would get big fast, so there would have to be some sort of automatic cleanup. But here's what I came up with so far:
Code:
session_start();
function check_referrer(){
$referring=parse_url($_SERVER['HTTP_REFERER']);
//either directly typed or refererrs disabled
if(!$referring['host']){
//Referring host doesn't exist, so check for existing session
if($_COOKIE['lala']==sha1('$LL...//')){
//means they've been on this site recently even though the referrer isn't present
return "all is well";
} else {
//means they haven't been on the site, or they have both refererrs and cookies disabled
return "How do I get around this?";
}
} else if($referring['host']==$_SERVER['HTTP_HOST']){
return "all is well";
} else{
return "all is not well";
}
}
echo check_referrer();
Bookmarks