I’m not talking about if user has visited the website before, but in general when a user (regardless if they’ve visited the website before) that’s not logged in, has just visited the homepage of your website? I’m thinking it has to do something with sessions, but I haven’t quite figured it out yet.
Share
You can do this with
$_SERVER['HTTP_REFERER']that will return the last page’s address visited. You can not rely on this for important things because this variable can be changed and might be not set by the user agent.From the PHP documentation:
You could also use a cookie or a session variable and set the page visited like this:
and check with:
References