01 Jun
Posted by admin as IndexScript Mods
The PHPld heat is still on, reason being that PHPld is the most popular directory script.
But, then again I can never overlook my fav directory script: IndexScript
So whenever I see someone come up with a IndexScript trick i am the happiest to give some linky love for their effort.
Here is a IndexScript mod coded by “TechPro” (http://www.tech-directory.net/)
Description in his words:
Hi folks! Here’s a simple mod that will check and reject submissions of spamvertized sites using the dynamically updated block lists at surbl.org and mailpolice.com. I’m new to this so I don’t know whether many people do try to list such sites in directories, and I’ll be interested to know if anyone tries it and sees a drop in the amount of spam.
Code:
On to the mod. First, create a file named check.php like below:
<?function get_domain($url) {
$pieces = explode(‘//’,$url);
if (count($pieces) == 1) $pieces = explode(‘@’,$url);
$domain = “”;
if (count($pieces) > 1) {
$pieces = explode(‘/’,$pieces[1]);
if (strlen($pieces[0]) > 4) {
$pieces = explode(‘.’,$pieces[0]);
$cnt = count($pieces)-1;
while ($cnt >=0 ) {
$part = $pieces[$cnt];
if ($domain) {
$domain = $part.‘.’.$domain;
} else {
$domain = $part;
}
if (strlen($part) > 3) break;
$cnt–;
}
return $domain;
}
}
}function spam_check($url)
{
if ($url) {
$domain = get_domain($url);
if ($domain) {
$test1 = $domain . “.multi.surbl.org”;
$test2 = $domain . “.block.rhs.mailpolice.com”;
$res = gethostbyname($test1) == $test1;
if ($res) $res = gethostbyname($test2) == $test2;
return $res;
}
}
}?>
Now, open sug_url.php in a text editor. Insert a line:
include_once ‘check.php’;
after the existing include line.
Look for the line:
if(mysql_affected_rows() > 0) {
a few lines after the comment “check if banned…”.
Comment that line out, so you can change it back easily, then replace it with:
if((mysql_affected_rows() > 0) || !spam_check($url)) {
To test it, try submitting an entry for one of the sites listed here.
~~~~
Thanks TechPro and hope to see more contribution coming from you. :-)
RSS feed for comments on this post · TrackBack URI
Leave a reply