Please login or register.

Login with username, password and session length
Advanced search  

News:

You need/want an older version of sNews ? Download an older/unsupported version here.

Pages: 1 2 [3] 4 5

Author Topic: [MOD] Comment box anti spammers v.0.1 (sNews 1.4)  (Read 43154 times)

Patric Ahlqvist

  • Nobodys perfect, but Im pretty effing close
  • Administrator
  • ULTIMATE member
  • ******
  • Karma: 65
  • Posts: 4957
  • I'm a self-made man and worships my creator.
    • p-ahlqvist.com
[MOD] Comment box anti spammers v.0.1 (sNews 1.4)
« Reply #30 on: June 06, 2006, 09:57:57 AM »

Aaah, Bram, you're the man. Gonna have a look at it later. Thanks a bunch, companero ;)
Logged
My sNews site
"It's only dead fish that goes with the flow... "
Updated, online again - Free designs

fray_zack

  • Newbie
  • *
  • Karma: 0
  • Posts: 23
    • http://fray.host.sk
[MOD] Comment box anti spammers v.0.1 (sNews 1.4)
« Reply #31 on: July 06, 2006, 04:47:44 PM »

Hi! to all...
I'm new in sNews(great cms! Nice job!) It is my first post! and it is a long post (I'm sorry)

I'm trying to test your MOD but :/ I have no GD library on my server :(...

What about doing it without GD?
googling for an alternative I've discovered Text(THaCAA) "a way of telling if the submitter of a web form is human or a bot..."(as they say) and I've implemented it...

1. Download Text(THaCAA) from the link above..

2. unzip it in the inc folder

3. edit inc/textTHaCAA_options.php
find:
Code: [Select]
$textTHaCAA_datalocation='THaCAAdata';and replace it with:
Code: [Select]
$textTHaCAA_datalocation='inc/THaCAAdata';4. in snews.php (after modded with Comment box anti spammers v.0.1)
at top after
Code: [Select]
insert the lines:
Code: [Select]
include("inc/textTHaCAA_options.php");
include("inc/textTHaCAA.php");
5.find:
Code: [Select]




and replace with:
Code: [Select]



     


     


     


   textTHaCAA_ask();
}
6. now find your audit() function and replace it with:
Code: [Select]
function audit() {
  if (function_exists('gd_info')){
  $digit = $_SESSION['digit'];
 $userdigit = $_POST['userdigit'];
 session_destroy();

 if (($digit == $userdigit) && ($digit > 1)) {
   return true;
 } else {
   return false;
 }
  }else{
$answer=textTHaCAA_answer();
if (textTHaCAA_hasrun() and $answer==1) {
return true;
} else if (textTHaCAA_hasrun() and $answer==0) {
return false;
} else if (textTHaCAA_hasrun() and $answer==-1){
return false;
}
  }
}
so if your server support GD it give you an image else a funny quiz...

Hoping it is useful to someone...
Logged

Patric Ahlqvist

  • Nobodys perfect, but Im pretty effing close
  • Administrator
  • ULTIMATE member
  • ******
  • Karma: 65
  • Posts: 4957
  • I'm a self-made man and worships my creator.
    • p-ahlqvist.com
[MOD] Comment box anti spammers v.0.1 (sNews 1.4)
« Reply #32 on: July 06, 2006, 04:57:22 PM »

It sure might be as not all have GD on the server. Great find and post, Fray... And welcome to sNews forums. Nice to have you here... Hope you'll like it here and stay on.

How about posting a link to a working thingy on your GDless server ?

Patric.
Logged
My sNews site
"It's only dead fish that goes with the flow... "
Updated, online again - Free designs

Mika

  • Administrator
  • ULTIMATE member
  • ******
  • Karma: 9
  • Posts: 1408
    • http://www.ni5ni6.com/
[MOD] Comment box anti spammers v.0.1 (sNews 1.4)
« Reply #33 on: July 06, 2006, 05:00:15 PM »

welcome fray_zack and may your posts be as long as you wish ;)

