View previous topic :: View next topic |
Author |
Message |
mejum
Joined: 02 Jun 2002 Posts: 7
|
Posted: Mon Dec 20, 2004 9:05 pm Post subject: |
|
|
Yes, I tried running it in the SQL dialogue box. The same box used to add the table in step 1. |
|
Back to top |
|
 |
BDKR
Joined: 04 Jan 2003 Posts: 25 Location: Clearwater, Florida
|
Posted: Mon Dec 20, 2004 9:51 pm Post subject: |
|
|
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 |
|
 |
mejum
Joined: 02 Jun 2002 Posts: 7
|
Posted: Mon Dec 20, 2004 11:08 pm Post subject: |
|
|
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 |
|
 |
Cyberian75
Joined: 26 Sep 2002 Posts: 1263 Location: Oregon
|
Posted: Mon Dec 20, 2004 11:25 pm Post subject: |
|
|
Let's see the code of b2edit file then. _________________ Michael P.
 |
|
Back to top |
|
 |
mejum
Joined: 02 Jun 2002 Posts: 7
|
|
Back to top |
|
 |
BDKR
Joined: 04 Jan 2003 Posts: 25 Location: Clearwater, Florida
|
Posted: Tue Dec 21, 2004 12:41 am Post subject: |
|
|
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 |
|
 |
Cyberian75
Joined: 26 Sep 2002 Posts: 1263 Location: Oregon
|
Posted: Tue Dec 21, 2004 4:53 am Post subject: |
|
|
BDKR is correct.  _________________ Michael P.
 |
|
Back to top |
|
 |
mejum
Joined: 02 Jun 2002 Posts: 7
|
Posted: Tue Dec 21, 2004 6:29 am Post subject: |
|
|
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 |
|
 |
Cyberian75
Joined: 26 Sep 2002 Posts: 1263 Location: Oregon
|
Posted: Tue Dec 21, 2004 6:38 am Post subject: |
|
|
Do a word search with the limit field set to 1000. If you've 4000 SPAM comments, about 10 clicks will do.  _________________ Michael P.
 |
|
Back to top |
|
 |
mejum
Joined: 02 Jun 2002 Posts: 7
|
Posted: Tue Dec 21, 2004 7:20 am Post subject: |
|
|
word search = teh win!
...and it was 16 clicks :P |
|
Back to top |
|
 |
ReiXou
Joined: 06 Aug 2003 Posts: 8
|
Posted: Tue Dec 21, 2004 2:18 pm Post subject: |
|
|
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 |
|
 |
BDKR
Joined: 04 Jan 2003 Posts: 25 Location: Clearwater, Florida
|
Posted: Tue Dec 21, 2004 2:19 pm Post subject: |
|
|
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 |
|
 |
ReiXou
Joined: 06 Aug 2003 Posts: 8
|
Posted: Tue Dec 21, 2004 2:40 pm Post subject: |
|
|
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 |
|
 |
BDKR
Joined: 04 Jan 2003 Posts: 25 Location: Clearwater, Florida
|
Posted: Tue Dec 21, 2004 3:57 pm Post subject: |
|
|
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 |
|
 |
Cyberian75
Joined: 26 Sep 2002 Posts: 1263 Location: Oregon
|
Posted: Tue Dec 21, 2004 6:10 pm Post subject: |
|
|
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 |
|
 |
|