sNews Forum

Previous sNews versions => sNews 1.4 Final => Mods and Addons => Topic started by: bramsyuur on May 05, 2006, 09:32:35 pm

Title: [MOD] Comment box anti spammers v.0.1 (sNews 1.4)
Post by: bramsyuur on May 05, 2006, 09:32:35 pm
[MOD] Comments and Contact box anti spammers v.0.3 for sNews v1.4
LAST UPDATE: Thuesday, 6, Jun.
UPDATED: Now, the code validates! :D
THIS MOD IF FOR PROTECT COMMENTS AND CONTACT BOX

I've read some problems about spamm into comments and, for now, until Luka make a
better solution about this, and he will integrate into sNews, I've created this mod for the moment.
With it, I'm very sure that your comments box don't be spammed again.

********** MAKE A BACKUP!!! *************
      This module requires GD library

First of all, create this two scripts in the same folder of sNews are:

1st- Named it as :button.php
Code: [Select]
<?php

$image 
imagecreate(12030);

$white    imagecolorallocate($image0xFF0xFF0xFF);
$gray    imagecolorallocate($image0xC00xC00xC0);
$darkgray imagecolorallocate($image0x500x500x50);

srand((double)microtime()*1000000);

for (
$i 0$i 30$i++) {
  
$x1 rand(0,120);
  
$y1 rand(0,30);
  
$x2 rand(0,120);
  
$y2 rand(0,30);
  
imageline($image$x1$y1$x2$y2 $gray);
}

for (
$i 0$i 5$i++) {
$cnum[$i] = rand(0,9);
}


for (
$i 0$i 5$i++) {
 
$fnt rand(3,5);
 
$x $x rand(12 20);
 
$y rand(12);
 
imagestring($image$fnt$x$y$cnum[$i] , $darkgray);
}

$digit "$cnum[0]$cnum[1]$cnum[2]$cnum[3]$cnum[4]";

session_start();
$_SESSION['digit'] = $digit;

header('Content-type: image/png');
imagepng($image);
imagedestroy($image);

?>
2on- Named it as :audit.php
Code: [Select]
<?php
 
