Home Private Messages Search
CPG Dragonfly™ CMS stopsoftwarepatents.eu petition banner
Toggle Content
 
Forums ⇒ DragonflyCMS ⇒ Add-Ons & Blocks ⇒ CAPTCHA thread


CAPTCHA thread
Need help creating a block or add-on, or you have created or modified a block/add-on that works in Dragonfly CMS and it meets the CPG Security Requirements? Do you have feedback about a specific add-on? Here is the place to post. Read the announcements here first!.
Go to page 1, 2  Next
Post new topic    Reply to topic    Printer Friendly Page     Forum Index ⇒  Add-Ons & Blocks

View previous topic :: View next topic  
Author Message
personman
Heavy poster
Heavy poster

Offline Offline
Joined: May 29, 2007
Posts: 152

PostPosted: Wed Dec 03, 2008 2:54 pm
Post subject: CAPTCHA thread

I used to have anonymous commenting on my site's news page, but had to disable it to control spam.

Is there a way to turn on captcha for anonymous posting? Should there be? I could investigate modding it, might be over my head though, dunno.

I previously made a patch to allow disabling anonymous news comments without disabling anonymous news submissions. It's floating around here somewhere.

-Andy

_________________
My site

personman's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
Linux 2.6.24.5/Apache 2.2.9/MySQL 5.0.67/PHP 5.2.6/DragonflyCMS 9.2.1


Last edited by personman on Tue Apr 14, 2009 3:27 pm; edited 1 time in total
Back to top
View user's profile Visit poster's website
hadi00
Translator
Translator

Offline Offline
Joined: Dec 01, 2004
Posts: 198
Location: Syria
PostPosted: Sun Dec 07, 2008 1:46 am
Post subject: Re: Captcha for anonymous?

I guess not! There is no CAPTCHA for news comments..

_________________
The truth is to stop thinking and start living

hadi00 please enter your server specs in your user profile! Crying or Very sad
Back to top
View user's profile Send e-mail
personman
Heavy poster
Heavy poster

Offline Offline
Joined: May 29, 2007
Posts: 152

PostPosted: Thu Feb 05, 2009 6:29 pm
Post subject: Re: Captcha for anonymous?

Well, I took a whack at it and ended up with nothing but a broken captcha and a headache. Sad

It has such a nice CAPTCHA, but it's a shame so little uses it. Maybe work could be done, or documentation could be written, to make it easier for modders to use the CAPTCHA system? Or maybe I just need to be more patient.

-Andy

_________________
My site

personman's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
Linux 2.6.24.5/Apache 2.2.9/MySQL 5.0.67/PHP 5.2.6/DragonflyCMS 9.2.1
Back to top
View user's profile Visit poster's website
rlgura
1000+ Posts Club
1000+ Posts Club

Offline Offline
Joined: Mar 27, 2006
Posts: 1146
Location: Cleveland, OH USA
PostPosted: Fri Feb 06, 2009 4:47 pm
Post subject: Re: Captcha for anonymous for News?

Might want to take a look at this post and see if it's helpful for what you're doing: myndworx.com/ForumsPro...t=709.html

_________________
Admin - Great Lakes Web Designs
Theme Designer - WebSite Guru Designs
Site Admin - Families with Food Allergies

rlgura's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
Linux 2.6.27-grsec/Apache 2.2.11/MySQL 5.0.67-community-log/PHP 5.2.8/DF 9.2.1
Back to top
View user's profile Visit poster's website
Klas
Newbie
Newbie

Offline Offline
Joined: Apr 27, 2004
Posts: 38
Location: Oldenburg/Germany
PostPosted: Fri Feb 06, 2009 5:17 pm
Post subject: Re: Captcha for anonymous for News?

Try this, copy the comments.php to modules/News/ . But make a backup first.

_________________
Klas
.
My mice Terri & Tracy

Klas's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
Back to top
View user's profile Visit poster's website Photo Gallery
personman
Heavy poster
Heavy poster

Offline Offline
Joined: May 29, 2007
Posts: 152

PostPosted: Fri Feb 06, 2009 5:32 pm
Post subject: Re: Captcha for anonymous for News?

