Prevent Clicking your AdSense by Accident

6. February 2009

Here is a simple ASP Code Snippet that Hides your AdSense by blocking or filtering your IP.

This part you would want at the top of a page:
<%
dim blockip
 
blockip = Request.ServerVariables("REMOTE_HOST")
%>

The following you place wherever your Ads would be:

A Single IP# Version:


<%
 if blockip <> "000.000.000.000" then%>

    <div align="center">
“Your AdSense Code here.” Note: Replace the 000.000.000.000 and 111.111.111.111 with the IP# you wish to block.
    </div>
<%   
   else
   "Show Something Else."
   end if   
%>

 

A Two IP # Version:

<%
 if blockip <> "000.000.000.000" then
    if blockip <> "111.111.111.111" then %>
    
“Your AdSense Code here.” Note: Replace the 000.000.000.000 and 111.111.111.111 with the IP# you wish to block.
  
<%   
   else
      "Show Something at work."
   end if   
 else
     "Show Something at home."
 end if
%>

Tags:

Reference , ,

Comments

Comments are closed