1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Google redirect

Discussion in 'PHP & Perl' started by akwin4565, Apr 26, 2014.

Thread Status:
Not open for further replies.
  1. akwin4565

    akwin4565 Junior Member

    Joined:
    Dec 1, 2013
    Messages:
    135
    Likes Received:
    7
    Location:
    in front of bhw
    ---- THREAD CLOSED 06/17/2014 ----
    I have site 1 and site 2 .
    I have iframed site 1 with a file.
    and site 2 contains the site 1 iframe.
    I need a code that can only show the iframe to the users from google search.
     
  2. Gogol

    Gogol Elite Member

    Joined:
    Sep 10, 2010
    Messages:
    3,066
    Likes Received:
    2,872
    Gender:
    Male
    Code:
    if (strstr($_SERVER['HTTP_REFERER'], 'google') !== false ) {
        // Google brought me to this page.
    }
    
     
    • Thanks Thanks x 1
  3. akwin4565

    akwin4565 Junior Member

    Joined:
    Dec 1, 2013
    Messages:
    135
    Likes Received:
    7
    Location:
    in front of bhw
    where to place the iframe?
     
  4. Gogol

    Gogol Elite Member

    Joined:
    Sep 10, 2010
    Messages:
    3,066
    Likes Received:
    2,872
    Gender:
    Male
    Not sure what your html structure is but you could put the iframe like this:

    Code:
    
    if (strstr($_SERVER['HTTP_REFERER'], 'google') !== false ) {
        ?>
    MY IFRAME CODE
    <?php
    }
    
     
  5. x00bin

    x00bin Newbie

    Joined:
    Mar 20, 2014
    Messages:
    19
    Likes Received:
    1
    Occupation:
    Independent Contractor
    Location:
    World Wide Web
    Home Page:
    Code:
    <!DOCTYPE html>
    <html>
      <head>
      </head>
      <body>
        ...
        <?php if (strstr($_SERVER['HTTP_REFERER'], 'google') !== false ) { ?>
        <iframe src=""></iframe>
        <?php } ?>
        ...
      </body>
    </html>
    
    :)
     
  6. akwin4565

    akwin4565 Junior Member

    Joined:
    Dec 1, 2013
    Messages:
    135
    Likes Received:
    7
    Location:
    in front of bhw
    I am using php could you give for php
     
  7. anish2810

    anish2810 Newbie

    Joined:
    Apr 15, 2013
    Messages:
    4
    Likes Received:
    0
    Hi,

    Can this code be used in blogger, I don't have adsense associated with my blog, so I can try this code. Also, in blogger where to place this code?
     
  8. Gogol

    Gogol Elite Member

    Joined:
    Sep 10, 2010
    Messages:
    3,066
    Likes Received:
    2,872
    Gender:
    Male
    Check the answer by x00bin. Should work perfectly.
     
  9. bpcl2

    bpcl2 Newbie

    Joined:
    Feb 7, 2013
    Messages:
    19
    Likes Received:
    1
    Are you sure google is okay with that?
     
  10. Gogol

    Gogol Elite Member

    Joined:
    Sep 10, 2010
    Messages:
    3,066
    Likes Received:
    2,872
    Gender:
    Male
    Better make sure the mods are okay with your spam :p
     
Thread Status:
Not open for further replies.