Just look at this simple example because after hours of trying, I can't get it to work.
if(!isset($_SESSION['alien'])){
if(!isset($_SERVER['HTTP_REFERER']) &&
$_SERVER['HTTP_REFERER'] != 'http://www.alien-planet.com/'){
echo 'Go AWAY';
}else{
$_SESSION['alien'] = 'Yes';
}
}
the purpose is, if someone is coming from alien-planet.com, to never show the Go AWAY
message. That is when he/she lands on the index page. But if that person came from that website, a session $_SESSION['alien'] = 'Yes';
will be initialized, so even if that person refreshes the page, or goes through the site links, he/she won't see the message
the problem first time you visit the page, you don't see the Go AWAY
message (meaning it works, since I am coming from alien-planet.com) but, as I go to other pages, still with the same site with session_start()
included to all pages, I somehow loose the message, and when I go back to index page again I see the Go AWAY
message.
I don't understand what is causing this. there are no session destroy/unset in the pages.