WordPress.org

Ready to get started?Download WordPress

Forums

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

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

  2. Kafkaesqui

    Posted 9 years ago #

    It goes something like this:

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

    ~Your description content goes here~

    <?php } ?>

  3. Jens Wedin
    Member
    Posted 9 years ago #

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

  4. Jens Wedin
    Member
    Posted 9 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";

    }
    ?>

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.