function audit() {
  
session_start();
  
$digit $_SESSION['digit'];
  
$userdigit $_POST['userdigit'];
  
session_destroy();

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

}
?>
The next step... 
In the snews.php, locate this line under //COMMENTS:
Code: [Select]
if (isset($_POST['comment']) AND strlen($_POST['name']) > 2 AND strlen($_POST['comment']) > 5) {And change it to this:
Code: [Select]
if (isset($_POST['comment']) AND audit() AND strlen($_POST['name']) > 2 AND strlen($_POST['comment']) > 5) {Next...
Locate this line, under //COMMENTS too:
Code: [Select]
<p><input name="name" type="text" class="field" id="name" /></p>And, after this line, add this:
Code: [Select]
<!-- Mod commets validation by bramsyuur -->
<p><? echo l('code_validation'); ?></p>
<p><img width="120" height="30" src="button.php" alt="" /></p>
<p><? echo l('enter_validation_code'); ?></p>
<p><input maxlength="5" size="5" name="userdigit" type="text" class="field" value="" /></p>
<!-- End comments validation by bramsyuur-->
Next...
Add two Language variables, for a betther localization:
Code: [Select]
$l['code_validation'] = "Validation code:";
$l['enter_validation_code'] = "Enter validation code:";
Next...
Edit your index.php and add: include ("audit.php"); like this:
Code: [Select]
<?php
  session_start
();
  include (
"snews.php");
  include (
"audit.php");
?>
EDITED:
Next... for add this feature, too, into contact form,
Locate into //CONTACT function, this line:
Code: [Select]
<p><textarea name="message" rows="4" cols="5" class="text"></textarea></p>After this line, add these code:
Code: [Select]
<!-- Mod commets validation by bramsyuur -->
<p><? echo l('code_validation'); ?></p>
<p><img width="120" height="30" src="button.php" alt="" /></p>
<p><? echo l('enter_validation_code'); ?></p>
<p><input maxlength="5" size="5" name="userdigit" type="text" class="field" value="" /></p>
<!-- End comments validation by bramsyuur-->
And, locate this line, under //CONTACT function, too:
Code: [Select]
if (strlen(clean($_POST['name'])) > 1 AND strlen(clean($_POST['message'])) > 1) {And add audit() like this:
Code: [Select]
if (strlen(clean($_POST['name'])) > 1 AND strlen(clean($_POST['message'])) > 1 AND audit()) {And this is all!!! :D

This is a working screenshot for comments:
(http://www.vietbee.net/validator.png)
This is a working screenshot for contact form:
(http://www.vietbee.net/contact_form.png)

This mod is based on the code from Script Auditor v.1.0
You can found this original code here > http://php.webmaster-kit.com/ (http://php.webmaster-kit.com/)

Thanks to all! ;)
bramsyuur.
Title: [MOD] Comment box anti spammers v.0.1 (sNews 1.4)
Post by: Luka on May 05, 2006, 09:40:11 pm
Nice job bram :)
Title: [MOD] Comment box anti spammers v.0.1 (sNews 1.4)
Post by: bramsyuur on May 05, 2006, 09:42:12 pm
Thanks Luka! :)
I hope this helps, for the moment...
bram.
Title: [MOD] Comment box anti spammers v.0.1 (sNews 1.4)
Post by: George Antoniadis on May 06, 2006, 08:45:52 am
niceeeeeeeeeeeeeeeeee! ^_^
Title: [MOD] Comment box anti spammers v.0.1 (sNews 1.4)
Post by: Patric Ahlqvist on May 06, 2006, 10:28:07 am
God, Bram... If Barca don't deserve to win now, whane you did this, I don't know when ;)...

Good job. Now it's only the mailform left, hehe...
Title: [MOD] Comment box anti spammers v.0.1 (sNews 1.4)
Post by: brauck on May 06, 2006, 10:32:10 am
Great Bram, works like a charm!! Thanks
Title: [MOD] Comment box anti spammers v.0.1 (sNews 1.4)
Post by: bramsyuur on May 06, 2006, 01:00:52 pm
I've added protection into CONTACT form, too, with my MOD. See my first post.
Thanks! ;)
bram.
Title: [MOD] Comment box anti spammers v.0.1 (sNews 1.4)
Post by: Patric Ahlqvist on May 06, 2006, 01:14:05 pm
Delicious.
Title: [MOD] Comment box anti spammers v.0.1 (sNews 1.4)
Post by: brauck on May 06, 2006, 02:02:17 pm
Thanks again Bram
Title: [MOD] Comment box anti spammers v.0.1 (sNews 1.4)
Post by: David on May 06, 2006, 02:05:42 pm
Really useful this mod ! Thanks Bram!
Title: [MOD] Comment box anti spammers v.0.1 (sNews 1.4)
Post by: Phil on May 06, 2006, 09:35:39 pm
Very nice Bram, thanks!
Title: [MOD] Comment box anti spammers v.0.1 (sNews 1.4)
Post by: Rod on May 07, 2006, 03:57:08 am
Very nice Bram, only my typo was the issue when trying, hehe, ;)

will be really useful on a few upcoming projects that I am working on.
Title: [MOD] Comment box anti spammers v.0.1 (sNews 1.4)
Post by: bryn on May 07, 2006, 09:51:35 am
thanks very much Bram..this is a really useful Mod and until a better solution is found permanently then this is going to be so handy for so many..

great work again :)
Title: [MOD] Comment box anti spammers v.0.1 (sNews 1.4)
Post by: Patric Ahlqvist on May 07, 2006, 08:08:25 pm
Installed this and it seem just freaking great. Bram, my man - Whan I go to spain next time, hide or I'll kiss you, hehe ;)
Title: [MOD] Comment box anti spammers v.0.1 (sNews 1.4)
Post by: bramsyuur on May 07, 2006, 08:33:20 pm
@Patric:
I'll wait you with my "lips wide shut"! :P
Thanks, mate! ;)
Title: [MOD] Comment box anti spammers v.0.1 (sNews 1.4)
Post by: Patric Ahlqvist on May 08, 2006, 07:23:47 am
;)
Title: [MOD] Comment box anti spammers v.0.1 (sNews 1.4)
Post by: David on May 08, 2006, 10:30:32 pm
Bram, thanks for this mod! I installed it on my site and it works nicely! :)
Title: [MOD] Comment box anti spammers v.0.1 (sNews 1.4)
Post by: ketut on May 09, 2006, 07:06:34 am
Nice work, I will apply to my snews site :))
Thanks
Title: [MOD] Comment box anti spammers v.0.1 (sNews 1.4)
Post by: Patric Ahlqvist on May 10, 2006, 07:43:17 am
Hey, born4trance... I welcome you first of all to the forum. Hope you'll have a nice stay, and that you keep coming back...We're having a nice time here ;)...

