prujohn
  •  prujohn
  • 61.4% (Friendly)
  • YAF Forumling Topic Starter
2007-07-21T05:52:52Z
Ok so instead of whining and crying for new features (which I already did, ha! :cheesy: ), I decided to write my own mod for providing CAPTCHA functionality in YAF. I've made changes to provide Captcha functionality for the "Registration" page AND the "Create Post" page.

It's based on a technique described in this tutorial at beansoftware.com . The captcha image generator isn't the most advanced, but it will provide at least some protection (and can be improved if anyone feels up to the task).

All the modified files are attached:

AdminPage.cs - goes into the "classes" folder
I've added two new classes to this file. "gzx" (don't ask about the name) which contains a method for randomly generating Captcha strings. "CaptchaImage" which contains the methods for generating the Captcha Image.

captcha.aspx - goes into your YAF root directory. Read the tutorial to find out how this works.

postmessage.ascx
postmessage.ascx.cs
register.ascx
register.ascx.cs
These files go into the "pages" directory. I've modified the tables to accomodate the Captcha UI, and also modified the code-behind files to generate a random Captcha string, and to validate the user input against the string.

If you don't want a Captcha filter on your "create post page", then ignore the "postmessage.ascx" and "postmessage.ascx.cs" files.

This mod is provided "as-is", no warranty is given or implied. Use at your own risk.

Feel free to further modify/improve upon what I've started. I've tested it on my board (YAF v1.9.0) and it works like a champ.

Sponsor
prujohn
  •  prujohn
  • 61.4% (Friendly)
  • YAF Forumling Topic Starter
2007-07-28T05:48:16Z
Hi folks,

I've got around to updating the english.xml file so the mod should now be fully "YAF Compliant".

The following files have been changed to reflect the new resource tags:
postmessange.ascx
postmessage.ascx.cs
register.ascx
register.ascx.cs


The following file has been added:
english.xml - now has resource tags for the captcha text in both the REGISTER and POSTMESSAGE sections. These will need to be placed into other language files (and translated) if you want this mod to support other languages.

All other files remain the same, as described in the original post.

Cheers!


Mek
  •  Mek
  • 100% (Exalted)
  • YAF Developer
2007-07-29T05:11:23Z
Thank you for the contribution 🙂
UserPostedImage 

"It's a case of RTFM.. the only problem being we don't have a manual!"

When I post FP:Mek in a topic, I'm leaving my footprint there so I can track it once I get into coding/supporting. (Yes I stole this off Ederon 🙂 )
prujohn
  •  prujohn
  • 61.4% (Friendly)
  • YAF Forumling Topic Starter
2007-07-29T05:45:11Z
Happy to contribute!

I guess the natural next evolution of this would be to add it as an option in the admin panel, but I think that would require some changes to the underlying DB and stored procs. Seems like this is all changing for v 1.9.3 so probably best to wait until then, eh?
Jaben
  •  Jaben
  • 100% (Exalted)
  • YAF Developer
2007-08-21T12:35:02Z
I'd like to see this in v1.9.3... I think I'll go ahead and integrate it. Thanks for your work on this -- it looks great.
prujohn
  •  prujohn
  • 61.4% (Friendly)
  • YAF Forumling Topic Starter
2007-08-22T10:06:36Z
Jaben wrote:

I'd like to see this in v1.9.3... I think I'll go ahead and integrate it. Thanks for your work on this -- it looks great.



Good news indeed!
guest
2007-09-04T06:13:33Z
Based on prujohn CAPTCHA Mod I made some modifications.

All the modified files are attached:

Quote:

AdminPage.cs - goes into the "classes" folder
I've added two new classes to this file. "gzx" (don't ask about the name) which contains a method for randomly generating Captcha strings. "CaptchaImage" which contains the methods for generating the Captcha Image.

captcha.aspx - goes into your YAF root directory. Read the tutorial to find out how this works.

postmessage.ascx
postmessage.ascx.cs
register.ascx
register.ascx.cs


I've added and posts.ascx, posts.ascx.cs files to avoide robots from posting from quick answer section (if activated). Also i've moded the source to exclude registered users from captcha image. This means only if you post a message as a Guest status to invoke Captcha Image.

Mod tested on YAF 1.9.0. Tnx prujohn for the original contribution.

