cloudy

Author Topic: Free Contact Form PHP Script with image captcha - OLD VERSION  (Read 40561 times)

0 Members and 1 Guest are viewing this topic.

Offline MCHALLIS

  • Posts: 2,102
  • Long Beach, WA USA
    • Weather for Long Beach, WA USA
Free Contact Form PHP Script with image captcha - OLD VERSION
« on: August 08, 2008, 04:23:53 PM »
I made a Free Contact Form PHP Script with image captcha
It includes a captcha with audio and a refresh feature.

You can see my contact form here
http://www.642weather.com/weather/contact_us.php

Features:
Tested code (has been running on several sites for several months with no problems)
XHTML Transitional compliant
Reloads form data and warns user if user forgets to fill out a field.
No need to press back button.
Optional redirect to home page after message sent
Validates syntax of email address (user@aol = bad, user@aol.com = good)
Use as a standalone page or incorporate into your site template
It can run on most any webserver as long as you have PHP installed, and GD support within PHP.
(see readme.txt inside the zip for full instructions)

Security:
It has very tight security, it stops all the spammer tricks I have found.
Filters all form inputs from html and other nasties.
Spamchecks email address input from common spammer tactics...
 prevents spammer forcing to:, cc:, bcc:, newlines, and other email injection attempts to spam the world
Make sure the form was posted from your approved host name only. (enable or disable with a setting)
E-mail message shows IP address and user agent (browser version) of user who contacted you

Captcha Image by www.phpcaptcha.org included (enable or disable with a setting)
# open-source free PHP CAPTCHA script
# Abstract background with multi colored, angled, and transparent text
# Arched lines through text
# Generates audible CAPTCHA files in wav format
# refresh button to reload captcha if you cannot read it.

This has been replaced with my new PHP version
Fast Secure Contact Form – PHP Script

http://www.fastsecurecontactform.com/download-php-script

Here is a sample contact email message: (my real ip has been masked for this post)
------------------------

Sent from Long Beach Weather contact form

To: Webmaster

From:
Mike Test
mike@somewebsite.com

Message:
This is a test to show what the email message looks like

Sent from (ip address): 68.118.xxx.xxx (68-118-xxx-xxx.dhcp.xxx.xxx.charter.com)
Coming from (referer): http://www.642weather.com/weather/contact_us.php
Using (user agent): Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9) Gecko/2008052906 Firefox/3.0
« Last Edit: September 13, 2010, 05:05:29 AM by MCHALLIS »

Offline Budgie

  • Martin
  • Global Moderator
  • Posts: 4,648
  • WML Station: WD00934 CWOP: CW7959
  • Isle of Lewis, Scotland
    • Hebrides-Weather
Re: Free Contact Form PHP Script with image captcha - contact.php
« Reply #1 on: August 08, 2008, 04:57:10 PM »
Thanks for reminding me Mike, I've been meaning to add this to my own site after running it on SCWN since that started.
A highly recommended addition to your site folks!!  :D

Edit: All up & running on both my weather & photos sites.  :thumbright:
« Last Edit: August 08, 2008, 07:41:41 PM by Budgie »

Offline drobbins

  • Posts: 1,596
  • Kentucky, USA
    • Cave Country Weather
Re: Free Contact Form PHP Script with image captcha - contact.php
« Reply #2 on: August 08, 2008, 08:59:04 PM »
WOW  - That was easy!

Offline MCHALLIS

  • Posts: 2,102
  • Long Beach, WA USA
    • Weather for Long Beach, WA USA
Re: Free Contact Form PHP Script with image captcha - contact.php
« Reply #3 on: August 09, 2008, 02:46:37 PM »
Did you know that spambots crawl over websites looking for email addresses, when they find one they add it to their database for junk email?

Problem:
If you publish your email on your web site, like in this example....
<a href="mailto:you@somewebsite.com" title="E-mail us">Contact Us</a>
... then your email will most definitely start getting lots of spam.
It is foolish to have your email address 'in plain site' on your websites, because harvesting them is one of the biggest ways that spammers get huge lists of email addresses to spam.

Solution:
Use my contact.php form so that your email address is completely concealed.

Another solution (although not as foolproof):
Use JavaScript to encrypt and hide your address from spam-bots.
http://www.dynamicdrive.com/emailriddler/

Offline MCHALLIS

  • Posts: 2,102
  • Long Beach, WA USA
    • Weather for Long Beach, WA USA
Re: Free Contact Form PHP Script with image captcha - contact.php
« Reply #4 on: August 09, 2008, 03:30:59 PM »
Current Version: 1.05  09-Aug-2008 Spelling correction in $welcome_intro, also shortened it a bit. (no other code changes)
Thanks niko  :)

Offline SandhurstWX

  • Ian
  • Posts: 375
  • Another satisfied WD user!
  • Royal County of Berkshire, UK
    • Sandhurst Weather
Re: Free Contact Form PHP Script with image captcha - contact.php
« Reply #5 on: August 10, 2008, 12:43:57 PM »
Mike,
What a useful script, and swiftly incorporated into my site. Many thanks to you and all who keep on coming up with all these useful scripts. :D

Offline NorCal Dan

  • -= Dan =-
  • Posts: 9,438
  • Davis Vue/iMac/Parallels/WinXP
  • Marysville, California
    • Skype @ KJ6RGX
    • Traveling RV Weather
