show content depending on where the user comes from (4 posts)

  1. Jens Wedin
    Posted 11 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.



  2. Kafkaesqui

    Posted 11 years ago #

    It goes something like this:

    $mydomain = 'jedisthlm.com';
    if(strstr(!$_SERVER['HTTP_REFERER'],$mydomain)) {

    ~Your description content goes here~

    <?php } ?>

  3. Jens Wedin
    Posted 11 years ago #

    Your awsome :D
    Thanks alot, I´ll try that right away.

  4. Jens Wedin
    Posted 11 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.

    $mydomain = "jedisthlm";
    $referer = $_SERVER['HTTP_REFERER'];
    $domain = explode(".", $referer);

    if ($domain[1] == $mydomain) {
    echo "<!-- Found an referer, nothing shown -->";

    } else {

    echo "Show something";


Topic Closed

This topic has been closed to new replies.

About this Topic


No tags yet.