1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Using PHP to decide on a Message

Discussion in 'PHP' started by schlottke, Feb 7, 2005.

  1. #1
    I'd like to know how to greet a visitor based on their referral, say for instance they visit from google- Id like a message saying, "Greetings google visitor" etc... can you point me in the direction?
     
    schlottke, Feb 7, 2005 IP
  2. david_sakh

    david_sakh Peon

    Messages:
    1,225
    Likes Received:
    29
    Best Answers:
    0
    Trophy Points:
    0
    #2
    $_SESSION['refURL'] = $_SERVER['HTTP_REFERER'];

    does that work for you?
     
    david_sakh, Feb 7, 2005 IP
  3. SpeedyDomainRegistration

    SpeedyDomainRegistration Peon

    Messages:
    170
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Very easy to do.
    Just test the referal field against google.com

    You can use $_SERVER['HTTP_REFERER'] variables.

    Something like this should work. May need tweaking to your preference.

    <?php
    if(substr_count($_SERVER['HTTP_REFERER'],"google")) {
    echo "Hello Google visitor";
    } else {
    echo "Hello";
    }
    ?>
     
  4. schlottke

    schlottke Peon

    Messages:
    2,185
    Likes Received:
    63
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Thanks guys - got me on the right track
     
    schlottke, Feb 7, 2005 IP