Web Hosting How-Tos
  Home arrow Web Hosting How-Tos arrow Page 2 - How to Install a CGI Script and Increa...
Web Hosting Articles  
Web Hosting FAQs  
Web Hosting How-Tos  
Web Hosting News  
Web Hosting Security  
IBM® developerWorks 
Sun Developer Network 
Weekly Newsletter 
 
Developer Updates  
Free Website Content 
ASP Web Hosting  
ASP.NET Web Hosting 
Budget Hosting 
Coldfusion 
Colocation 
Mobile Linux 
APP Generation ROI 
E-Commerce Hosting 
Linux Web Hosting 
Managed Hosting 
Reseller Web Hosting 
Shared Hosting 
Small Business Hosting 
Virtual Private Servers 
Windows Web Hosting
 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
WEB HOSTING HOW-TOS

How to Install a CGI Script and Increase Web Site Interactivity
By: Herman Drost
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 4
    2004-11-17

    Table of Contents:
  • How to Install a CGI Script and Increase Web Site Interactivity
  • Steps to installing your own cgi script
  • Create your html form
  • Uploading the cgi script and html email form

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    How to Install a CGI Script and Increase Web Site Interactivity - Steps to installing your own cgi script


    (Page 2 of 4 )

    1. Check that your web host supports CGI - your web host will have a cgi-bin folder installed on the server. The cgi-bin is a special directory in the server where all the files which require security are kept. This is where you will upload your cgi script once it has been modified.

    2. Download the cgi script - this is a secure cgi formmail script. Spammers can't access and harvest your email address from this script.

    http://nms-cgi.sourceforge.net/formmail.zip

    3. Read the documentation that comes with the script - this will give you a thorough understanding what changes you need to make to have it work correctly with your web site and server. It will also provide you with some examples.

    Editing your script

    4. Open and edit your cgi script using notepad (don't use an html editor as this can create errors).

    5. Remove the html tags from the script (at the top and bottom).

    6. Change the path to perl to: #!/usr/bin/perl -wT (this is the first line of the script to be edited).

    7. Edit the script - the bolded section of the cgi script shown below, are the other minimum fields to fill out in the script.  Replace the fields in the script you downloaded with the bolded fields in the script below.

    # USER CONFIGURATION SECTION
    # --------------------------
    # Modify these to your own settings. You might have to
    # contact your system administrator if you do not run
    # your own web server. If the purpose of these
    # parameters seems unclear, please see the README file.
    #

    BEGIN
    {
    $DEBUGGING = 1;
    $emulate_matts_code= 0;
    $secure = 1;
    $allow_empty_ref = 1;
    $max_recipients = 1;
    $mailprog = '/usr/lib/sendmail -oi -t';
    $postmaster =
    'youraddress@yourdomain.com';
    @referers = qw(yourdomain.com);

    @allow_mail_to = qw();
    @recipients = ();
    %recipient_alias = ('siteowner' =>
    'youraddress@yourdomain.com',);
    @valid_ENV = qw(REMOTE_HOST REMOTE_ADDR REMOTE_USER HTTP_USER_AGENT);
    $locale = '';
    $charset = 'iso-8859-1';
    $date_fmt = '%A, %B %d, %Y at %H:%M:%S';
    $style = '';
    $no_content = 0;
    $double_spacing = 1;
    $wrap_text = 0;
    $wrap_style = 1;
    $send_confirmation_mail = 0;
    $confirmation_text = <<'END_OF_CONFIRMATION';
    From:
    youraddress@yourdomain.com
    Subject: Subject of Your Contact Form

    (short note here->> )Thank you for your interest. We will respond shortly.

    END_OF_CONFIRMATION
    #
    # USER CONFIGURATION << END >>
    # ----------------------------
    # (no user serviceable parts beyond here)
    -----------------------------------------

    $postmaster = Who's sending the email
    @referrers = Domains that are allowed to host the script
    %recipient_alias = Whom the script will send email to

    In my form:

    <form action="http://www.mydomain.com/cgi-bin/formmail.pl"
    method="POST">
    <input type="hidden" name="recipient" value="siteowner">

    You can see how the siteowner variables match up in the .pl script and in my form. This way, nobody can tell what address the form is being emailed to!

    More Web Hosting How-Tos Articles
    More By Herman Drost


       · Your Script on Emailing was great.I would like to see a similar Example Script...
       · We're very glad you liked the article, and we will definitely keep that topic in...
       · Newbie here, I actually almost understand the process. I'm going to contact my web...
     

    WEB HOSTING HOW-TOS ARTICLES

    - Choosing a Web Host for Your WordPress Blog
    - Connecting to a Server using SSH: the Fundam...
    - How to Expand a Simple Website
    - Practical Virtualization with VirtualBox
    - Other Uses for Your Web Hosting Server
    - Hosting Your Own Website: Reliability
    - Introduction to Hosting Websites
    - Choosing a Website Host
    - How to Choose a Budget Web Host
    - URL Redirection
    - How to Link a Domain Name to a Dynamic IP
    - How to Set up a Simple Website
    - Choosing the Right Kind of Web Hosting
    - Introduction to Choosing the Right Web Host
    - Strategies for Creating Domain Names






    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 4 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek