Websense for Web Developers

In this final segment about Websense, I’m going to show you how, as a web developer, you can prevent your site from being blocked. It all comes down to this PHP code which you can insert in the top of your web page:

<?php
if (ereg("208.80..*..*", getenv('REMOTE_ADDR')))
header("HTTP/1.1 403 Forbidden");
?>

In the first line, we compare the IP address of the person visiting with the block used by Websense. If it matches, the second line stops the page from loading and issues an error to the client. Websense doesn’t see what’s on your site, and consequently, has no grounds on which to block it.

As far as user agent strings go, Websense spoofes its bots to appear like regular web traffic. Blocking on a basis of IP is the only way to go.