As for SPAM protection, and CAPTCHA's in particular. There might be, or definitivly will come something that will defeat that, but for now it's (in my head, and I don't know much, hehe) the only real shield against SPAM-bots... Live SPAMMERS is harder to protect oneself from, eh ?. I have had CAPTCHA's on my GB for about a year now, I think... and I haven't got one single SPAM post. So, something's good about it still. But then again, there are different versions of CAPTCHA's and some might be easier to crack than others. Hopefully Bram's solution is foolproof ;).

I also await the perfect solution, to this and many other things...But I'm not holding my breath, hehe... I don't look good in blue.

Patric.
Title: [MOD] Comment box anti spammers v.0.1 (sNews 1.4)
Post by: gomisan on May 18, 2006, 06:30:48 am
Could mods like this perhaps be made into Stickies? It's REALLY useful, feature complete, and no bugs have been posted by users so it deserves to be heralded.
Title: [MOD] Comment box anti spammers v.0.1 (sNews 1.4)
Post by: gomisan on May 18, 2006, 08:02:42 am
I've just been givingthis a test out on my website and a clients, and I noticed that all the emails come from 'Nobody'.

How do I set a default 'from' address so they look like they've actually come from my domain?
Title: [MOD] Comment box anti spammers v.0.1 (sNews 1.4)
Post by: Patric Ahlqvist on May 18, 2006, 09:07:37 am
Ehh, "from" adress I don't know. But in order to get to see what website/domain it's coming from, change the setting in the snews.php where it says something bout "Contact form" to...I don't know "From fish-cam.net" or something.

Patric.
Title: [MOD] Comment box anti spammers v.0.1 (sNews 1.4)
Post by: gomisan on May 18, 2006, 09:20:30 am
yeah, doen that, that helps, because you can watch for the subject line in your incoming email, but the actual 'From' address still shows as 'Nobody" for me.

actually .. it shows as nobody@myhostservicedomain.com

ALSO....

how do I make the 'Website' field non-required? not everyone is going to want to submit a web url when they fill in a contact form. I'm guessing it's easy, but I'd prefer to be shown the right way rather than 'guess' and remove soemthing I shouldn't. :)

Still not overly confident with unguided editing of PHP :)
Title: [MOD] Comment box anti spammers v.0.1 (sNews 1.4)
Post by: Patric Ahlqvist on May 18, 2006, 09:38:03 am
I know there is, atleast when using plain HTML, so there must be do-able in PHP aswell. Means altering the snews.php though and I'm not sure on how to achieve this...

We'll have to wait for the Guru's to see this post.

Patric.
Title: [MOD] Comment box anti spammers v.0.1 (sNews 1.4)
Post by: brauck on May 18, 2006, 01:05:39 pm
find the function contact() in snews.php

find these lines:


:




comment these lines out with

and you are done. The url-field will stay blank. Piece of cake :)
Title: [MOD] Comment box anti spammers v.0.1 (sNews 1.4)
Post by: bramsyuur on May 18, 2006, 09:29:44 pm
For preventing 'nobody' email try to add this into your contact function:
locate this line:
Code: [Select]
if (isset($_POST['contactform'])) {and next to it, add this:
Code: [Select]
       $headers = "From: " . strtolower($_POST['email']) . "\r\n" .
       'X-Mailer: PHP/' . phpversion() . "\r\n" .
       "Return-Path: " . s('website_email') . "\r\n";
next, locate this line:
Code: [Select]
mail($to, $subject, $body);and modify like this:
Code: [Select]
mail($to, $subject, $body, $headers);With this modification you can send email with the email assigned to your snews preferences and it's added a Return-Path sender address, with this moddification, your email don't be considered as anonymous and, too, not spam by others. :)
Thanks,
bram.

Quote from: gomisan
yeah, doen that, that helps, because you can watch for the subject line in your incoming email, but the actual 'From' address still shows as 'Nobody" for me.
actually .. it shows as nobody@myhostservicedomain.com
Title: [MOD] Comment box anti spammers v.0.1 (sNews 1.4)
Post by: Luka on May 18, 2006, 09:42:17 pm
I use this one:

