CodeGrape-Ajax-Contact-Form.jpg' alt='Download Contact Form Php Code' title='Download Contact Form Php Code' />This is a tutorial on creating a PHP contact form using jQuery and PHP for validating the input fields.New Start of Care Forms for Download.These forms are provided to assist you in completing the certain necessary documents.If you have any questions about a form or.Saving Form Data to Google Spreadsheets Using PHP and the Google Docs API.HTML contact form with CAPTCHAUsing a contact form on your website is very useful as it helps your web site visitors to communicate with you in an easy and simple way.But, there are spammers and hackers who are looking for exploitable web forms.It is essential to secure your form against all holes that those hackers are searching for.Contact form that emails based on a condition The form submission is sent conditionally to an address based on the selection in Query Type.Try the Demo Download.Note Using Simfatic Forms you can build awesome contact forms in minutes.No coding required.Drag and drop build the form and and get it online fast.Supports CAPTCHA.Download the Full Featured Version of Simfatic Forms here.How does the spammershackers exploit HTML forms Spammers exploit web forms for two purposes a As a relay for sending bulk unsolicited emails.If you are not validating your form fields on the serve side before sending the emails, then hackers can alter your email headers to send the bulk unsolicited emails.For example, hackers can place the following code in one of your form fields and make your form processor script send an email to an unintended recipient sendertheirdomain.ABcc New. Recipientanotherdomain.The code above is adding another email address to the CC list of the email.Spammers can send thousands of emails using this exploit.Your host will not be happy with this and may warn you or even ban your web site.The best way to prevent this spammer exploit is to validate the fields used in the mail functionfields like email, subject of the email, name etc.Check for the presence of any new line rn in those fields.For Sending spam messages to you.There are programs known as spam bots that leech through the web pages looking for web forms.When found, those bots just fills the fields with a spam message and submits.Eventually you will start getting many hundred submissions send by those spam bots and you will find it difficult to separate genuine submissions from spam messages.The solution for this problem is to use a mechanism to identify human submitters from bots.CAPTCHA is one of such tests.Adding Captcha to the form.Captcha is an image with a code written on it.The website visitor is required to read the code on the image and enter the value in a text field.If the word entered is wrong, the form submission is not processed.As CAPTCHA is a smartly blurred image, the spam bot cant read it.So the form cannot be auto submitted by a bot.The contact form with CAPTCHAHere is the HTML code for the contact form.POST namecontactform.SERVERPHPSELF. Name lt label.Email lt label. Message lt label.Enter the code above here lt label.Submit namesubmit.The HTML form above contains the fields for name, email and message.In addition, we have the CAPTCHA image.The lt img tag for the CAPTCHA image points to the script captchacodefile.The PHP script in captchacodefile.Validating the CAPTCHAWhen the form is submitted, we compare the value in the session variable6letterscode with the submitted CAPTCHA code the value in the text field 6letterscode.If the codes match, then we proceed with emailing the form submission.Else we display an error.Here is the code that does the server side processing. Office 2010 Retail Untouched Msdn License . POSTsubmit. SESSION6letterscode.SESSION6letterscode, POST6letterscode 0.Note the captcha code is compared case insensitively.The captcha code does not match.New form submission.SERVERREMOTEADDR SERVERREMOTEADDR.A user name submitted the contact form n.Name namen. Email visitoremail n.Message n. usermessagen.IP ipn. headers From from rn.Reply To visitoremail rn.Location thank you.Customizing the CAPTCHAThe CAPTCHA script in the sample code download can be customized.If you open the script, you can see the first few lines of the code as shown below.The characters that can be used in the CAPTCHA code.You can change the size of the CAPTCHA by changing imagewidth imageheight.The number of characters in the CAPTCHA can be changed by updating charactersonimage.Similarly, the text color of the CAPTCHA can be customized by updating captchatextcolor.The code adds some noise in the image by adding random lines and dots.Please note that increasing the noise may make it difficult for your genuine visitors to read the code.Download the code.Click here to download html contact form captcha.Reference. The above captcha code is based on the code developed by Simon Jarvis http www.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |