Jump to content

Recommended Posts

--------------------------------------------------------------------------------

 

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

Link to comment
https://forums.phpfreaks.com/topic/166991-how-to-add-a-php-verification-box/
Share on other sites

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

 

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

"

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 

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

 

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.