Code: [Select]
// CONTACT FORM
function contact() {
if ($_POST['contactform'] == "") {?>



*







*


 


     



  if (isset($_POST['contactform'])) {
$to = s('website_email');
$subject = s('contact_subject');
$body = $_POST['name']. ", " .$_POST['weblink']. "\n\n" .$_POST['message']. "\n";
$from_header = "From: " . strtolower($_POST['email']);
if (strlen(clean($_POST['name'])) > 1 AND strlen(clean($_POST['message'])) > 1) {
mail($to, $subject, $body, $from_header);
echo "

". l('contact_sent') ."

";
  echo "

". l('backhome') ."

";
} else {
echo "

". l('contact_not_sent') ."

";
echo "

". l('message_error') ."

";
echo "

". l('backhome') ."

";
}}}
Title: [MOD] Comment box anti spammers v.0.1 (sNews 1.4)
Post by: bramsyuur on May 18, 2006, 09:59:45 pm
@Luka,
Thanks, my bad... the 'From:' header need to be the person that contat to me... :D
I'll modify my post...
Sorry... ;)
bram.
(really, I need to sleep a bit! :D)
Title: [MOD] Comment box anti spammers v.0.1 (sNews 1.4)
Post by: Patric Ahlqvist on June 05, 2006, 06:02:53 pm
Just hunted through my site for errors and not validated code, and found this:

http://validator.w3.org/check?uri=http%3A%2F%2Fp-ahlqvist.com%2Fhome%2Fsnews_designs%2F

That is one of the pages I have the SPAM protection on. Is this fixed in the 1.5 version or should we start to look at it ??

