View previous topic :: View next topic |
Author |
Message |
stevem
Joined: 15 Mar 2003 Posts: 262
|
Posted: Thu Oct 28, 2004 8:18 pm Post subject: |
|
|
I must say that I find JavaScript very pernickety so I tend to always use names as that usually works . 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 |
|
 |
Cyberian75
Joined: 26 Sep 2002 Posts: 1112 Location: Oregon
|
Posted: Thu Oct 28, 2004 10:32 pm Post subject: |
|
|
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 |
|
 |
Cyberian75
Joined: 26 Sep 2002 Posts: 1112 Location: Oregon
|
Posted: Thu Oct 28, 2004 11:02 pm Post subject: |
|
|
Apparenly, "this.whatever" has to be the last, or the only, parameter passed to the function.
All is well now.  _________________ Michael P. |
|
Back to top |
|
 |
stevem
Joined: 15 Mar 2003 Posts: 262
|
Posted: Thu Oct 28, 2004 11:19 pm Post subject: |
|
|
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 |
|
 |
stevem
Joined: 15 Mar 2003 Posts: 262
|
Posted: Thu Oct 28, 2004 11:20 pm Post subject: |
|
|
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 |
|
 |
stevem
Joined: 15 Mar 2003 Posts: 262
|
Posted: Thu Oct 28, 2004 11:28 pm Post subject: |
|
|
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 |
|
 |
Cyberian75
Joined: 26 Sep 2002 Posts: 1112 Location: Oregon
|
Posted: Fri Oct 29, 2004 12:16 am Post subject: |
|
|
I tried it before, though. Oh well, at least it's working now. Thanks for helping me out, Steve!  _________________ Michael P. |
|
Back to top |
|
 |
Sigg3
Joined: 03 Jul 2003 Posts: 657 Location: Oslo, Norway
|
|
Back to top |
|
 |
Cyberian75
Joined: 26 Sep 2002 Posts: 1112 Location: Oregon
|
Posted: Fri Oct 29, 2004 7:11 pm Post subject: |
|
|
 _________________ Michael P. |
|
Back to top |
|
 |
Tang-on
Joined: 14 Aug 2003 Posts: 23
|
Posted: Tue Nov 02, 2004 3:47 am Post subject: |
|
|
Thanks a lot once again Mich! It works perfectly! Great instruction, as always. _________________ -Tang-on  |
|
Back to top |
|
 |
Sigg3
Joined: 03 Jul 2003 Posts: 657 Location: Oslo, Norway
|
Posted: Tue Nov 02, 2004 10:37 am Post subject: |
|
|
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 |
|
 |
turtelina
Joined: 25 Jan 2002 Posts: 40 Location: Austria
|
Posted: Tue Nov 09, 2004 6:39 pm Post subject: |
|
|
Quote: | I'm recommending you for the Noble Peace Prize! |
Yes!!!!!!!!!!!!!!!!!!!!
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 |
|
 |
turtelina
Joined: 25 Jan 2002 Posts: 40 Location: Austria
|
Posted: Thu Nov 11, 2004 2:11 pm Post subject: |
|
|
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!    |
|
Back to top |
|
 |
Cyberian75
Joined: 26 Sep 2002 Posts: 1112 Location: Oregon
|
Posted: Thu Nov 11, 2004 5:46 pm Post subject: |
|
|
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 |
|
 |
Cyberian75
Joined: 26 Sep 2002 Posts: 1112 Location: Oregon
|
Posted: Fri Nov 12, 2004 8:37 pm Post subject: |
|
|
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
_________________ Michael P. |
|
Back to top |
|
 |
|