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  Next
 
Post new topic   Reply to topic    boardom Forum Index -> Hacks
View previous topic :: View next topic  
Author Message
stevem



Joined: 15 Mar 2003
Posts: 262

PostPosted: Thu Oct 28, 2004 8:18 pm    Post subject: Reply with quote

I must say that I find JavaScript very pernickety so I tend to always use names as that usually works Smile . I'm not quite sure how you want to use this.form and formObj. Do you mean you want to use it in the blacklist function so it can work with different forms?
In b2blacklist.php if you use
Code:
onClick="return blacklist('deleteip',this.form)

and in b2header.php
Code:
function blacklist(action, formObj)
...
if (formObj.ID.selectedIndex != -1) {
var answer = confirm("You are about to permanently delete IP: " + formObj.ID.options[formObj.ID.selectedIndex].text + "\n\nClick OK to proceed.");
then this does work. Is that what you meant?
Back to top
View user's profile Send private message
Cyberian75



Joined: 26 Sep 2002
Posts: 1112
Location: Oregon

PostPosted: Thu Oct 28, 2004 10:32 pm    Post subject: Reply with quote

Yes but for other "actions" as well. I've tried to use "formObj" intead of "deleteform" to no avail. Can you confirm that?
_________________
Michael P.
Back to top
View user's profile Send private message Visit poster's website AIM Address
Cyberian75



Joined: 26 Sep 2002
Posts: 1112
Location: Oregon

PostPosted: Thu Oct 28, 2004 11:02 pm    Post subject: Reply with quote

Apparenly, "this.whatever" has to be the last, or the only, parameter passed to the function.

All is well now. Smile
_________________
Michael P.
Back to top
View user's profile Send private message Visit poster's website AIM Address
stevem



Joined: 15 Mar 2003
Posts: 262

PostPosted: Thu Oct 28, 2004 11:19 pm    Post subject: Reply with quote

I have finally tracked down the error. Instead of writing document.formObj you only need formObj. So document.formObj.elements.length becomes formObj.elements.length

That's why the deleteip section worked. I can only assume that this.form carries the hierarchy above it along with itself. If you document.write(formObj); you find it's an array; I haven't anaylsed it but I bet it has the hierarchy there.

I changed the code and managed to delete a comment so it works! I do prefer PHP to JavaScript any day!
Back to top
View user's profile Send private message
stevem



Joined: 15 Mar 2003
Posts: 262

PostPosted: Thu Oct 28, 2004 11:20 pm    Post subject: Reply with quote

Cyberian75 wrote:
Apparenly, "this.whatever" has to be the last, or the only, parameter passed to the function.

Just seen this after posting; I did use onClick=\"blacklist('checkbox',this.form)\" so this agrees with what you say - but it still needed document removing
Back to top
View user's profile Send private message
stevem



Joined: 15 Mar 2003
Posts: 262

PostPosted: Thu Oct 28, 2004 11:28 pm    Post subject: Reply with quote

I tried using
onClick=\"blacklist(this.form, 'checkbox')\"
along with
function blacklist(formObj, action)
and it was fine so it seems they can be in any order
Back to top
View user's profile Send private message
Cyberian75



Joined: 26 Sep 2002
Posts: 1112
Location: Oregon

PostPosted: Fri Oct 29, 2004 12:16 am    Post subject: Reply with quote

I tried it before, though. Oh well, at least it's working now. Thanks for helping me out, Steve! Smile
_________________
Michael P.
Back to top
View user's profile Send private message Visit poster's website AIM Address
Sigg3



Joined: 03 Jul 2003
Posts: 657
Location: Oslo, Norway

PostPosted: Fri Oct 29, 2004 8:12 am    Post subject: Reply with quote

Installed the script last night. It works like a charm:)
Great instruction-template as well!

I'm recommending you for the Noble Peace Prize!
Why? Because the less I'm bothered with spam, the less is the chances of me killing a spammer. My official policy: Kill all spammers
... So, I can't get the prize myself.
_________________
Sigg3 dot net - because you're worth it! | b2 Cafelog Resource Center | Get Firefox NOW!
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Cyberian75



