Little Php code to disable seeing your own ads

Discussion in 'AdSense' started by Zedzero, Aug 17, 2005.

  1. #1
    Lots of webmasters are trying to disable seeing their own ads. There are two reasons:

    - they don't want to click their own ads by mistake.
    - they are paid for impressions rather than clicks.

    so, to ensure the safety of your account, it's best to disable them for yourself. It's really an easy task, but i see so much webmasters getting banned for clicking their own ads "by mistake", i thought this may be useful. Of course there are a lot of other ways like incorporating ads with your member system etc, but this is the easiest way.

    I use this little code to disable my ads for me:

    1. Open notepad, and type this code:

    setcookie("disableads", "yes", time()+3600000);

    2. save as disableads.php (in fact, anything is ok)

    3. open your main files, where your adsense code is located. edit it like this:

    if (!isset($_COOKIE['disableads']))
    {
    ?>
    - enter your adsense code here -
    <?
    }

    4. you're done. run disableads.php once, and you will never see your own ads for a long time. (delete cookies to re-enable them)
     
    Zedzero, Aug 17, 2005 IP
    SHT and blackpudding like this.
  2. UndiesHosting

    UndiesHosting Active Member

    Messages:
    219
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    78
    #2
    thats a good little trick
     
    UndiesHosting, Aug 17, 2005 IP
  3. SHT

    SHT Active Member

    Messages:
    266
    Likes Received:
    21
    Best Answers:
    0
    Trophy Points:
    73
    #3
    Nice trick that thanks, my IP is always the same so I use the same principle but with my IP.
     
    SHT, Aug 17, 2005 IP
  4. subhendu

    subhendu Peon

    Messages:
    124
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #4
    ummmm....i'm not habituated to tell ppl's scripts good. :D well, i'll chk it tomorrow. :D [pls don't take it by heart man...]
     
    subhendu, Aug 17, 2005 IP
  5. Zedzero

    Zedzero Peon

    Messages:
    322
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    0
    #5
    no problem.

    as i said; this is not the best way to do it, but the most foolproof way.
     
    Zedzero, Aug 17, 2005 IP
  6. samsam

    samsam Peon

    Messages:
    647
    Likes Received:
    53
    Best Answers:
    0
    Trophy Points:
    0
    #6
    nice little trick.
     
    samsam, Aug 17, 2005 IP
  7. gaits2heaven

    gaits2heaven Peon

    Messages:
    20
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #7
    no problem.
     
    gaits2heaven, Aug 17, 2005 IP
  8. subhendu

    subhendu Peon

    Messages:
    124
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #8
    "run disableads.php once,"

    do u mean to put this into cronjob every 24 hours?
     
    subhendu, Aug 17, 2005 IP
  9. fryman

    fryman Kiss my rep

    Messages:
    9,604
    Likes Received:
    777
    Best Answers:
    0
    Trophy Points:
    370
    #9
    No, just once would be enough
     
    fryman, Aug 17, 2005 IP
  10. exaro

    exaro Peon

    Messages:
    615
    Likes Received:
    39
    Best Answers:
    0
    Trophy Points:
    0
    #10
    That's a great idea for anyone with non-static IP's like myself.
     
    exaro, Aug 17, 2005 IP
  11. seckin

    seckin Peon

    Messages:
    108
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #11
    I'm always curious about which ads are displayed, because I generally can't get stable and relevant ads on my site(and keep wondering about the fastest running bird:). But the preview tool can still give me answers.

    Thank you for the code.
     
    seckin, Aug 17, 2005 IP
  12. Zedzero

    Zedzero Peon

    Messages:
    322
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    0
    #12
    no, i mean open this page in your browser for just one time. it should be ok for 3600000 seconds (or whatever you have set in the setcookie part).

    and be sure to hide this page from visitors lol
     
    Zedzero, Aug 17, 2005 IP