techexpressinc Posted July 22, 2009 Share Posted July 22, 2009 -------------------------------------------------------------------------------- I have a handful of web sites with HTML forms and I am getting spam. I would like to add a PHP verification box to the form. Is this possible? without switching the whole form to a PHP form? Thanks Rneuman@ Scaninc.org Quote Link to comment https://forums.phpfreaks.com/topic/166991-how-to-add-a-php-verification-box/ Share on other sites More sharing options...
Daniel0 Posted July 22, 2009 Share Posted July 22, 2009 http://www.google.com/search?q=captcha+tutorial+php http://recaptcha.net/plugins/php/ Quote Link to comment https://forums.phpfreaks.com/topic/166991-how-to-add-a-php-verification-box/#findComment-880456 Share on other sites More sharing options...
techexpressinc Posted July 23, 2009 Author Share Posted July 23, 2009 That way relys on another person's server. I rather have all the code on my hosting server. Russ Quote Link to comment https://forums.phpfreaks.com/topic/166991-how-to-add-a-php-verification-box/#findComment-880910 Share on other sites More sharing options...
chronister Posted July 23, 2009 Share Posted July 23, 2009 techexpressinc recaptcha is a nice service that does something else along with protecting your forms.... the google link is a google search on how to create your own captcha from scratch and host on your own server.... If one of those 2 replies that Daniel0 gave you don't help you, then I am not sure what we can do without creating the entire thing for you. Creating a captcha is not something that can be taught in a few lines on a forum post... it is a fairly lengthy process..... The basic process is this.... - create random string and store in session var - take random string, and run through GD library to make it an image (this is the heavy lifting part) - display the captcha on screen and accept user input - compare user input with what is stored in session var and react accordingly You may do just fine with a simple math quiz that would be trivial to create e.g. what is 5 + 8 (though not as secure) Nate Quote Link to comment https://forums.phpfreaks.com/topic/166991-how-to-add-a-php-verification-box/#findComment-880973 Share on other sites More sharing options...
techexpressinc Posted July 23, 2009 Author Share Posted July 23, 2009 I am confused on how to intergate the PHP code with my HTML form? Is it a call to a script on the server that happens at time of the POST ? One on my forms that I get the most spam from is: http://www.eldercaremediators.com/join/join.htm I do have a spam stopper on one screen but the hold form is PHP. http://www.eldercaremediators.com/guestbook/guestbook.htm I should do all this? " - create random string and store in session var - take random string, and run through GD library to make it an image (this is the heavy lifting part) - display the captcha on screen and accept user input - compare user input with what is stored in session var and react accordingly " Quote Link to comment https://forums.phpfreaks.com/topic/166991-how-to-add-a-php-verification-box/#findComment-881115 Share on other sites More sharing options...
techexpressinc Posted July 23, 2009 Author Share Posted July 23, 2009 Can you help me on how to install the simple math PHP code to Stop the form submission? I am guessing, it is a php "call" execute somehow integrated with post I have now, but I am confused how to intermix it?? This is what I have now: <form method="POST" onsubmit='return formValidator()' action="../_vti_bin/shtml.exe/join/join.htm" webbot-action="--WEBBOT-SELF--"> <!--webbot bot="SaveResults" U-File="../_private/form_results2.csv" S- Format="TEXT/CSV" S-Label-Fields="TRUE" B-Reverse-Chronology="FALSE" S-Email-Format="TEXT/PRE" S-Email-Address="[email protected] [email protected]" B-Email-Label-Fields="TRUE" S-Builtin-Fields startspan --><input TYPE="hidden" NAME="VTI-GROUP" VALUE="0"><!--webbot bot="SaveResults" i-checksum="43374" endspan -->and Quote Link to comment https://forums.phpfreaks.com/topic/166991-how-to-add-a-php-verification-box/#findComment-881225 Share on other sites More sharing options...
chronister Posted July 24, 2009 Share Posted July 24, 2009 The form posts to an EXE file, so I am not sure how to implement this at all.. It appears that your using some kind of Windows specific web form generator. I have created a simple function that will create a simple math problem, and also display the form. Very easy to use, but how to implement it with a .exe as the form action, I am not sure. save this code to a file somewhere on your server, and use an include to pull it into the page. How to use it is shown at the bottom. <?php function mathCaptcha(){ $num1 = rand(0,9); // create first random number $num2 = rand(0,9); // create second random number session_start(); // start a session if it is not started $_SESSION['mathAnswer'] = $num1+$num2; // set a session variable containing the answer of the equation $equation = 'To help prevent abuse of my form, please answer the following simple math problem<br>'; // set a text string $equation .= $num1 .' + '. $num2.' <input type="text" name="mathCaptcha" id="mathCaptcha" size="4" />'; // display equation and input box return $equation; // return the equation string. } echo mathCaptcha(); // this is how to call it ?> Basically on your processing side, you will want to compare the value of $_POST['mathCaptcha'] to $_SESSION['mathAnswer'] and act accordingly. Nate Quote Link to comment https://forums.phpfreaks.com/topic/166991-how-to-add-a-php-verification-box/#findComment-881634 Share on other sites More sharing options...
techexpressinc Posted July 27, 2009 Author Share Posted July 27, 2009 Thanks _ The form is a FrontPage thing I think... I believe I am going to have to rewrite the form in PHP and then I can try to use math thing. Russ = Rneuman @ SCANINC.com Quote Link to comment https://forums.phpfreaks.com/topic/166991-how-to-add-a-php-verification-box/#findComment-884181 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.