How to Install a CGI Script and Increase Web Site Interactivity



Learn Web Hosting Help and Information on mps-web-hosting.com. How to Install a CGI Script and Increase Web Site Interactivity article will help answer your questions on Web Hosting Help and Information.We at mps-web-hosting.com specialize in Web Hosting Help and Information. Web Hosting Help and Information at mps-web-hosting.com provides the most up to date news and articles. If you have questions please do not hesitate to contact us.

You may have delayed cgi script installation due the
apparently complex process. Well, I avoided it also for
several years, however if you want to increase your web
site's interactivity it's a necessity to know how to do it.
It's not hard to learn and you don't have to be a
programmer.

What is CGI ?

Common Gateway Interface or CGI is a program that can
interact with an html form on your web site, and processes
the results on your server using a cgi script. The result
generated is a dynamic web page. The cgi script is written
in a language called PERL ('practical extraction and
reporting language').

Uses of CGI scripts

CGI scripts are most commonly used for creating user
interaction with a html form on your web site. Other uses
include: autoresponders, shopping carts, counters, mailing
list managers, ad management, surveys, polls, discussion
boards, content management, calendars and click tracking.

There are 100s of free cgi scripts that can be found on the
Net. Just do a search on Google for 'free cgi scripts' or
visit the resources at the end of this article.

We will create an html email form to collect the name,
email address and comments of subscribers using a secure
cgi formmail script. An automatic confirmation will be sent
and the results of the email form will be passed on to your
email address.

Steps to installing your own cgi script

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. The 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 changed 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:

method='POST'>


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!

8. Rename your cgi script - name your script something else
besides formmail (ie contactus.pl), as this is the most
common name people use. This will prevent spammers from
harvesting your email address.

9. Create your html form (contactus.htm).



Contact Us< itle><br /></head><br /><body bgcolor='#FFFFFF' text='#000000'><br /><form method='post' action='http://www.yourdomain.com/<br />cgi-bin/contactus.pl'><br /><input type=hidden name='recipient' value='siteowner'><br /><input type=hidden name='subject' value='Subscribe Me Please'><br /><input type=hidden name='required' value='fullname,email'><br /><input type=hidden name='redirect' value='http://www.yourdomainname.com hankyou.htm'><br />Full Name<br /><br /><input type=text name='fullname'><br /><br /><br />Email Address<br /><br /><input type=text name='email'><br /><br /><br /><br />Comments<br /><br /><textarea name='comments'>< extarea><br /><br /><br /><br /><br /><input type='submit' name='Submit' value='Submit'><br /></form><br /></body><br /></html><br /><br />10. Create a confirmation page (ie thankyou.htm) - this<br />will automatically thank people for filling in your form.<br />It can be a simple html page with the comments 'Thank you<br />for your interest. We will respond shortly'.<br /><br />Uploading the cgi script and html email form.<br /><br />Use your favorite FTP program for uploading to your server<br />(I use SmartFTP.com which you can download for free).<br /><br />11. Set permissions to 755 - in SmartFTP right click on the<br />script file you wish to upload, click on Properties/CHMOD<br />and set the permissions to 755.<br /><br />12. Upload the cgi script - there are two modes of<br />uploading, ASCII and Binary. Upload the cgi script<br />(contactus.pl) and any txt files in ASCII mode. Upload the<br />script to the cgi-bin folder. If you don't follow this you<br />will not be able to execute the script.<br /><br />13. Upload the html form and any image files like .jpg or<br />.gif in Binary mode.<br /><br />14. Test your cgi script by filling out the html email form<br />and submitting it. You should receive an immediate<br />confirmation.<br /><br />By adding interactivity to your web site using a cgi<br />script, you can expand the functions of your web site and<br />create a more interesting experience for your visitors.<br />This will keep them coming back and help you stay ahead of<br />your competitors.<br /><br />Resources<br /><br />Formmail script <br />http://nms-cgi.sourceforge.net/formmail.zip<br /><br />Free CGI scripts <br />Scriptarchive.com <br />Hotscripts.com<br />cgi-resources.com<br /><br /><p><br /><br /><a href='http://viper799.theverti1.hop.clickbank.net'>The Vertical Project.</a> - Why Increase Your Vertical Leap by 6-12 Inches, When You Can Double It?<br /><a href='http://viper799.adblastcom.hop.clickbank.net'>Email 2,900,000+ Recipients Daily!</a> - 100% Spam Free Targeted Bulk Email Service! Instantly Increase Your Sales by 1900% Guaranteed!<br /><br /> <script type="text/javascript"><!-- google_ad_client = "pub-2055326903527736"; google_ad_width = 336; google_ad_height = 280; google_ad_format = "336x280_as"; google_ad_type = "text_image"; google_ad_channel =""; google_color_border = "ffffff"; google_color_bg = "FFFFFF"; google_color_link = "1B82B6"; google_color_url = "666666"; google_color_text = "666666"; //--></script> <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script> <div class="itemtitle"><a href="http://feedproxy.google.com/~r/hostingnews/~3/NVNkxPDUtPA/" rel='nofollow'>07/13/2006 Hosting Industry News Briefing</a></div><div class="itemdescription">Here's your daily hosting industry news briefing for Thursday, July 13, 2006</div><br /> <br />Article Index: | <a href="http://www.mps-web-hosting.com/">1</a> | <a href="http://www.mps-web-hosting.com/indexpage/2/">2</a> | <a href="http://www.mps-web-hosting.com/indexpage/3/">3</a> | <a href="http://www.mps-web-hosting.com/indexpage/4/">4</a> | <a href="http://www.mps-web-hosting.com/indexpage/5/">5</a> | <a href="http://www.mps-web-hosting.com/indexpage/6/">6</a> | <a href="http://www.mps-web-hosting.com/indexpage/7/">7</a> | <a href="http://www.mps-web-hosting.com/indexpage/8/">8</a> | <a href="http://www.mps-web-hosting.com/indexpage/9/">9</a> | <a href="http://www.mps-web-hosting.com/indexpage/10/">10</a> | <a href="http://www.mps-web-hosting.com/indexpage/11/">11</a> | <a href="http://www.mps-web-hosting.com/indexpage/12/">12</a> | <a href="http://www.mps-web-hosting.com/indexpage/13/">13</a> | <a href="http://www.mps-web-hosting.com/indexpage/14/">14</a> | <a href="http://www.mps-web-hosting.com/indexpage/15/">15</a> | <a href="http://www.mps-web-hosting.com/indexpage/16/">16</a> | <a href="http://www.mps-web-hosting.com/indexpage/17/">17</a> | <a href="http://www.mps-web-hosting.com/indexpage/18/">18</a> | <a href="http://www.mps-web-hosting.com/indexpage/19/">19</a> | <a href="http://www.mps-web-hosting.com/indexpage/20/">20</a> | <a href="http://www.mps-web-hosting.com/indexpage/21/">21</a> | <a href="http://www.mps-web-hosting.com/indexpage/22/">22</a> | <a href="http://www.mps-web-hosting.com/indexpage/23/">23</a> | <a href="http://www.mps-web-hosting.com/indexpage/24/">24</a> | <a href="http://www.mps-web-hosting.com/indexpage/25/">25</a> | <a href="http://www.mps-web-hosting.com/indexpage/26/">26</a> | <a href="http://www.mps-web-hosting.com/indexpage/27/">27</a> | <a href="http://www.mps-web-hosting.com/indexpage/28/">28</a> | <a href="http://www.mps-web-hosting.com/indexpage/29/">29</a> | <a href="http://www.mps-web-hosting.com/indexpage/30/">30</a> | <a href="http://www.mps-web-hosting.com/indexpage/31/">31</a> </td> <td width="25%" valign="top"> <script type="text/javascript"> <!-- if (navigator.appName=="Netscape") { document.write ( '<span class=\"style34\">To bookmark How to Install a CGI Script and Increase Web Site Interactivity,<br /> click: ' +'<b>Bookmarks | Add bookmark</b> <br />' +'or press <b>Ctrl+D</b>.</span>' ) } else if (parseInt(navigator.appVersion)>3) { document.write ('' +'<a onMouseOver="self.status=\'Bookmark this site\'" ' +' onMouseOut="self.status=\'\'" ' +' href="javascript:window.external.AddFavorite' +'(\'http://www.acheat.com\',' +'\'How to Install a CGI Script and Increase Web Site Interactivity\')">' +'Bookmark this Page</a>.' ) } //--> </script> <br /><br /> <h2>More Articles:</h2><br /> 1. <a href="http://www.mps-web-hosting.com/info/wow-i-have-unlimited-bandwidth-26338.html">Wow, I Have Unlimited Bandwidth! By Michal Pleban</a> <br /> Chances are you have already seen hosting offers like this: unlimited bandwidth for $3 a month. If you haven't, you'll probably see it soon somewhere. It may be unlimited bandwidth, mailboxes, space or whatever; I titled this tutorial "unlimited bandwidth" because it's the most common option.Now you would be stupid not to sign up for this service, wouldn't you? Imagine that: UNLIMITED bandwidth. No matter how many visitors your site has, how popular it might become, you don't need to worry abo… <br /> <center> <script type="text/javascript"><!-- google_ad_client = "pub-2055326903527736"; google_ad_width = 160; google_ad_height = 600; google_ad_format = "160x600_as"; google_ad_type = "text"; google_ad_channel =""; google_color_border = "FFFFFF"; google_color_bg = "FFFFFF"; google_color_link = "1B82B6"; google_color_url = "666666"; google_color_text = "666666"; //--></script> <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script> </center> <br /> 2. <a href="http://www.mps-web-hosting.com/info/choosing-a-right-hosting-solution-104407.html">Choosing a right hosting solution</a> <br /> You have done all the hard works for developing your website but when it comes selecting your host you may face trouble that it does not have all the features which is required by your site. It is important to do some research before choosing a right hosting solution.A website is an important identity of yours and it is the responsibilities of the host make it visible at World Wide Web. Selecting the right solution for your business will provide greater impact on your business. before hiring any… <br /> <br /> 3. <a href="http://www.mps-web-hosting.com/info/how-much-bandwidth-does-your-104408.html">How much bandwidth does your web site need?</a> <br /> One of the most common concerns people have when deciding to host a web site is figuring out how much bandwidth they'll need. Get too little bandwidth and you might be hit with overage fees or have your web site shut off altogether. Get too much and you're paying for bandwidth that you don't really need. The following is a helpful guide for determining the amount of bandwidth that's right for your web site.Every time someone views a web page or downloads a file, bandwidth - also known as data tr… <br /> <br /> 4. <a href="http://www.mps-web-hosting.com/info/elements-of-web-hosting-104437.html">Elements of Web Hosting</a> <br /> When you first start out trying to get a site on the Internet everything seems so confusing. Obtuse acronyms flow freely through the 'Beginner Friendly' information sites and definitions can be hard to come across. The main reason for this is that the Internet and the process of getting a website online is really very simple, and once people get past the first stumbling steps they rarely remember the difficulty they once had, which leads to them being unable to understand the next wave of dot co… <br /> </td> </tr> </table> </div> <div id="footer"><table width="100%" border="0" cellspacing="0" cellpadding="4"> <tr> <td> </td> <td align="right"><font color="#ffffff">©mps-web-hosting.com</font></td> </tr> </table> </div> </div> </body> </html>