Earlier today I was venting out my frustration with spam link submissions on my web directory (yes the one where I learnt that .htaccess does work on Pubdomains (GoDaddy Reseller) Servers.
Initially I thought I would delete spam entries using phpmyadmin - Rather easy to run a SQL query like
DELETE FROM TABLE WHERE STATUS= X
Soon though I realized that solution is going to be a pain, because bots would not stop coming and inserting these links, so I had to do something better.
So, as a preliminary step - All IP Range that offending bot / person came from was blocked in .htaccess. Despite change in IP address, the first two were always 192.8.x.x so .htaccess is going to redirect all requests from 192.8.x.x to my reseller business site (I hope to see a surge in traffic on it in days to come, thank you spammers for gifting traffic)
Second is a solution that would allow me to delete all links that have been submitted by the offending IP address (ie. if they change the range / IP address) and still manage to submit.
To achieve this I modified 2 files
1. PHP File stored in root/admin/ named dir_links_edit.php &
2. Template File stored in root/ templates/admin named dir_approve_links.php
DIR_LINKS_EDIT.PHP (Add following Code to your file)// Search for case ‘E’ : and append this code at suitable place
case ‘REMOVEALL’ :
$data = $db->GetOne(”SELECT IPADDRESS FROM `{$tables['link']['name']}` WHERE STATUS = ‘1′ AND `ID` = “.$db->qstr($id));
//echo $data; // Used for debug to check if I get the right IP to remove
if ($db->Execute(”DELETE FROM `{$tables['link']['name']}` WHERE STATUS=’1′ AND `IPADDRESS` = ‘”.$data.”‘”))
{
//echo “Deleting ALL Records from IP Address “.$data;
send_status_notifications($data, false);
if (isset ($_SESSION['return']))
{
@ header(’Location: ‘.$_SESSION['return']);
@ exit ();
}
}
else
{
$tpl->assign(’sql_error’, $db->ErrorMsg());
}
break;
DIR_APPROVE_LINKS.PHP : Insert following TD after original 3 TD to approve / edit and delete links
<td align=”center”><a href=”dir_links_edit.php?action=REMOVEALL:{$id}” onclick=”return link_rm_confirm(’{l}Are you sure you want to remove All links from this IP?{/l}\n{l}Note: links can not be restored after removal!{/l}’);” title=”{l}Remove ALL Links{/l}: {$row.TITLE|escape|trim}”><img src=”images/a_delete.gif” width=”16″ height=”13″ border=”0″ alt=”RemoveALL” /></a></td>
That is not all, please increase span to accomodate 4th Action Button you have created, this can be achieved by modifying colspan and incrementing it by 1 at all places as shown below
<td class=”listHeader” colspan=”4“>{l}Action{/l}</td> [Original is set to 3]
AND
<tr>
<td colspan=”10” class=”norec”>{l}No records found.{/l}</td> [Original is set to 9]
</tr>
{/foreach}
<tr>
<td colspan=”10” class=”norec”>{include file=”admin/list_pager.tpl”}</td> [Original is set to 9]
</tr>
</table>
How does it work –
Query 1 gets IP address of first spam link, and second query deletes all links with status that of pending effectively deleting all submissions from offending IP address.
So using this mod, I was able to delete 118 SPAM links by only 3 clicks
fairly easy and I no longer have to dive into phpmyadmin in future. Come on spammers — try something else now
Cheers,
Pubdomains.com — Domain Registrar, Quality Web Hosting, Free Web Directory Service and Secure Certificates
If you are php noob or just didn’t get the point, need help, have a suggestion or feedback - feel free to express your views. I can provide you files for your link directory if you need my help !!! Do drop a note here
Filed under: link directory, phpld, phplinkdirectory | Tagged: arrest spam, link directory, mod, phpLD, spam
[...] PHPLD Mod Delete Spam Links dns, Domain Name sales, domain-name, domaining, domainregistration, flush-dns, free-webhosting, godaddy, greetings-2008, internet, internet-news, link-directory, linux, microsoft, phpld, registerdomain, technology, web-hosting, webhosting, yahoo [...]
[...] Credit:PHPLD Mod Delete Spam Links [...]