Re: Free Contact Form PHP Script with image captcha - contact.php
« Reply #6 on: August 10, 2008, 02:46:41 PM »
Mike,
What a useful script, and swiftly incorporated into my site. Many thanks to you and all who keep on coming up with all these useful scripts. :D


Yes, very nice and easy to incorporate.  Thanks.

Offline kray1000

  • Posts: 248
  • Roanoke, VA (USA)
    • Roanoke Valley Weather
Re: Free Contact Form PHP Script with image captcha - contact.php
« Reply #7 on: August 10, 2008, 04:01:42 PM »
Working very nicely here as well.  Thanks, Mike. :thumbright:

P.S. -- Love the CAPS "decapitator"!  :wink:
Kevin Ray

Wireless VP2, Stardot NetCam, ImageSalsa 2.0.12, MovieSalsa, Nexstorm, WASP2, Skymet, VWS, WD 10.37Nb03

Offline MCHALLIS

  • Posts: 2,102
  • Long Beach, WA USA
    • Weather for Long Beach, WA USA
Re: Free Contact Form PHP Script with image captcha - contact.php
« Reply #8 on: August 10, 2008, 11:44:02 PM »
Updated today - Version: 1.06  10-Aug-2008 Now automatically adds numbered keys to the $contacts array for simpler contacts config
                           changed page title to 'Contact Us'
                           added version print tag into html source
                           added error message if "captcha_library not found"
                           added features by Kevin Reed at www.tnetweather.com: (Thanks Kevin)
                           Added HTML code to Pass Section 508 and WAI accessibility validation
                           Added meta tags (WAI Requirement)
                           Added labels for form elements (WAI Requirement)
                           Removed the table since is was not really needed.
                           Added fieldset/legend
                           Added CSS basics for the form to allow easier enhancement.
                           The entire form is now controlled by the the div id of contactform.
                           Some other small changes.
If upgrading to version 1.06 and are integrating into your website template...
follow step 4 of the readme.txt and be sure to add the css and meta tags to your html <head></head> section
« Last Edit: August 10, 2008, 11:53:57 PM by MCHALLIS »

Offline daveq

  • Posts: 3,098
  • Hollywood, MD
    • Hollywood - St. Mary's County, Maryland
Re: Free Contact Form PHP Script with image captcha - contact.php
« Reply #9 on: August 10, 2008, 11:45:12 PM »
Mike, works very well and easy to set up.  I linked mine from the footer 'Contact Us' instead of adding a button.  You guys never cease to amaze me.

Thanks.

--Dave

Yikes.  New version as I was typing.

Offline far_ken_beauty

  • Portland Bay Weather
  • Posts: 462
  • Portland, Victoria, Australia
    • Portland's weather
Re: Free Contact Form PHP Script with image captcha - contact.php
« Reply #10 on: August 11, 2008, 12:47:01 AM »
Yep. will be adding this. Well done.  :D

Offline MCHALLIS

  • Posts: 2,102
  • Long Beach, WA USA
    • Weather for Long Beach, WA USA
Re: Free Contact Form PHP Script with image captcha - contact.php
« Reply #11 on: August 12, 2008, 04:55:49 AM »
Updated today...
Current Version: Version: 1.07 - 11-Aug-2008 added features: checks for required mail and image PHP functions
                           fixed bug with truncated string when double quote in name or subject input
                           Better input string protection, new cleaner code input functions
                           renamed all included subroutines with ctf_ prefix so they will not conflict with other scripts
                           wordwrap email message text so lines are no longer than 70 characters
                           added ini_set sendmail_from, needed for some windows servers
                           this update is recommended for the bug fix and better security
If upgrading to version 1.06 or higher and are integrating into your website template...
follow step 4 of the readme.txt and be sure to add the css and meta tags to your html <head></head> section

Offline MCHALLIS

  • Posts: 2,102
  • Long Beach, WA USA
    • Weather for Long Beach, WA USA
Re: Free Contact Form PHP Script with image captcha - contact.php
« Reply #12 on: August 14, 2008, 02:01:42 AM »
Version: 1.08 - 13-Aug-2008
added a few settings for email message headers
few other small fixes

Offline NorCal Dan

  • -= Dan =-
  • Posts: 9,438
  • Davis Vue/iMac/Parallels/WinXP
  • Marysville, California
    • Skype @ KJ6RGX
    • Traveling RV Weather
Re: Free Contact Form PHP Script with image captcha - contact.php
« Reply #13 on: August 14, 2008, 02:32:42 AM »
I don't see the subject in the email I sent myself...I must have something setup wrong as none of my previous emails had the subject line in them...

Offline dafuser

  • Posts: 561
  • Granbury, Texas
    • Weather from the shores of Lake Granbury
Re: Free Contact Form PHP Script with image captcha - contact.php
« Reply #14 on: August 14, 2008, 02:54:10 AM »
I'm getting the following error when I test the contact.php script:

Warning: mail(): Bad parameters to mail() function, mail not sent. in /home/content/d/a/f/dafuser/html/wx/contact.php on line 394

Message Sent

Your message has been sent, thank you.

I'm guessing I have some part of the configuration wrong, but don't see what it is.
--
Thanks Les...
Microsoft Windows: Proof that P.T. Barnum was correct.

24 inch iMac 2.8GHz C2D, 4 GB Ram (OS X 10.7 Lion) Davis Vantage Vue

 

cumulus