Need Adsense code help here

Discussion in 'AdSense' started by t0ny, Apr 4, 2007.

  1. #1
    I am currently running vbulletin.com with Google adsense, but I would like to prevent certain websites from viewing my Google Adsense ads when my entire website is viewed on their domain.

    Some cheesehead decided to submit my site to a few traffic exchanges thinking I need their pathetic traffic without realizing that this is putting my Google Adsense account in jeapordy.

    I have removed the Google Adsense ads from my site and notified Google as well.

    But is there a special code to wrap around the Google Ads to prevent them from being displayed on this domain:

    http://www.a1mails.co.uk/

    Any help is appreciated.
     
    t0ny, Apr 4, 2007 IP
  2. Rub3X

    Rub3X Well-Known Member

    Messages:
    1,902
    Likes Received:
    75
    Best Answers:
    0
    Trophy Points:
    135
    #2
    $domain = 'domainyouwantblocked.com';

    
    If(str_replace('www.', '', $_SERVER['server_name']) == $domain)
    {
    	die();
    }
    
    Code (markup):
    Something like that. That will cut off traffic to that domain completely. You can also do...

    
    function display_adsense()
    {
    	If(str_replace('www.', '', $_SERVER['server_name']) == $domain)
    	{
    		return FALSE;
    	}
    	else
    	{
    		return TRUE;
    	}
    }
    
    Code (markup):
    And then do

    
    if(display_adsense())
    	echo "adsense code";
    }
    
    Code (markup):
     
    Rub3X, Apr 4, 2007 IP
  3. t0ny

    t0ny Banned

    Messages:
    57
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Ahh yah..thanks.


    This is good enough to get started. I will pass this code to a few die-hard coders in vb.org and vbhackers.com to get it straightened out.


    Thank you.

    You are a true savior!
     
    t0ny, Apr 4, 2007 IP
  4. Rub3X

    Rub3X Well-Known Member

    Messages:
    1,902
    Likes Received:
    75
    Best Answers:
    0
    Trophy Points:
    135
    #4
    I edited the post after you replied, it might help a bit more now.
     
    Rub3X, Apr 4, 2007 IP
  5. t0ny

    t0ny Banned

    Messages:
    57
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Oh ok, thank you.
     
    t0ny, Apr 4, 2007 IP
  6. t0ny

    t0ny Banned

    Messages:
    57
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Hey, these codes do work, right?
     
    t0ny, Apr 4, 2007 IP
  7. Rub3X

    Rub3X Well-Known Member

    Messages:
    1,902
    Likes Received:
    75
    Best Answers:
    0
    Trophy Points:
    135
    #7
    Untested but they should.
     
    Rub3X, Apr 4, 2007 IP
  8. t0ny

    t0ny Banned

    Messages:
    57
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #8
    hmm..ok.thanks.
     
    t0ny, Apr 4, 2007 IP