Thanks guys. Smile Once I get re-motivated to take a shot at it, I'd like to go through and CAPTCHA-ize the whole thing. News, blogs, forums, comments, etc. I'd like to eventually re-open my site to anonymous users, without opening a floodgate of spam.

Probably make the changes in to a patch against DF 9.2.1.

I think it would be cool to see it go in to the core (assuming we pull it off.)

Looks like these should be a good starting point, I'll check it out more when I get my hands dirty. Smile

-Andy

_________________
My site

personman's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
Linux 2.6.24.5/Apache 2.2.9/MySQL 5.0.67/PHP 5.2.6/DragonflyCMS 9.2.1
Back to top
View user's profile Visit poster's website
tkog2004
Heavy poster
Heavy poster

Offline Offline
Joined: May 14, 2006
Posts: 152

PostPosted: Sat Feb 07, 2009 11:12 am
Post subject: Re: Captcha for anonymous for News?

just used the Myndworx example as a basis to adding captcha to Guestbook4U and it works no problem so It shouldnt be much hassle to get it in elsewhere.

I dont really use comments much, but if I get chance then I will take a look at it.

_________________


tkog2004 please enter your server specs in your user profile! Crying or Very sad
Back to top
View user's profile Visit poster's website
personman
Heavy poster
Heavy poster

Offline Offline
Joined: May 29, 2007
Posts: 152

PostPosted: Tue Feb 10, 2009 5:40 pm
Post subject: Re: Captcha for anonymous for News?

Here are the changes I've made to add the security code to the news comments form. This should only effect unregistered users, and requires anonymous commenting to be enabled.

Attached is a replacement /modules/News/comments.php for DragonflyCMS 9.2.1, with the changes applied.

Open /modules/News/comments.php

Around line 308, in the function replyform, find this bit of code at the bottom of the function:

Code::
	<input type="hidden" name="pid" value="'.$pid.'" />
	<input type="hidden" name="sid" value="'.$sid.'" />
	<input type="submit" name="preview" value="'._PREVIEW.'" /> <input type="submit" name="postreply" value="'._OK.'" />
	</form>';
	CloseTable();

and change it to this:

Code::
	<input type="hidden" name="pid" value="'.$pid.'" />
	<input type="hidden" name="sid" value="'.$sid.'" />';
