SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Addict
    Join Date
    Dec 2005
    Posts
    381
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question $_Server HTTP_REFFERER Query

    Hi

    I'm looking to do the following:
    If a user has came from google I want to display a different msg to the one shown on my site if they have came from anywhere else or if they have actually typed the url in.

    I know I need to do soemthing similar to the following:

    Code:
    <?php if($_SERVER['HTTP_REFERER']!="http://www.google.co.uk"){
        echo this;
    } ?>
    All the refering url's from google will be different depending on what the user searched for in google so how would I go about checking to see if just the word google was conatined in the reffering url and not a specific url?

    As always any help much appreciated.

  2. #2
    Follow Me On Twitter: @djg gold trophysilver trophybronze trophy Dan Grossman's Avatar
    Join Date
    Aug 2000
    Location
    Philadephia, PA
    Posts
    20,580
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    http://php.net/manual/en/function.strpos.php

    PHP Code:
    if (strpos($_SERVER['HTTP_REFERER'], 'google') !== false) {
      echo 
    "Google specific text";


  3. #3
    SitePoint Addict
    Join Date
    Dec 2005
    Posts
    381
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Excellent. Thanks very much!


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •