boardom Forum Index boardom
b2 message board
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

More about spam and AllComments

 
Post new topic   Reply to topic    boardom Forum Index -> Hacks
View previous topic :: View next topic  
Author Message
lynn



Joined: 04 Jul 2003
Posts: 66
Location: USA

PostPosted: Sat Jan 22, 2005 4:42 pm    Post subject: More about spam and AllComments Reply with quote

The search feature in AllComments has been a great help in getting rid of spam, however, lately I've been getting a lot of spam comments that have nothing but a common word or phrase in the comment itself, like "nice site" or just "hi" but the Name will be something like Diet Pills or Payday Loans or Cialis and of course the URL is a link to their site. Would it be possible to modify AllComments so that the search includes both the Name and URL as well as the comment itself, or alternatively, have checkboxes so you could mark the comments you want to delete without using the search?
Back to top
View user's profile Send private message Visit poster's website
stevem



Joined: 15 Mar 2003
Posts: 368

PostPosted: Sat Jan 22, 2005 6:29 pm    Post subject: Reply with quote

Oh I like requests like this because they are easy to fulfil Very Happy

In b2allcomments.php just replace 2 lines:
Replace
Code:
$query = "DELETE FROM $tablecomments WHERE comment_content NOT LIKE '%<trackback />%' AND comment_content LIKE '%$search%'";
by
Code:
$query = "DELETE FROM $tablecomments WHERE comment_content NOT LIKE '%<trackback />%' AND (comment_content LIKE '%$search%' OR comment_author_url LIKE '%$search%' OR comment_author LIKE '%$search%')";

and replace
Code:
$queryc = "SELECT * FROM $tablecomments WHERE comment_content NOT LIKE '%<trackback />%' AND comment_content LIKE '%$search%' ORDER BY comment_date DESC";
by
Code:
$queryc = "SELECT * FROM $tablecomments WHERE comment_content NOT LIKE '%<trackback />%' AND (comment_content LIKE '%$search%' OR comment_author_url LIKE '%$search%' OR comment_author LIKE '%$search%') ORDER BY comment_date DESC";
and then it should show (and delete) comments where the search word is in the comment, the name or the URL

I have made a quick check to see it works but I'm sure you'll test it more thoroughly Very Happy
Back to top
View user's profile Send private message
lynn



Joined: 04 Jul 2003
Posts: 66
Location: USA

PostPosted: Tue Jan 25, 2005 10:29 pm    Post subject: Reply with quote

The search works but not the delete. I have a bunch of comments that look like this...

Dental+Plans ( admin%40e%2Ddental%2Dplanss%2Ecom http://http%3A%2F%2Fwww%2Ee%2Ddental%2Dplans%2Ecom http://http%3A%2F%2Fwww%2Ee%2Ddental%2Dplans%2Ecom ) (IP: 66.36.242.135) Sun 23 Jan 2005 @ 12:57 pm [ Delete Comment ]
Comment was made in Stained Glass Art @ 9:00 pm

DNT+B2%21+%3Ca+href%3D%22http%3A%2F%2Fwww%2Ee%2Ddental%2Dplans%2Ecom%22%3EDental+Insurance%3C%2Fa%3E+http%3A%2F%2Fwww%2Ee%2Ddental%2Dplans%2Ecom

... and they come up when I search for Dental+Plans but I can't delete them. They disappear from the Search page but they don't really disappear.

UPDATE: and a search on a URL didn't work at all.

UPDATE #2: It does work with some comments. It's just those that have a + in the name and a long string of nonsense in the comment. By the way, before I posted my request here the other day I tried copying and pasting the long string of nonsense into the search box and it wouldn't delete them. The %$&*# spammers have apparently found some way to make their spam undeletable.
Back to top
View user's profile Send private message Visit poster's website
stevem



Joined: 15 Mar 2003
Posts: 368

PostPosted: Wed Jan 26, 2005 7:40 pm    Post subject: Reply with quote

I can see why things are happening - what is saved in the database is converted when shown in the browser so it's looking in the database for the wrong thing.

Does it help if you replace
comment_author_url LIKE '%urlencode($search)%'
by
comment_author_url LIKE '%urlencode($search)%'
in the 2 places where it occurs?

I haven't the time or energy to test it at the moment (it's a long story) so no guarantees Sad
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    boardom Forum Index -> Hacks All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB 2 © 2001, 2002 phpBB Group