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 

[Hack] Comments Blacklist
Goto page Previous  1, 2, 3, 4, 5, 6, 7, 8, 9  Next
 
Post new topic   Reply to topic    boardom Forum Index -> Hacks
View previous topic :: View next topic  
Author Message
mejum



Joined: 02 Jun 2002
Posts: 7

PostPosted: Mon Dec 20, 2004 9:05 pm    Post subject: Reply with quote

Yes, I tried running it in the SQL dialogue box. The same box used to add the table in step 1.
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
BDKR



Joined: 04 Jan 2003
Posts: 25
Location: Clearwater, Florida

PostPosted: Mon Dec 20, 2004 9:51 pm    Post subject: Reply with quote

mejum wrote:
I get the following error when trying to access b2edit.php:

Code:
Couldn't add : Duplicate entry '' for key 2




Is that ALL of the message. Anyway, there is obviously a duplicate entry just as the message states, which is a big NO NO in the relation DBMS world. That error message doesn't say what table and field?
Back to top
View user's profile Send private message Visit poster's website AIM Address MSN Messenger
mejum



Joined: 02 Jun 2002
Posts: 7

PostPosted: Mon Dec 20, 2004 11:08 pm    Post subject: Reply with quote

Code:
Couldn't add : Duplicate entry '' for key 2


...is what I get after logging into b2. I get this error message on the page b2edit.php
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Cyberian75



Joined: 26 Sep 2002
Posts: 1263
Location: Oregon

PostPosted: Mon Dec 20, 2004 11:25 pm    Post subject: Reply with quote

Let's see the code of b2edit file then.
_________________
Michael P.

Back to top
View user's profile Send private message AIM Address
mejum



Joined: 02 Jun 2002
Posts: 7

PostPosted: Mon Dec 20, 2004 11:36 pm    Post subject: Reply with quote

http://www.defyperception.net/jessie/b2edit.txt

I didn't want to paste it in here, it would have ate up a lot of screen.
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
BDKR



Joined: 04 Jan 2003
Posts: 25
Location: Clearwater, Florida

PostPosted: Tue Dec 21, 2004 12:41 am    Post subject: Reply with quote

I think the default case in the switch should be after the banip case. It appears to be hitting the default case, which is correct, then falling through to the banip case. It's actually trying to enter ' ' for an ip, This worked the first time, but the second time the database complained becuase the field holding that information is unique.

I changed them around.
http://highsidecafe.com/b2edit.txt

Hopefully that will fix it. Make sure you keep the original in case I'm wrong.

Cheers,
BDKR
Back to top
View user's profile Send private message Visit poster's website AIM Address MSN Messenger
Cyberian75



Joined: 26 Sep 2002
Posts: 1263
Location: Oregon

PostPosted: Tue Dec 21, 2004 4:53 am    Post subject: Reply with quote

BDKR is correct. Smile
_________________
Michael P.

Back to top
View user's profile Send private message AIM Address
mejum



Joined: 02 Jun 2002
Posts: 7

PostPosted: Tue Dec 21, 2004 6:29 am    Post subject: Reply with quote

Sorry for the delay, had some last minute gift shopping to do.

Thanks for the fix! I got the blacklisting to work. Unfortunately it wasn't until a few nights ago that I realized I was being spammed. There are over 4000 comments to erase so I've got some pointin' and clickin' to do tonight. There's not a way to ban and delete all by chance? ;)

Thanks again!
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Cyberian75



Joined: 26 Sep 2002
Posts: 1263
Location: Oregon

PostPosted: Tue Dec 21, 2004 6:38 am    Post subject: Reply with quote

Do a word search with the limit field set to 1000. If you've 4000 SPAM comments, about 10 clicks will do. Smile
_________________
Michael P.

Back to top
View user's profile Send private message AIM Address
mejum



Joined: 02 Jun 2002
Posts: 7

PostPosted: Tue Dec 21, 2004 7:20 am    Post subject: Reply with quote

word search = teh win!

...and it was 16 clicks :P
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
ReiXou



Joined: 06 Aug 2003
Posts: 8