i've seen it before and it's a nice addon..
Logged
http://www.ni5ni6.com/ - Tutorials, Mods and How-To's about sNews CMS
sNews 1.6 Developers Edition - commented sNews 1.6 version

brauck

  • sNews Dude
  • Hero Member
  • *****
  • Karma: 18
  • Posts: 572
    • http://www.hbw-webdesign.nl/
[MOD] Comment box anti spammers v.0.1 (sNews 1.4)
« Reply #34 on: July 06, 2006, 09:37:17 PM »

Hey fray_zack, welcome to our forum; this is a nice and usefull contribution
Logged
Confidence is reduced complexity.
brauck.nl for free css templates

Mika

  • Administrator
  • ULTIMATE member
  • ******
  • Karma: 9
  • Posts: 1408
    • http://www.ni5ni6.com/
[MOD] Comment box anti spammers v.0.1 (sNews 1.4)
« Reply #35 on: July 06, 2006, 11:27:08 PM »

i was wondering... gd library comes with php installation files... what version of php do you use, fray_zack?
Logged
http://www.ni5ni6.com/ - Tutorials, Mods and How-To's about sNews CMS
sNews 1.6 Developers Edition - commented sNews 1.6 version

fray_zack

  • Newbie
  • *
  • Karma: 0
  • Posts: 23
    • http://fray.host.sk
[MOD] Comment box anti spammers v.0.1 (sNews 1.4)
« Reply #36 on: July 07, 2006, 09:07:10 AM »

Quote from: mika
i was wondering... gd library comes with php installation files... what version of php do you use, fray_zack?
I'm using microweb demo  on extremely restricted windows with php.exe and php5ts.dll only (and snews-txtdb) just for testing... in order to transfer all the working pages on the web....

If it works in a such poor evironment it must work even in a true web server ;)
Logged

4Sandrix

  • Hero Member
  • *****
  • Karma: -13
  • Posts: 613
    • http://fedrick.deviantart.com
[MOD] Comment box anti spammers v.0.1 (sNews 1.4)
« Reply #37 on: July 07, 2006, 11:27:48 PM »

PROBLEM(OLD MOD WITH GD  LIB):

Code: [Select]

this is your code

and this is generated picture link(image doesn't show up):

Code: [Select]
http://blablabla/sanblog/43434/button.phpIt's taking whole path of website, how can I fix this?
Logged
I'm kind of like Han Solo always strokin' my own Wookiee
I'm the root of all that's evil yeah but you can call me Cookie

4Sandrix

  • Hero Member
  • *****
  • Karma: -13
  • Posts: 613
    • http://fedrick.deviantart.com
[MOD] Comment box anti spammers v.0.1 (sNews 1.4)
« Reply #38 on: July 07, 2006, 11:42:37 PM »

Nevermind I fixed it :)
Logged
I'm kind of like Han Solo always strokin' my own Wookiee
I'm the root of all that's evil yeah but you can call me Cookie

Jochum Meester

  • Sr. Member
  • ****
  • Karma: 1
  • Posts: 312
    • JochumMeester.com
[MOD] Comment box anti spammers v.0.1 (sNews 1.4)
« Reply #39 on: July 15, 2006, 02:23:01 PM »

This might be a useful addition to this mod:

Script in // CONTACT (only if you have a field for website:
Code: [Select]
if people don't have a website, this field will still not cause errors because value is http://

Language variables:
Code: [Select]
$l['ce_reasons'] = "Possible reasons: You left one of the fields blank, the comment is too short, or the validation code was not correct.";
$l['message_error'] = "Possible reasons: You left one of the fields blank, your email address does not exist, or the validation code was not correct.";
Not sure if there are any other lang variables which should be changed? I believe these two are the only ones.
Logged

Patrik

  • Jr. Member
  • **
  • Karma: 0
  • Posts: 89
    • http://pawe.se/
[MOD] Comment box anti spammers v.0.1 (sNews 1.4)
« Reply #40 on: August 07, 2006, 01:29:46 AM »

I installed this mod and it works great, almost.. :)