Joined: 26 Sep 2002
Posts: 1112
Location: Oregon

PostPosted: Fri Oct 29, 2004 7:11 pm    Post subject: Reply with quote

Smile
_________________
Michael P.
Back to top
View user's profile Send private message Visit poster's website AIM Address
Tang-on



Joined: 14 Aug 2003
Posts: 23

PostPosted: Tue Nov 02, 2004 3:47 am    Post subject: Reply with quote

Thanks a lot once again Mich! It works perfectly! Great instruction, as always.
_________________
-Tang-on Smile
Back to top
View user's profile Send private message Visit poster's website
Sigg3



Joined: 03 Jul 2003
Posts: 657
Location: Oslo, Norway

PostPosted: Tue Nov 02, 2004 10:37 am    Post subject: Reply with quote

I'm including it in a b2 ANTI-SPAM container (zip), along with a few other hacks/mods and tips that I regard vital to survive spam-attacks.
Hope you don't mind. All credit to where it's due.

I've been hit again, so the server might not be up today, but check in tomorrow.
_________________
Sigg3 dot net - because you're worth it! | b2 Cafelog Resource Center | Get Firefox NOW!
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
turtelina



Joined: 25 Jan 2002
Posts: 40
Location: Austria

PostPosted: Tue Nov 09, 2004 6:39 pm    Post subject: Reply with quote

Quote:
I'm recommending you for the Noble Peace Prize!


Yes!!!!!!!!!!!!!!!!!!!! Cool

I installed it too, no problems, and it works perfect!

Thank you again Michael for your time you put in here. Now that so many have wondered off to Wordpress, I appreciat it even more!

Thank you thank you thank you!

Juts wanted to add that I am ALMOST having fun deleating spam now, I searched one !P and found 97 comments under it, that would have taken a lot of time to deleate one by one.
Back to top
View user's profile Send private message Visit poster's website
turtelina



Joined: 25 Jan 2002
Posts: 40
Location: Austria

PostPosted: Thu Nov 11, 2004 2:11 pm    Post subject: Reply with quote

Hi Michael,

Is this a possible bug? When I add an IP, and then search, I always get this error, no matter which IP I am trying now:

Code:
Couldn't add 80.58.1.170: Duplicate entry '127' for key 1


But it really, it isnt a duplicate entry.

Also, when I go to the spam comment in the b2edit screen and click on Ban & Delete, it brings me back to the entry itself, and when I check, the comment isnt deleated, and hasnt been banned. (that is really no problem, just wanted to report it)

For the record, I am not getting more than 5 spams a day since implementing your hacks. That is an improvement by 700% at least! Very HappyVery HappyVery Happy
Back to top
View user's profile Send private message Visit poster's website
Cyberian75



Joined: 26 Sep 2002
Posts: 1112
Location: Oregon

PostPosted: Thu Nov 11, 2004 5:46 pm    Post subject: Reply with quote

You can't get that error when you do a search. Are you sure? If you are, try dropping the "b2blacklist" table and recreating it.
_________________
Michael P.
Back to top
View user's profile Send private message Visit poster's website AIM Address
Cyberian75



Joined: 26 Sep 2002
Posts: 1112
Location: Oregon

PostPosted: Fri Nov 12, 2004 8:37 pm    Post subject: Reply with quote

If you want to ban those blacklisted IPs from viewing your blog, put the following in the "blog.header.php" file:

Code:
/* blacklist */
$blquery = mysql_query("SELECT ID FROM $tableblacklist WHERE IP='$REMOTE_ADDR' ORDER BY ID DESC LIMIT 1");
$blresult = mysql_num_rows($blquery);
if ($blresult) {
   mysql_close($connexion);
   exit("You're banned from this site!");
}


right after
Code:
dbconnect()

_________________
Michael P.
Back to top
View user's profile Send private message Visit poster's website 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  Next
Page 3 of 4

 
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