• This repository has been archived on 19/Jul/2021
  • Stars
    star
    169
  • Rank 224,453 (Top 5 %)
  • Language
    PHP
  • License
    MIT License
  • Created about 11 years ago
  • Updated almost 7 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Bootstrap 3 Contact Form with Captcha

=======================

Bootstrap 3 Contact Form with Google's reCaptcha

Demo: http://jonmbake.github.io/bootstrap3-contact-form/

Blog Post: Bootstrap 3 Contact Form with Captcha

Follow-Up Blog Post: A Better Contact Form

=======================

A simple bootstrap 3 contact form using Google's reCAPTCHA. Submitted messages are sent to a specified email address using SMTP with support for SSL or TLS transport.

A Note On Security: PHPMailer, which this contact form is dependent on, had a major security vulnerability fixed in 5.2.20. It is recommended to update to 1.4.

Version History

Versions Major Enhancement
1.4.1 Bumped PHPMailer version to 5.2.21.
1.4 Add support for cURL when POSTing to verify reCAPTCHA.
1.3 Add support for Bootstrap Validator. If provided, will use it to validate contact form.
1.2 Replaced PHP SecureImage Captcha with Google's reCAPTCHA.
1.1 Used PHPMailer. Support for SSL/TLS transport. Extracted configuration values to environment variables.
1.0 First Version - Used PHP SecureImage and PHP mail function

Dependencies

PHP

HTML/JS

Setting up reCAPTCHA

You must obtain a Site Key and Secret Key from Google. The Site Key must be entered into the Contact Form HTML in the place of the text your_site_key. The Secret Key should be entered as a configuration value (see next section).

Note: Many web servers now force allow_url_fopen=0 and allow_url_include=0 due to security concerns (see: Issue 26). reCAPTCHA verifying will use cURL is if it is installed. If you are having issues verifying reCAPTCHA, most likely you need to install cURL.

Configuration

Configuration values to the contact form are passed in via Environment Variables. The following variables need to be defined:

Name Description
FEEDBACK_HOSTNAME Host name for SMTP server
FEEDBACK_EMAIL Email address to authenticate to SMTP server with
FEEDBACK_PASSWORD Password to authenticate to SMTP server with
FEEDBACK_ENCRYPTION If specified will use encryption. Valid values: TLS or SSL
RECAPTCHA_SECRET_KEY reCAPTCHA secret key.
FEEDBACK_SKIP_AUTH Optional If specified, will not authenticate with email/password

Environment variables can be specified in a variety of ways. For example, if using Apache (and mod_env is enabled), they can be specified in .htaccess:

SetEnv FEEDBACK_HOSTNAME smtp.gmail.com
SetEnv FEEDBACK_EMAIL [email protected]
SetEnv FEEDBACK_PASSWORD my!password!
SetEnv FEEDBACK_ENCRYPTION TLS
SetEnv RECAPTCHA_SECRET_KEY 7823skdgjksd828sjdgkn

Tip: Environment Variables are used in Sendmail.php. If you don't want to use Environment Variables, you can edit sendmail.php, replacing calls to #getenv with the corresponding configuration value like in this Example Gist.

What If I Don't Want CAPTCHA?

There's a branch for that! Check out the branch: Contact Form without CAPTCHA.

More Repositories

1

react-terminal-ui

A terminal react component with support for light and dark modes.
TypeScript
214
star
2

discourse-ldap-auth

Discourse plugin to enable LDAP/Active Directory authentication.
Ruby
70
star
3

textbox-revision-tracker

A jQuery plugin to track text revisions to HTML inputs or text areas.
JavaScript
15
star
4

gollum-easy-install

An Ansible playbook to install a secure, private Gollum wiki instance.
Ruby
8
star
5

router-security-checklist

A checklist to ensure you have the most secure router possible.
7
star
6

transcripts.io.src

Source transcript texts for https://transcripts.io
HTML
4
star
7

express-survey

A framework to quickly create surveys, written on top of Express.js.
JavaScript
4
star
8

reports-micro-service

A RESTful Java 8/Tomcat8 micro service for running Reports. Easily deployable to a AWS Elastic Beanstalk.
Java
4
star
9

askbot-slack

Simple Slack integration for Askbot. When a question, comment or answer is posted to Askbot, a specific Slack channel is sent a message..
Python
2
star
10

jonbake.com

Personal website: http://jonbake.com.
SCSS
2
star
11

person-activity-fit-diagnostic

The Person-Activity Fit Diagnostic test taken from the book The How of Happiness.
Mustache
2
star
12

pull-request-checklist

1
star
13

discourse-user-bulk-action

A simple ruby script for performing bulk actions (UPSERT, ACTIVATE or INACTIVATE) on a list of users.
Ruby
1
star
14

menu-hotkeys

Allow users to easily create hotkeys (keyboard shortcuts) to HTML menu items.
JavaScript
1
star
15

matomo-ansible

Provision a secure, personal Matomo instance with a single command.
1
star
16

jquery-html5-audioplayer

An jQuery plugin HTML5 audio player with keyboard shortcut controls.
JavaScript
1
star
17

react-calendar-full

A full-featured React calendar component with event scheduling and monthly, weekly, and daily views.
TypeScript
1
star