Jens Wedin
Member
Posted 7 years ago #
I want to show a site description on my article pages if the user comes from another site than my own. I think it has to be done with a some referer code. Does anyone know how do that? I just looking for an simple if then else thingy.
Thanks,
JediSthlm
It goes something like this:
<?php
$mydomain = 'jedisthlm.com';
if(strstr(!$_SERVER['HTTP_REFERER'],$mydomain)) {
?>
~Your description content goes here~
<?php } ?>
Jens Wedin
Member
Posted 7 years ago #
Your awsome :D
Thanks alot, I´ll try that right away.
Jens Wedin
Member
Posted 7 years ago #
I tried the code but was not able to get it working, I did make some changes and now it works fine. This is what I did.
<?php
$mydomain = "jedisthlm";
$referer = $_SERVER['HTTP_REFERER'];
$domain = explode(".", $referer);
if ($domain[1] == $mydomain) {
echo "<!-- Found an referer, nothing shown -->";
} else {
echo "Show something";
}
?>