May 07
30
How to filter incoming links
Share This
|
7% | Join the Discussion
One of my clients wanted a simple filter to alert visitors coming from specific websites that they (the other site/company) was in no way associated with my client and his/hers services/products. Without knowing the exact IP I had to rely on PHP’s HTTP_REFERER. This predefined variable can be somewhat unreliable as a hacker may insert a fake value or the browser doesn’t set it. However, for the average visitor and browser (user agent) it seams to work as intended.
In order to make it easy to maintain I created a small function including an array containing the blacklisted domains. To make it work you need to include it before the XHTML header on all the files you want protected.

Download Lightbox Media version 1.01
Weekly Stats Chart
Wordpress.org