if (!is_user()) {
echo '
<table border="0">
<tr>
<td class="row1"><span class="gen">'._SECURITYCODE.':</span></td>
<td class="row2">'.generate_secimg().'</td></tr>
<tr>
<td class="row1"><span class="gen">'._TYPESECCODE.':</span></td>
<td class="row2"><input type="text" name="gfx_check" size="7" maxlength="6" /></td>
</tr></table>';}
	echo '<input type="submit" name="preview" value="'._PREVIEW.'" /> <input type="submit" name="postreply" value="'._OK.'" />
	</form>';
	CloseTable();

Around line 384 in the function replypost, you should see this if statement:

Code::
	if (is_user()) {
		$name = $userinfo['username'];
		$email = $userinfo['femail'];
		$url = $userinfo['user_website'];
		$score = 1;
	} else {
		$name = $email = $url = '';
		$score = 0;
	}

We change this to:

Code::
	if (is_user()) {
		$name = $userinfo['username'];
		$email = $userinfo['femail'];
		$url = $userinfo['user_website'];
		$score = 1;
	} else {
		$name = $email = $url = '';
		$score = 0;
		//edited
		if (!validate_secimg()) { cpg_error(_SECURITYCODE.' incorrect'); }
                //end edit
	}

Updated: Forgot the usercheck in the form.

_________________
My site

personman's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
Linux 2.6.24.5/Apache 2.2.9/MySQL 5.0.67/PHP 5.2.6/DragonflyCMS 9.2.1


Last edited by personman on Tue Apr 07, 2009 1:56 pm; edited 2 times in total
Back to top
View user's profile Visit poster's website
personman
Heavy poster
Heavy poster

Offline Offline
Joined: May 29, 2007
Posts: 152

PostPosted: Tue Feb 10, 2009 6:37 pm
Post subject: Re: Captcha for anonymous for News?

The reDesign theme also has a reply form in it, so here is my attempt at modding in the security code.

I modded version 9.1.2.7 DP I think it was.

Open the file /themes/reDesign/template/news/comments.html

Around line 165 you should see the following:

Code::
  <input type="hidden" name="{S_SID_NAME}" value="{S_SID}" />
  <div style="text-align: center;padding: 20px;clear: both;">
  <input type="submit" name="preview" class="button" value="{S_PREVIEW}" /> <input type="submit" name="postreply" class="button" value="{S_OK}" />

We want to change this to:

Code::
  <input type="hidden" name="{S_SID_NAME}" value="{S_SID}" />
  <div style="text-align: center;padding: 20px;clear: both;">
<!-- PHP -->
if (!is_user()) {
echo '
<table align="center" border="0">
<tr>
<td class="row1"><span class="gen">'._SECURITYCODE.':</span></td>
<td class="row2">'.generate_secimg().'</td></tr>
<tr>
<td class="row1"><span class="gen">'._TYPESECCODE.':</span></td>
<td class="row2"><input type="text" name="gfx_check" size="7" maxlength="6" /></td>
</tr></table>';
}
<!-- ENDPHP -->
  <input type="submit" name="preview" class="button" value="{S_PREVIEW}" /> <input type="submit" name="postreply" class="button" value="{S_OK}" />

_________________
My site

personman's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
Linux 2.6.24.5/Apache 2.2.9/MySQL 5.0.67/PHP 5.2.6/DragonflyCMS 9.2.1
Back to top
View user's profile Visit poster's website
hadi00
Translator
Translator

Offline Offline
Joined: Dec 01, 2004
Posts: 198
Location: Syria
PostPosted: Sat Feb 21, 2009 11:01 pm
Post subject: Re: Captcha for anonymous for News?

I think I have just needed that ! thnx a lot !

_________________
The truth is to stop thinking and start living

hadi00 please enter your server specs in your user profile! Crying or Very sad
Back to top
View user's profile Send e-mail
DJ Maze
Developer
Developer

Offline Offline
Joined: Apr 19, 2004
Posts: 5683
Location: http://tinyurl.com/5z8dmv
PostPosted: Sun Feb 22, 2009 1:38 am
Post subject: Re: Captcha for anonymous for News?

There's no need to manually validate the 'gfxid'

validate_secimg() does it all for you!

dragonflycms.org/cvs/h...play.php?v


DJ Maze's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
Fedora 15 / 2.2.22 / 5.5.20 / 5.3.10 / CVS
Back to top
View user's profile Visit poster's website Yahoo Messenger Photo Gallery
personman
Heavy poster
Heavy poster

Offline Offline
Joined: May 29, 2007
Posts: 152

PostPosted: Sun Feb 22, 2009 1:42 pm
Post subject: Re: Captcha for anonymous for News?

I don't imagine this will block all spam bots, just hoping it raises the bar for them a bit, and makes the moderator's job more reasonable with anonymous commenting. On the other hand, it might just end up attracting bots that crack this particular captcha. Time will tell.

So far, I've had pretty good results. I posted a preview and install guide for Kubuntu Linux 9.04, story ran on a few linux news sites. Got about 5,000 reads, maybe 6 or 7 anonymous comments, and no spam yet. Smile

-Andy

DJ Maze: If I understand correctly, I can replace this bit:

Code::
		//edited
		$gfxid = isset($_POST['gfxid']) ? $_POST['gfxid'] : 0;
		$code = $CPG_SESS['gfx'][$gfxid];
		$gfx_check = isset($_POST['gfx_check']) ? $_POST['gfx_check'] : '';
		if (strlen($gfx_check) < 2 || $code != $gfx_check) { cpg_error(_SECURITYCODE.' incorrect'); }
                //end edit

simply with: validate_secimg()? or drop it altogether?

Cool, thanks. I'll play around with it next time I'm in there and post any updates. Smile

_________________
My site

personman's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
Linux 2.6.24.5/Apache 2.2.9/MySQL 5.0.67/PHP 5.2.6/DragonflyCMS 9.2.1
Back to top
View user's profile Visit poster's website
DJ Maze
Developer
Developer

Offline Offline
Joined: Apr 19, 2004
Posts: 5683
Location: http://tinyurl.com/5z8dmv
PostPosted: Sun Feb 22, 2009 5:37 pm
Post subject: Re: Captcha for anonymous for News?

You're correct just use:
Code::
if (!validate_secimg()) { cpg_error(_SECURITYCODE.' incorrect'); }

You could even make the code harder.
By default it uses 6 characters but can modify that to your liking.

generate_secimg(12)
validate_secimg(12)

Ofcourse the background image should be big enough to fit all characters Wink


Tip regarding you news item: Use VirtualBox!
When running a VM you can make nice screenshots instead of the horrible "shoot the monitor" pictures Very Happy
VirtualBox is available in your Ubuntu repo or at www.virtualbox.org/

I use it all the time to test new OS's
  1. download an ISO of the desired OS
  2. run virtualbox and mount the ISO as CD/DVD


DJ Maze's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
Fedora 15 / 2.2.22 / 5.5.20 / 5.3.10 / CVS
Back to top
View user's profile Visit poster's website Yahoo Messenger Photo Gallery
hadi00
Translator
Translator

Offline Offline
Joined: Dec 01, 2004
Posts: 198
Location: Syria
PostPosted: Sun Feb 22, 2009 8:29 pm
Post subject: Re: Captcha for anonymous for News?

Still watching !
keep good work..

_________________
The truth is to stop thinking and start living

hadi00 please enter your server specs in your user profile! Crying or Very sad
Back to top
View user's profile Send e-mail
personman
Heavy poster
Heavy poster

Offline Offline
Joined: May 29, 2007
Posts: 152

PostPosted: Fri Apr 10, 2009 12:33 pm
Post subject: Re: Captcha for anonymous for News?

I updated the code based on DJ Maze's comments (it should be functionally identical). On a related note, I've added anonymous commenting with CAPTCHA to the newest release of Personal Pages.

Bots seem to have figured out that my survey's comments don't have CAPTCHA yet, so that will probably be one of the next things to remedy.

In the future I'll probably look in to adding CAPTCHA to the blog comments and the forums, maybe the news submission form.

-Andy

_________________
My site

personman's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
Linux 2.6.24.5/Apache 2.2.9/MySQL 5.0.67/PHP 5.2.6/DragonflyCMS 9.2.1
Back to top
View user's profile Visit poster's website
Display posts from previous:   
Post new topic    Reply to topic    Printer Friendly Page    Forum Index ⇒  Add-Ons & Blocks
Page 1 of 2
All times are GMT
Go to page 1, 2  Next



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
You cannot attach files in this forum
You cannot download files in this forum


 
   Toggle Content User Info

Welcome Anonymous

Nickname
Password
(Register)

   Toggle Content Last CVS commits
· Further security class improvements.
· 301 redirects on LEO changes
· Option to force 3xx http status codes
· Validate googlebot.com and google.com crawlers.
· CCBot
· Rss with etag and atom.
· Removed index.php depency.
· v9 fixed menu hoverings on touch screens.
· Fixed menu hoverings on touch screens.
· Fixed empty $Module object

devamı...

   Toggle Content Community

Support for DragonflyCMS in a other languages:

Deutsch
Español

   Toggle Content X-links
UltraEdit Browse Happy logo Firefox MySQL PostgreSQL Valid CSS! Valid XHTML 1.0! Unicode Encoded Badge NukeBiz Resources Raven DragonflyCMS Dedicated Now InsideSupport Lampe Berger

You are seeing squares or questionmarks on this page?

All content of this website is copyrighted by the Creative Commons NC-SA
The logos and trademarks used on this site are the property of their respective owners
We are not responsible for comments posted by our users, as they are the property of the poster.
Our server runs on a P3 1.2GHz with 512MB RAM with no accelerators
Support GoPHP5.org
Interactive software released under GNU GPL, Code Credits, Privacy Policy