Patric.
Title: [MOD] Comment box anti spammers v.0.1 (sNews 1.4)
Post by: bramsyuur on June 06, 2006, 01:49:02 am
I've edited my first post with moddified code and, now, the code validates correctly.
Thanks,
bram.
Title: [MOD] Comment box anti spammers v.0.1 (sNews 1.4)
Post by: Patric Ahlqvist 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 ;)
Title: [MOD] Comment box anti spammers v.0.1 (sNews 1.4)
Post by: fray_zack 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) (http://system-x.info/?pageid=18&gb=1) "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 (http://www.solucija.com/forum/viewtopic.php?id=897))
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...
Title: [MOD] Comment box anti spammers v.0.1 (sNews 1.4)
Post by: Patric Ahlqvist 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.
Title: [MOD] Comment box anti spammers v.0.1 (sNews 1.4)
Post by: Mika 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..
Title: [MOD] Comment box anti spammers v.0.1 (sNews 1.4)
Post by: brauck on July 06, 2006, 09:37:17 pm
Hey fray_zack, welcome to our forum; this is a nice and usefull contribution
Title: [MOD] Comment box anti spammers v.0.1 (sNews 1.4)
Post by: Mika on July 06, 2006, 11:27:08 pm
i was wondering... gd library (http://hr.php.net/gd) comes with php installation files... what version of php do you use, fray_zack?
Title: [MOD] Comment box anti spammers v.0.1 (sNews 1.4)
Post by: fray_zack on July 07, 2006, 09:07:10 am
Quote from: mika
i was wondering... gd library (http://hr.php.net/gd) comes with php installation files... what version of php do you use, fray_zack?
I'm using microweb demo (http://www.indigostar.com/microweb.htm)  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 ;)
Title: [MOD] Comment box anti spammers v.0.1 (sNews 1.4)
Post by: 4Sandrix 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?
Title: [MOD] Comment box anti spammers v.0.1 (sNews 1.4)
Post by: 4Sandrix on July 07, 2006, 11:42:37 pm
Nevermind I fixed it :)
Title: [MOD] Comment box anti spammers v.0.1 (sNews 1.4)
Post by: Jochum Meester 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.
Title: [MOD] Comment box anti spammers v.0.1 (sNews 1.4)
Post by: Patrik 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? :)
Title: [MOD] Comment box anti spammers v.0.1 (sNews 1.4)
Post by: dhn on September 11, 2006, 09:42:12 pm
anyone tried this on the 1.5 RC yet ?
Title: [MOD] Comment box anti spammers v.0.1 (sNews 1.4)
Post by: Patric Ahlqvist 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...
Title: [MOD] Comment box anti spammers v.0.1 (sNews 1.4)
Post by: mininovax 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
         


      
      


      


      


      


      
Title: [MOD] Comment box anti spammers v.0.1 (sNews 1.4)
Post by: Patric Ahlqvist on November 30, 2006, 11:06:21 am
@ mininovax and Bob-man... Clearify this to a dumbass...

Your thingies here, is that for making this work in 1.5RC3 ?? And if so, would it be possible for either one of you to post this as a mod when the stable release hits the fan ?

Patric.
Title: [MOD] Comment box anti spammers v.0.1 (sNews 1.4)
Post by: Patric Ahlqvist on November 30, 2006, 02:13:57 pm
I was actually reffering to this, Bob
Quote from: mini-man
Quote from: dhn
anyone tried this on the 1.5 RC yet ?
I have managed to make the above code work......
...only happened to type your name in there aswell, I like typing your name:

Bob, Bob, Bob, Bob, Bob, Bob, Bob, Bob, Bob, Bob, Bob, Bob, Bob, Bob, Bob, Bob, Bob, Bob, Bob, Bob, Bob, Bob, Bob, Bob, Bob, Bob, Bob, Bob, Bob, Bob, Bob, Bob, Bob, Bob, Bob, Bob, Bob, Bob, Bob, Bob, Bob, Bob, Bob, Bob, Bob, Bob, Bob, Bob, Bob, Bob, Bob, Bob, Bob, Bob, Bob, Bob, Bob, Bob, Bob, Bob, Bob, Bob, Bob...

:lol:
Title: [MOD] Comment box anti spammers v.0.1 (sNews 1.4)
Post by: mininovax on December 01, 2006, 05:31:37 pm
Quote from: Patric
@ mininovax and Bob-man... Clearify this to a dumbass...

Your thingies here, is that for making this work in 1.5RC3 ?? And if so, would it be possible for either one of you to post this as a mod when the stable release hits the fan ?

Patric.
Sure thing patric. It is for Snews 1.5 RC3 ... I will be incorporating it on my site shortly... just need to do other things first.
Title: [MOD] Comment box anti spammers v.0.1 (sNews 1.4)
Post by: Patric Ahlqvist on December 02, 2006, 11:25:21 am
I'm no pro at this at all, on fact most users are better than me on everything, whuhaaa... But my understanding is this: 1.5 do not need this mod (???) as Luka built some other thingy, solution into it that would prevent SPAM... Now isn't this assumption correct ? Do we need the SPAM solution after all ?
Title: [MOD] Comment box anti spammers v.0.1 (sNews 1.4)
Post by: mininovax on December 02, 2006, 01:45:14 pm
Quote from: Patric
I'm no pro at this at all, on fact most users are better than me on everything, whuhaaa... But my understanding is this: 1.5 do not need this mod (???) as Luka built some other thingy, solution into it that would prevent SPAM... Now isn't this assumption correct ? Do we need the SPAM solution after all ?
Patric, I am not sure if you understand the point of having a "verification code" on your (comments / contacts). The code, makes sure, that no "bot" / "script"  can post on your site without entering the correct verification code. Basically, it translates to: A human / real person posted the following information on your site.

This is the only "viable" method that I have ever seen, and it is not directly incorporated into Snews 1.5. Many sites now incorporate this technique.
Title: [MOD] Comment box anti spammers v.0.1 (sNews 1.4)
Post by: brauck on December 02, 2006, 01:59:51 pm
Yo mininovax,

Patric is not a blond; I think he understands what you mean. What Patric is trying to say is that sNews 1.5 has a build in SPAM-prevention utility, so that a CAPTCHA solution isn't necessary  anymore.

BTW spambot's become smarter and smarter; there are in fact bot's that can 'read' images.
Title: [MOD] Comment box anti spammers v.0.1 (sNews 1.4)
Post by: Patric Ahlqvist on December 02, 2006, 02:03:41 pm
Thanks, Brauck... although I am actually blond :lol: But you pinpoint the thing I was aiming to say...
Title: [MOD] Comment box anti spammers v.0.1 (sNews 1.4)
Post by: mininovax on December 02, 2006, 03:05:56 pm
Quote from: brauck
Yo mininovax,

Patric is not a blond; I think he understands what you mean. What Patric is trying to say is that sNews 1.5 has a build in SPAM-prevention utility, so that a CAPTCHA solution isn't necessary  anymore.

BTW spambot's become smarter and smarter; there are in fact bot's that can 'read' images.
I was not implying anything "blonde" brauck! I have been looking at posts in Solucija for a while, and can state that Patric is pretty knowledgeable about Snews, as well as yourself.

What I misunderstood, or understood, was that Snews has its own Spam Prevention system. This is not really correct.

You can submit multiple times the same  (contacts / comments) information to SNEWS.... that in my book is spam.

And adding a CAPTCHA solution is not necessarily a spam prevention system; I do know this. However, it is a "little" bit better than having nothing at all.
Title: [MOD] Comment box anti spammers v.0.1 (sNews 1.4)
Post by: brauck on December 02, 2006, 04:01:42 pm
Hey mininovax,

I was just kidding, don't take it to hard. :)

About the spam protection; there is an internal function that's trying tp prevent spam; When you submit a comment there will be a time lap of 5 seconds before you can post the next. This will hopefully holds the bots away; besides of that there is some checking on the ip-adres of the submitter.

Is this waterproof? I'm afraid not, but what webdevelopers are trying to do is to make as many as possible different ways to prevent spambots from injecting their filthy stuff; In this way we at least keep these bastards busy.    :mad:

But I expect that bram, when he can find the time, will modify the CAPTCHA-thingy for use with 1.5
Title: [MOD] Comment box anti spammers v.0.1 (sNews 1.4)
Post by: bramsyuur on December 02, 2006, 05:35:52 pm
I'll try to add this mod for sNews 1.5 soon... for the moment, the _solucija_ that Mininovax post for sNews 1.5 don't work as expected... Because the core was changed... and the way to construct for the forms, too.
Thanks,
bram.
Title: [MOD] Comment box anti spammers v.0.1 (sNews 1.4)
Post by: albert on December 03, 2006, 09:40:20 am
Hi All

I have just added this mod to my 1.5 and works very well .
Time 30 mins to add to sNews plus checking.

ref Spam:

It seems that it is getting harder to fight them at the moment. adding CAPTCHA-thingy for the contact page and the comments hope that it will help too.

brauck.
I saw that time laps of 5 seconds is great and that this can be ajusted be you as well that would be good.

I wonder if we could and some type of Ping there server or IP making sure that they are who they say they are.

Albert :)
Title: [MOD] Comment box anti spammers v.0.1 (sNews 1.4)
Post by: brauck on December 03, 2006, 11:00:01 am
Quote from: Albert
I wonder if we could and some type of Ping there server or IP making sure that they are who they say they are.
Hey Al,

