Hi. I’ve been using a simple script that logs referrers from my visitors, but unfortunately in the last few weeks its been bombarded by fake urls from mostly Russian origin. The script already has a blacklist option so I added the ‘.ru’ to block all Russian domains but sadly urls ending in “.ru/” still get through. I’m not php savvy and would be tremendously grateful if somebody could show me how to add a wildcard feature to the blacklist so I can add things like “.ru”. Thanks and here’s the script:
[php]<?php $file = “refers.txt”; $blacklist = array( ‘.ru’’);
$referrer = $_SERVER[‘HTTP_REFERER’];
$url = ($referrer) ? parse_url($referrer) : false; $refer_text = “{$referrer}”;
if (isset($url[‘host’]) && !in_array($url[‘host’], $blacklist))
{
file_put_contents($file, “{$refer_text}\n”, FILE_APPEND);
} ?>[/php]