This mod is provided "as-is", no warranty is given or implied. Use at your own risk. Feel free to modify/improve this code ... but please share the modification with others :)
bigtoga
2007-09-05T06:39:37Z
Guys - while I applaud the contribution, let me just tell you from experience that this will have probably less than a 5% effect on stopping spam. Sorry. I've been running my own captcha'ed version of YAF since April and it is virtually worthless. I've removed it in my next "release" that I'm adding out there. I used Jeff atwood's captcha (search for my earlier posts) and, even though Jeff's captcha is awesome, captchas are ineffective. Sorry 😞
Check out my implementation of YAF: http://forums.learnsqlserver.com/ .
I am also a SQL Server and .NET trainer over at http://www.learnitfirst.com 
prujohn
  •  prujohn
  • 61.4% (Friendly)
  • YAF Forumling Topic Starter
2007-09-06T11:18:02Z
bigtoga wrote:

Guys - while I applaud the contribution, let me just tell you from experience that this will have probably less than a 5% effect on stopping spam. Sorry. I've been running my own captcha'ed version of YAF since April and it is virtually worthless. I've removed it in my next "release" that I'm adding out there. I used Jeff atwood's captcha (search for my earlier posts) and, even though Jeff's captcha is awesome, captchas are ineffective. Sorry :(



I'd like to keep this thread on-topic. That is, it should be related to the modification, not regarding debating the merits of using CAPTCHA technology. I believe there is another thread that already discusses this in great detail.
prujohn
  •  prujohn
  • 61.4% (Friendly)
  • YAF Forumling Topic Starter
2007-09-06T11:19:04Z
phenomen wrote:

Based on prujohn CAPTCHA Mod I made some modifications.

All the modified files are attached:

Quote:

AdminPage.cs - goes into the "classes" folder
I've added two new classes to this file. "gzx" (don't ask about the name) which contains a method for randomly generating Captcha strings. "CaptchaImage" which contains the methods for generating the Captcha Image.

captcha.aspx - goes into your YAF root directory. Read the tutorial to find out how this works.

postmessage.ascx
postmessage.ascx.cs
register.ascx
register.ascx.cs


I've added and posts.ascx, posts.ascx.cs files to avoide robots from posting from quick answer section (if activated). Also i've moded the source to exclude registered users from captcha image. This means only if you post a message as a Guest status to invoke Captcha Image.

Mod tested on YAF 1.9.0. Tnx prujohn for the original contribution.

This mod is provided "as-is", no warranty is given or implied. Use at your own risk. Feel free to modify/improve this code ... but please share the modification with others :)



Good stuff! Thanks for adding to this effort. 🙂
AtomicInternet
2008-07-15T15:05:37Z
I know this is an old topic, but I found an even simpler solution that works well for me. Just add the following to pages\register.ascx
You don't even have to recompile your site, just load the registration page and you're done.

You might want to change my validation expression to accept something other than 3 or 4, and you'll obviously need a clever method to tell the user what number to enter. You can see mine at http://www.ecoboosted.org/yaf_register.aspx 

Hope this helps someone


<tr>
		<td class=postheader><%# GetText("timezone") %>:</td>
		<td class=post><asp:DropDownList id=TimeZones runat="server" DataTextField="Name" DataValueField="Value"/></td>
	</tr>
<!-- Add the following code //-->
	<tr>
	    <td class=postheader>Human Verification - Enter Requested Number:</td>
		<td class=post><asp:TextBox id=Verification runat="server" /><img src="/images/joseph.gif" border="0" align="absmiddle" />
		<asp:RequiredFieldValidator ID="rfvVerification" runat="server" ErrorMessage='You must type the number requested (i.e. 5)' ControlToValidate="Verification" EnableClientScript="False"/>
		<asp:RegularExpressionValidator ID="revVerification" runat="server" ValidationExpression="[3-4]" ErrorMessage='You must type the number requested (i.e. 5)' ControlToValidate="Verification" EnableClientScript="False"/>
		</td>
	</tr>
<!-- End code modification //-->
	<tr>
		<td align="middle" colspan="2" class=footer1>
			<asp:Button id=ForumRegister cssclass="pbutton" runat="server" onclick="ForumRegister_Click" />
			<asp:button id=cancel cssclass="pbutton" runat="server"/>
		</td>
	</tr>
sinbad911
2008-07-15T15:23:03Z
when the image dont show, i cant refresh another image
Diễn đàn đại học Công Nghiệp TPHCM: http://congnghiep4.com 

About Us

The YAF.NET is an open source .NET forum project. YAF.NET is supported by an team of international developers who are build community by building community software.

Powered by Resharper Donate with PayPal button

Project Twitter Updates

Copyright © YetAnotherForum.NET & Ingo Herbote. All rights reserved