Page 1 of 1

adding a PHP verification box to html forms how?

Posted: Wed Jul 22, 2009 10:59 am
by techexpressinc
--------------------------------------------------------------------------------

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

Re: adding a PHP verification box to html forms how?

Posted: Wed Jul 22, 2009 11:35 am
by jayshields
Look into CAPTCHAs.

Re: adding a PHP verification box - not there yet

Posted: Wed Jul 22, 2009 8:27 pm
by techexpressinc
that solution relies on another person's server i rather not do that.
Russ

Re: adding a PHP verification box - not there yet

Posted: Wed Jul 22, 2009 11:19 pm
by superdezign
techexpressinc wrote:that solution relies on another person's server i rather not do that.
Russ
It doesn't have to. Yahoo and Google use their own CAPTCHAs. The easiest way is to do it with a third party, though. Ticketmaster uses reCaptcha, which is the most famous third party CAPTCHA.

If a CAPTCHA isn't what you are looking for, then what do you mean by a "PHP verification box?" PHP is an entire programming language, so your request is extremely vague.

Re: adding a PHP verification box to html forms how?

Posted: Wed Jul 22, 2009 11:33 pm
by omniuni
techexpressinc wrote:--------------------------------------------------------------------------------

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
My first thought is whether you have your spam filters set up correctly, but otherwise, if you want to make a really simple sort of captcha that should baffle at least the more annoying of the robots you'll get, try making it do some simple addition. Randomly choose two numbers between 0 and 20. Add a hidden input to the form with the sum of the two numbers. Don't call it "answer", call it something ambiguous like "integer". Add a field where the user has to enter the sum of the two numbers. Check it against the "integer" field, and you have a very basic test for robots. Mind you, this is not foolproof at all, but it should help a bit. If you decide to use this, I'd love to know your results!

Good Luck!

Re: I tried a javascript edit and the Robots work around it??

Posted: Thu Jul 23, 2009 6:50 am
by techexpressinc
I put an tight JavaScript Zip Code edit in.
Must be numeric and Must be 5 to 9 in length, for me it stops submission for the Spam ROBOTs
they do want they want, grabage comes through and tooo much of it.

I understand PHP is a script (Code) that runs on the server, is there a smooth way to
intergate it with the submit of the HTML form?

Thank you for all and any help, this is a problem to more than a few from the post I see, but not many solutions get posted.

Russ - Rneuman@ ScanInc.org

Re: adding a PHP verification box to html forms how?

Posted: Thu Jul 23, 2009 10:00 am
by omniuni
Unfortunately, JavaScript doesn't much help with robots, because they don't support JavaScript. It may as well not be there. You need to check on the server side the validation of the data before sending the mail. As I mentioned earlier, one good way is requiring some simple math.

Re: adding a PHP verification box to html forms how?

Posted: Thu Jul 23, 2009 10:18 am
by techexpressinc
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:

Code: Select all

<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="russ@techexpressinc.com 

neumans2000@yahoo.com" 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

Re: adding a PHP verification box to html forms how?

Posted: Thu Jul 23, 2009 10:54 am
by omniuni
Wow, that doesn't look anything like anything I'm familiar with.

Here are some snippets of the PHP, anyway.

Code: Select all

 
<?php
$num1 = rand(0, 20);
$num2 = rand(0, 20);
$numSolved = $num1 + $num2;
$solveMeString = mb_convert_encoding("What is the sum of $num1 and $num2? ", ‘HTML-ENTITIES?, ‘UTF-8’);
$hiddenInput = '<input type="hidden" name="formtag" value="'.$numSolved.'" />';
?>
 
Now, just use <?php echo $solveMeString; ?> and <?php echo $hiddenInput; ?> to print the indicated information into your form. Before you send a mail, just check that whatever input you choose to use has a value equal to the one indicated in the hidden input.

Re: adding a PHP verification box to html forms how?

Posted: Thu Jul 23, 2009 2:01 pm
by techexpressinc
I posted HTML code, how would I intergate your math PHP code with the HTML code any good ideas?

1) Somehow?? I need to intergate the Math PHP code, I am guessing to put it somewhere but where??

Do I do this above the submit button in my HTML like below??

Code: Select all

<iframe src="math.php" width="320" height="350" frameborder="0" scrolling="No">  </iframe>
		
								<p align="center">
									<input type="submit" value="Submit" name="B1" style="font-size: 14pt"><input type="reset" value="Reset" name="B2" style="font-size: 14pt"></td>

Re: adding a PHP verification box to html forms how?

Posted: Thu Jul 23, 2009 2:25 pm
by omniuni
I don't see how an iframe would be of help at all. I also do not understand how your code is supposed to work. What you posted previously is some strange form of html, javascript, and... I don't even know! I can write you an actual PHP form with the validator, but it looks like whatever method you're using now is a "dumb script" in that it can't take parameters or make calculations, it simply sends out whatever it receives. :?

At this point, you likely need to be thinking instead of "how can I modify this", more along the lines of "do I want to stop the SPAM?". If the answer is yes, then we're going to have to take a look at your form as a whole, and write a PHP version.

Oh, just to be sure...
Your code earlier calls shtml.exe which indicates you are on a Windows server. Generally, that's probably not a good starting point, but I do want to be sure; you can indeed execute PHP? Also, which version of PHP are you running?

Re: adding a PHP verification box to html forms how?

Posted: Fri Jul 24, 2009 1:20 am
by omniuni
offshoredevelopment,

reCAPTCHA is a great service, but it still requires a PHP script to process the submitted form.

Re: adding a PHP verification box to html forms how?

Posted: Mon Jul 27, 2009 2:25 pm
by techexpressinc
I am thinking i will have a iframe with in the HTML page with the PHP form.
Russ

Re: adding a PHP verification box to html forms how?

Posted: Mon Jul 27, 2009 5:32 pm
by omniuni
If you do actually have a PHP form, it's easiest to have it just submit to the same page. If you're wanting to obfuscate it with an iFrame, that won't really do anything other than bother your users.

Really, you just need to update your forms to use some very simple PHP, and you'll be good to go, and your pages will operate cleanly and without any odd hacks.

Oh, also, check your Devnetwork inbox (1 new message, or something like that) at the top of your page when you're logged in.