This goes far beyond my skils  :P , but I think something like that has been done;  while generating the form the ip-adres of the visitor is collected and when submitting the comment it is compared with the remote-adres of the visitor at that particularly moment. I can't quite see through how this works, but well, that just me :/
Title: [MOD] Comment box anti spammers v.0.1 (sNews 1.4)
Post by: Mika on December 03, 2006, 12:20:25 pm
[MOD] Comments and Contact box anti spammers for sNews v1.5

- most of the steps are the same as in bram's first post (http://www.solucija.com/forum/viewtopic.php?id=897&p=1):
- add two new files audit.php and button.php into your snews installation folder
- create two new language variables
- edit index.php file according to his notes

Changes to sNews 1.5:
- add these blue parts to the snews.php 1.5

contact()
Quote
function contact() {
   if ($_POST['contactform'] == '') {
      echo '

'.l('contact').'

';
      html_input('form', '', 'post', '', '', '', '', '', '', '', '', '', 'post', db('website'), '');
      html_input('text', 'name', 'name', '', '* '.l('name'), 'text', '', '', '', '', '', '', '', '', '');
      html_input('text', 'email', 'email', '', '* '.l('email'), 'text', '', '', '', '', '', '', '', '', '');
      html_input('text', 'weblink', 'weblink', '', l('url'), 'text', '', '', '', '', '', '', '', '', '');
      html_input('textarea', 'message', 'message', '', '* '.l('message'), '', '', '', '', '', '5', '5', '', '', '');
      echo '

'.l('code_validation').'
'.l('code_validation').'

';
      html_input('text', 'userdigit', 'userdigit', '', l('enter_validation_code'), 'text', '', '', '', '', '', '', '', '', '');
      echo '

';
      html_input('hidden', 'ip', 'ip', $_SERVER['REMOTE_ADDR'], '', '', '', '', '', '', '', '', '', '', '');
      html_input('hidden', 'time', 'time', time(), '', '', '', '', '', '', '', '', '', '', '');
      html_input('submit', 'contactform', 'contactform', l('submit'), '', '', '', '', '', '', '', '', '', '', '');
      echo '

';
   }
   if (audit() && isset($_POST['contactform']) && $_POST['ip'] == $_SERVER['REMOTE_ADDR'] && (time() - $_POST['time']) > 5) {
...
comment()
Quote
function comment($freeze_status) {
...
...
if (audit() && $_POST['ip'] == $_SERVER['REMOTE_ADDR'] && (time() - $_POST['time']) > 4 && strlen($comment) >= 5 && strlen($name) >= 2 && is_numeric($_POST['id'])) {
...
...
if ($freeze_status != 'freezed') {
      echo '

'.l('addcomment').'

';
      html_input('form', '', 'post', '', '', '', '', '', '', '', '', '', 'post', db('website'), '');
      html_input('text', 'name', 'name', '', '* '.l('name'), 'text', '', '', '', '', '', '', '', '', '');
      html_input('text', 'url', 'url', '', l('url'), 'text', '', '', '', '', '', '', '', '', '');
      html_input('textarea', 'text', 'text', '', '* '.l('comment'), '', '', '', '', '', '5', '5', '', '', '');
      echo '

'.l('code_validation').'
'.l('code_validation').'

';
      html_input('text', 'userdigit', 'userdigit', '', l('enter_validation_code'), 'text', '', '', '', '', '', '', '', '', '');
      echo '

';
      html_input('hidden', 'category', 'category', $categorySEF, '', '', '', '', '', '', '', '', '', '', '');
      html_input('hidden', 'id', 'id', $articleId, '', '', '', '', '', '', '', '', '', '', '');
      html_input('hidden', 'article', 'article', $articleSEF, '', '', '', '', '', '', '', '', '', '', '');
      html_input('hidden', 'commentspage', 'commentspage', $back_to_page, '', '', '', '', '', '', '', '', '', '', '');
      html_input('hidden', 'ip', 'ip', $_SERVER['REMOTE_ADDR'], '', '', '', '', '', '', '', '', '', '', '');
      html_input('hidden', 'time', 'time', time(), '', '', '', '', '', '', '', '', '', '', '');
      html_input('submit', 'comment', 'comment', l('submit'), '', '', '', '', '', '', '', '', '', '', '');
      echo '

';
...
Title: [MOD] Comment box anti spammers v.0.1 (sNews 1.4)
Post by: Patric Ahlqvist on December 03, 2006, 12:26:07 pm
Wowsa, Mika. Kisses on your forehead :lol:  for this... Great effort, my man.
Title: [MOD] Comment box anti spammers v.0.1 (sNews 1.4)
Post by: Mika on December 03, 2006, 12:29:22 pm
:D
Title: [MOD] Comment box anti spammers v.0.1 (sNews 1.4)
Post by: brauck on December 03, 2006, 02:30:38 pm
Thanks Mika ;)
Title: [MOD] Comment box anti spammers v.0.1 (sNews 1.4)
Post by: bramsyuur on December 03, 2006, 04:09:08 pm
Thanks Mika! ;)
Title: [MOD] Comment box anti spammers v.0.1 (sNews 1.4)
Post by: Mika on December 03, 2006, 04:10:58 pm
Thanks Mika!

Ups, echo...

You're welcome, girls :D
Title: [MOD] Comment box anti spammers v.0.1 (sNews 1.4)
Post by: brauck on December 03, 2006, 08:41:19 pm
:D
Title: [MOD] Comment box anti spammers v.0.1 (sNews 1.4)
Post by: mrOctagon on May 12, 2007, 01:17:52 pm
Quote from: Mika
[MOD] Comments and Contact box anti spammers for sNews v1.5

- most of the steps are the same as in bram's first post (http://www.solucija.com/forum/viewtopic.php?id=897&p=1):
- add two new files audit.php and button.php into your snews installation folder
- create two new language variables
- edit index.php file according to his notes

Changes to sNews 1.5:
- add these blue parts to the snews.php 1.5

contact()
Quote
function contact() {
   if ($_POST['contactform'] == '') {
      echo '

'.l('contact').'

';
      html_input('form', '', 'post', '', '', '', '', '', '', '', '', '', 'post', db('website'), '');
      html_input('text', 'name', 'name', '', '* '.l('name'), 'text', '', '', '', '', '', '', '', '', '');
      html_input('text', 'email', 'email', '', '* '.l('email'), 'text', '', '', '', '', '', '', '', '', '');
      html_input('text', 'weblink', 'weblink', '', l('url'), 'text', '', '', '', '', '', '', '', '', '');
      html_input('textarea', 'message', 'message', '', '* '.l('message'), '', '', '', '', '', '5', '5', '', '', '');
      echo '

'.l('code_validation').'
'.l('code_validation').'

';
      html_input('text', 'userdigit', 'userdigit', '', l('enter_validation_code'), 'text', '', '', '', '', '', '', '', '', '');
      echo '

';
      html_input('hidden', 'ip', 'ip', $_SERVER['REMOTE_ADDR'], '', '', '', '', '', '', '', '', '', '', '');
      html_input('hidden', 'time', 'time', time(), '', '', '', '', '', '', '', '', '', '', '');
      html_input('submit', 'contactform', 'contactform', l('submit'), '', '', '', '', '', '', '', '', '', '', '');
      echo '

';
   }
   if (audit() && isset($_POST['contactform']) && $_POST['ip'] == $_SERVER['REMOTE_ADDR'] && (time() - $_POST['time']) > 5) {
...
comment()
Quote
function comment($freeze_status) {
...
...
if (audit() && $_POST['ip'] == $_SERVER['REMOTE_ADDR'] && (time() - $_POST['time']) > 4 && strlen($comment) >= 5 && strlen($name) >= 2 && is_numeric($_POST['id'])) {
...
...
if ($freeze_status != 'freezed') {
      echo '

'.l('addcomment').'

';
      html_input('form', '', 'post', '', '', '', '', '', '', '', '', '', 'post', db('website'), '');
      html_input('text', 'name', 'name', '', '* '.l('name'), 'text', '', '', '', '', '', '', '', '', '');
      html_input('text', 'url', 'url', '', l('url'), 'text', '', '', '', '', '', '', '', '', '');
      html_input('textarea', 'text', 'text', '', '* '.l('comment'), '', '', '', '', '', '5', '5', '', '', '');
      echo '

'.l('code_validation').'
'.l('code_validation').'

';
      html_input('text', 'userdigit', 'userdigit', '', l('enter_validation_code'), 'text', '', '', '', '', '', '', '', '', '');
      echo '

';
      html_input('hidden', 'category', 'category', $categorySEF, '', '', '', '', '', '', '', '', '', '', '');
      html_input('hidden', 'id', 'id', $articleId, '', '', '', '', '', '', '', '', '', '', '');
      html_input('hidden', 'article', 'article', $articleSEF, '', '', '', '', '', '', '', '', '', '', '');
      html_input('hidden', 'commentspage', 'commentspage', $back_to_page, '', '', '', '', '', '', '', '', '', '', '');
      html_input('hidden', 'ip', 'ip', $_SERVER['REMOTE_ADDR'], '', '', '', '', '', '', '', '', '', '', '');
      html_input('hidden', 'time', 'time', time(), '', '', '', '', '', '', '', '', '', '', '');
      html_input('submit', 'comment', 'comment', l('submit'), '', '', '', '', '', '', '', '', '', '', '');
      echo '

';
...
For snews 1.5.31 i dont know where to put this code:
if (audit() && isset($_POST['contactform']) && $_POST['ip'] == $_SERVER['REMOTE_ADDR'] && (time() - $_POST['time']) > 5) {
Title: Re: [MOD] Comment box anti spammers v.0.1 (sNews 1.4)
Post by: gesa on September 28, 2007, 10:06:18 pm
Oh, the original code seems to be broken.

Can anyone please repost the code?
Title: Re: [MOD] Comment box anti spammers v.0.1 (sNews 1.4)
Post by: gesa on September 28, 2007, 10:36:23 pm
Bakercad, you saved my day!

Thank you!

It works!  :o