« Avoiding the iWeb Sitename in the URL | Main | iWeb : Display date & time the page was updated »

dinsdag, 19 januari, 2010

Mailform with Captcha

I created a mailform with captcha.

Found the files to do so at White Hat Web Design with more information about creating captcha images with PHP at www.phpcaptcha.org.

General information about creating images with PHP at The Wizard and Google. And of course in the PHP Manual.

With a mailform from KPN I pieced together a mailform. You can see it here.

But the form didn't work on my Mac with Personal Webserver. The browser showed an Internal Server error.

So I decided to create a new form with the combined information from the links above to eliminate the error. And it worked.

Download the zip file

The zip file contains the mailform, the php file to create and test the security code and a PNG file used as background for the captcha image.

The only personal information you have to enter is your e-mail address as the recipient in the mailform.php file.

Edit the php file with a HTML Editor of your choice. Put it on the server and test it.

Mailform PHP

Note 1. When you use the form on your Mac with Personall Webserver, I found that MobileMe and Google will not accept the message. Therefore I use my e-mail address at my ISP. I reason that mailservers do not accept mail from unknown sources as a security measure. Since I'm in the domain of my ISP with a IP number in their range they probably trust me as a sender. Unsend/undelivered messages can be found here:

/private/var/spool/postfix/active/
/private/var/spool/postfix/defer/
/private/var/spool/postfix/deferred/

Note 2. It will not work on MobileMe. You need an external server with PHP. If you haven't one, I suggest you try the free webhosting package at www.000webhost.com.

Note 3. The enclosed files work as advertised. But as usual, I assume no responsibility.

Extra note for iWeb users : To display the mailform use the <iframe> HTML element and paste it in the HTML Snippet.

<iframe src="http://url/to/mailform.php" frameborder="0" width="634" height="550" scrolling="no"></iframe>

Posted by wyodor at 15:49.34
Edited on: woensdag, 03 februari, 2010 10:18.51
Categories: Design, Tutorials, Web