The comments (or whatever) does'nt get posted the first try. Never. But if you have tried one time and go back it get posted. Don't know if its me of what but i have tried to installed two times with the same result... :(

Its like the input field userdigit gets empty the first time no matter what. Any ideas what it could be? :)
Logged
Visit me: http://pawe.se/

dhn

  • Newbie
  • *
  • Karma: 0
  • Posts: 15
[MOD] Comment box anti spammers v.0.1 (sNews 1.4)
« Reply #41 on: September 11, 2006, 09:42:12 PM »

anyone tried this on the 1.5 RC yet ?
Logged

Patric Ahlqvist

  • Nobodys perfect, but Im pretty effing close
  • Administrator
  • ULTIMATE member
  • ******
  • Karma: 65
  • Posts: 4957
  • I'm a self-made man and worships my creator.
    • p-ahlqvist.com
[MOD] Comment box anti spammers v.0.1 (sNews 1.4)
« Reply #42 on: September 12, 2006, 07:54:05 AM »

Yes, and it's fecking impossible ;)... Hehe, but need I say that I can't code shit ;)..

On the other hand there is already SPAM protection in the code (I think), It shouldn't be needed to put this in... We'll let Luka answer this...
Logged
My sNews site
"It's only dead fish that goes with the flow... "
Updated, online again - Free designs

mininovax

  • Newbie
  • *
  • Karma: 1
  • Posts: 44
    • http://www.ondapc.net
[MOD] Comment box anti spammers v.0.1 (sNews 1.4)
« Reply #43 on: November 29, 2006, 03:53:17 PM »

Quote from: dhn
anyone tried this on the 1.5 RC yet ?
I have managed to make the above code work. Actually this script was written a while back. There are a couple of modifications

Also, in my experiece, php executes from the top down, so in your index page you should put this in the top

  session_start();
  include ("audit.php");
  include ("snews.php");
?>

The original post, had audit below snews.... but this is incorrect, because the function to audit() is in snews, so audit.php should be above snews.


for // COMMENTS

Find:
if ($_POST['ip'] == $_SERVER['REMOTE_ADDR'] && (time() - $_POST['time']) > 4 && strlen($comment) >= 5 && strlen($name) >= 2 && is_numeric($_POST['id'])) {

Replace:
if ($_POST['ip'] == $_SERVER['REMOTE_ADDR'] && (time() - $_POST['time']) > 4 && strlen($comment) >= 5 && audit() && strlen($name) >= 2 && is_numeric($_POST['id'])) {


HTML - DISPLAY

Find
         

Replace:
         
         
         


         


         


         


         




For // CONTACT FORM

Find:
if (strlen($name) > 2 && strlen($message) > 9 && strlen($mail) > 6  ) {

Replace with:
if (strlen($name) > 2 && strlen($message) > 9 && strlen($mail) > 6 && audit() ) {


HTML

FInd:
         



Replace
         


      
      


      


      


      


      
Logged

bakercad

  • Administrator
  • ULTIMATE member
  • ******
  • Karma: 105
  • Posts: 1670
    • http://exit20.com
[MOD] Comment box anti spammers v.0.1 (sNews 1.4)
« Reply #44 on: November 29, 2006, 04:59:18 PM »

Using V1.4, I've noticed that after the admin makes a comment it logs the admin out.  Maybe it's just me since I haven't seen anyone else post about it.  My assumption is that its because of the session_destroy() in the audit.php file.

So I modified the audit file to test if the admin is making a comment, if so, it adds the comment without loggin the admin out afterward.  It also makes it so that the admin does NOT have to enter a validation code, he/she can just leave it blank.

Here's the code (audit.php):
Quote
 function audit() {
 
 if ( !isset($_SESSION['Logged_In'])) {
  session_start();
  $digit = $_SESSION['digit'];
  $userdigit = $_POST['userdigit'];
  session_destroy();

  if (($digit == $userdigit) && ($digit > 1)) {
    return true;
  }
  else {
    return false;
  }
}
 
  else {
     return true;
  }  


}
?>
Logged
Pages: 1 2 [3] 4 5