PostPosted: Tue Dec 21, 2004 2:18 pm    Post subject: Reply with quote

Are you sure about that part of the code :
Code:
eregi("[^www]\.?[a-z0-9\-]+\.", $url, $matches);

$blquery = "SELECT ID FROM $tableblacklist WHERE IP='$user_ip'";
if (!empty($matches[0])) {
   $blquery .= " OR URL LIKE '%$matches[0]%'";
}
$blquery .= " ORDER BY ID DESC LIMIT 1";
$blquery = mysql_query($blquery);

if (mysql_num_rows($blquery)) {
   exit("You're banned from leaving comments on this blog! ('$matches[0]')");
}

I am new to php but my problem is that now every comment with an url starting with "www." or "http://www." is rejected (I already have some URL in my blacklist).

I just made a test, but for example is I enter "http://www.google.com" as URL, it is rejected (it seems that $matches[0] = "/www." in this case.
_________________
Olivier


Last edited by ReiXou on Tue Dec 21, 2004 2:30 pm; edited 1 time in total
Back to top
View user's profile Send private message Visit poster's website
BDKR



Joined: 04 Jan 2003
Posts: 25
Location: Clearwater, Florida

PostPosted: Tue Dec 21, 2004 2:19 pm    Post subject: Reply with quote

These may help.

DELETE FROM b2comments WHERE LOCATE('search term', comment_author) != 0;

DELETE FROM b2comments WHERE LOCATE('search term', comment_author_url) != 0;

Obviously you replace 'search term' with what it is you are trying to get rid of. In the second one, you place a URL.
Back to top
View user's profile Send private message Visit poster's website AIM Address MSN Messenger
ReiXou



Joined: 06 Aug 2003
Posts: 8

PostPosted: Tue Dec 21, 2004 2:40 pm    Post subject: Reply with quote

BDKR wrote:
These may help.


Yes this may help but I think the main source of my proble is that
Code:
eregi("[^www]\.?[a-z0-9\-]+\.", $url, $matches);
returns "/www." in $matches[0], no ?

Why is that ?
_________________
Olivier
Back to top
View user's profile Send private message Visit poster's website
BDKR



Joined: 04 Jan 2003
Posts: 25
Location: Clearwater, Florida

PostPosted: Tue Dec 21, 2004 3:57 pm    Post subject: Reply with quote

ReiXou wrote:
BDKR wrote:
These may help.


Yes this may help but I think the main source of my proble is that
Code:
eregi("[^www]\.?[a-z0-9\-]+\.", $url, $matches);
returns "/www." in $matches[0], no ?

Why is that ?


Actually, we are talking about handling two seperate issues. Before your quote, he was talking about how to get rid of 4000 strong spam comments. That's what my post is addressing.

Otherwise, I agree with you that there is a problem. But I really don't even know too much about where that bit of code is applied and I don't want to generate any extra confusion. I have my own way of dealing with these spam comments and the code hunk you included is not part of it.

Sorry.

BDKR
Back to top
View user's profile Send private message Visit poster's website AIM Address MSN Messenger
Cyberian75



Joined: 26 Sep 2002
Posts: 1263
Location: Oregon

PostPosted: Tue Dec 21, 2004 6:10 pm    Post subject: Reply with quote

ReiXou wrote:
I am new to php but my problem is that now every comment with an url starting with "www." or "http://www." is rejected (I already have some URL in my blacklist).

I just made a test, but for example is I enter "http://www.google.com" as URL, it is rejected (it seems that $matches[0] = "/www." in this case.


Actually, "http://www.google.com" should come out as ".google.com" which is used to compared with the URLs in the database. I just did my own testing, and it passed. In your case, you may have a term "google" in your database.
_________________
Michael P.

Back to top
View user's profile Send private message AIM Address
Display posts from previous:   
Post new topic   Reply to topic    boardom Forum Index -> Hacks All times are GMT + 1 Hour
Goto page Previous  1, 2, 3, 4, 5, 6, 7, 8, 9  Next
Page 8 of 9

 
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