[VB.Net] Simple captcha class [Commented][Noob/Friendly] - Printable Version +- Support Forums (https://www.supportforums.net) +-- Forum: Categories (https://www.supportforums.net/forumdisplay.php?fid=87) +--- Forum: Coding Support Forums (https://www.supportforums.net/forumdisplay.php?fid=18) +---- Forum: Visual Basic and the .NET Framework (https://www.supportforums.net/forumdisplay.php?fid=19) +---- Thread: [VB.Net] Simple captcha class [Commented][Noob/Friendly] (/showthread.php?tid=19444) Pages:
1
2
|
[VB.Net] Simple captcha class [Commented][Noob/Friendly] - The-One - 06-09-2011 Hey people , This is my first contribution to this forum. Today we are going to make our own captcha class, meaning we are going to draw and show it ourselves. Why? Because its shorter and probably easier for new programmers. I assume you have some knowledge of Visual Basic.NET so I won't spoon feed you guys today. Create a new windows form project and add the following controls:
This is mine: Step 1 First, let us make the Function which generates the random string. Code: Private Shared Function RandomString(ByVal size As Integer) As String I fully commented everything so you know what piece of code does what. Step 2 Okay, cool, we get l33t strings. But how we get them into a image? Simple: Code: Public Shared Sub RandomImage(ByVal p As PictureBox, ByVal c As Color, Optional ByVal string_size As Integer = 6, Optional ByVal letter_size As Integer = 30) As you notice, I'm trying to declare as less as I can. Step 3 Now we are going to check if the picture matches the textbox. First we need to store the string into the memory, (as you notice a error) so we need to declare 's'. Code: Private Shared s As String = Nothing ' Save it to check it later. Next, the actual check: Code: Public Shared Function Check(ByVal str As String) As Boolean Step 4 Double click the button, we need to call the 'Check' function and insert the textbox its text into the parameter. Code: If ManCaptcha.Check(TextBox1.Text) Then ' Check if true. NOTE: I placed everything from Step 1 to Step 3 in a STRUCTURE Code: Structure ManCaptcha You can skip it, but I like to have it organized. Step 5 Now, to create the image and draw it, you can use this: Code: ' Parameters: <picturebox to store picture>, <color of captcha>, <size of captcha string>, <size of each letter> I've uploaded the code to Pastebin Pastebin Link Raw Pastebin Link (For C+P) Please comment & rate! Enjoy! RE: [VB.Net] Simple captcha class [Commented][Noob/Friendly] - davidmarker - 06-09-2011 Thanks! I'll have to implant this in some of my future projects. RE: [VB.Net] Simple captcha class [Commented][Noob/Friendly] - xMan - 06-09-2011 wow this is one in depth tutorial. well done with it! RE: [VB.Net] Simple captcha class [Commented][Noob/Friendly] - The-One - 06-09-2011 (06-09-2011, 07:49 AM)xMan Wrote: wow this is one in depth tutorial. well done with it! Thanks man, appreciate it. (06-09-2011, 07:48 AM)davidmarker Wrote: Thanks! I'll have to implant this in some of my future projects. Thanks, good luck with your projects! RE: [VB.Net] Simple captcha class [Commented][Noob/Friendly] - -Dreams - 06-14-2011 Kinda dumb in my book, but whatever. RE: [VB.Net] Simple captcha class [Commented][Noob/Friendly] - The-One - 06-19-2011 (06-14-2011, 02:21 AM)-Dreams Wrote: Kinda dumb in my book, but whatever. How you mean dumb? RE: [VB.Net] Simple captcha class [Commented][Noob/Friendly] - RiChZ - 06-19-2011 thank. going to use this on my next project. RE: [VB.Net] Simple captcha class [Commented][Noob/Friendly] - Coding Support - 06-19-2011 Good, well detailed tutorial. A lot of work for a captcha class. Ill try this out soon. RE: [VB.Net] Simple captcha class [Commented][Noob/Friendly] - Bigandrewgold - 06-24-2011 good basic captcha. But i just hope that some noob does'nt use this to actually try to protect something RE: [VB.Net] Simple captcha class [Commented][Noob/Friendly] - Black Ghost - 06-29-2011 This will be useful for a booter I am making. Thanks! |