27 Dec '15

Anupa Manipal

A professional Software Developer in VB.NET - SQL Server and learner of PHP. Expertise in implementation of various projects including designing, development, coding and implementation of software applications.

21 Shares

CAPTCHA for SPAM Prevention

CAPTCHA for SPAM Prevention is a CGI script written in the Perl language, is based on the ideas of The CAPTCHA Project. It generates distored text that most humans can read, but computers cannot to prevent automated robots from submitting forms. Software similar to this is starting to become widely used throughout the Internet, and is currently in place on major websites such as Yahoo! to prevent automated sign-ups.

CAPTCHA for SPAM Prevention

CAPTCHA for SPAM Prevention

Project Name: CAPTCHA for SPAM Prevention

Front End: PHP

Back End: MySQL


Requirements

Before you can use FirstProductions Human Test, be sure that your web site passes the minimum requirements:

Web Server: You must have web space to store web pages on a Unix server (script not tested on Windows NT). If not, consider getting web space from FirstProductions Web Hosting, our web hosting service. FirstProductions Web Hosting fully supports the requirements of this script.
CGI-BIN: You must be able to run custom CGI scripts on your web server, such as in a CGI-BIN. Note that most free web hosting services do not allow this (such as GeoCities, Tripod, and America Online).
Perl: Perl 5.004 or later must be installed on the web server. We suggest ActiveState Perl for Windows servers.
GD.pm: GD.pm 2.01 or later (with PNG support) to interface with GD Graphics Library
Digest::MD5: Used for encryption. The script can easily be recoded to use a different encryption algorithm to avoid using this library, should you so desire.
CGI.pm: Not required for the Human Test library, only for the example script.
File Permissions: For Unix servers, you will need the ability to set and change file permissions, either through FTP or Telnet. This is also known as CHMOD.
FTP Access: You will need to have FTP access to the web directories on your server. FrontPage access only is not sufficient.


Installation: Step 1: Uncompress the Package

First, you will need to uncompress the software package using WinZip or similar unzipping software. You should have a directory tree similar to this:

CGI (directory)
|__captcha.pl
|__captchatest.cgi
DATA (directory)
|__codes.txt
|__images (directory)
|__(various PNG files)

Installation: Step 2: Configure the Script

First open captchatest.cgi (the example script) in main CGI directory. Be sure that the first line of the script matches the path to Perl for your server. The path to Perl is usually similar to: /usr/bin/perl or /usr/local/bin/perl. Be sure not to remove the #! before the path to Perl. If you are unsure of the path to Perl, contact your server administrator.

Next, open captcha.pl in a text editor. This is the Human Test library used by the example script. You can also use this library in your own scripts for easy access to the Human Test functions (generateCode and checkCode). Here is a guide to configuring the options in the Settings section:

  • captcha_datafolder should not be accessible by the web. It will be used to store the image files used by the script, as well as the database. Do not include a trailing slash.
  • captcha_database should not need to be modified unless you move or rename the codes.txt file.
  • captcha_imagesfolder should not need to be modified unless you move or rename the images folder in the DATA directory.
  • captcha_outputfolder will be used to store the outputted images from the script, and should be accessible from the web. This setting is the path to the folder on your web server. Do not include a trailing slash.
  • captcha_webfolder is the URL to the folder specified in the captcha_outputfolder setting. Do not include a trailing slash.

Installation: Step 3: Upload Files to Server

After configuring the script, create a folder in your “cgi-bin” for the files in the CGI directory. Upload the files in the CGI directory to your new folder on your web server in ASCII mode. Make thecaptchatest.cgi file executable by CHMODing it as 755. Next, create the web-accessible folder you configured captcha_webfolder, and give it appropriate permissions so the script will be able to write files to it. Then, create the captcha_datafolder you specified in the configuration section outside of your web-accessible folders. Give it write permissions and upload the files in the DATA directory to this folder. Give the codes.txt database write permissions.

Installation: Step 4: Testing the Script

Now that you have uploaded the files, it is time to see if it worked. In a web browser, navigate to the URL of the example script (captchatest.cgi). If there is an error, see the troubleshooting section of the documentation. If it works, go on to the Usage section.


Download project source code files:

download

About Anupa Manipal

A professional Software Developer in VB.NET - SQL Server and learner of PHP. Expertise in implementation of various projects including designing, development, coding and implementation of software applications.

Related Posts

Leave a Reply