CGI Tutorials - logo

CGI Tutorials - Continued


bar



 
Now, suppose you have a guestbook. You want to do something with the data that your visitor enters. That is NOT included in the protocol described earlier.
You need a special program for these kinds of functions that provides interaction between your visitors (data) and your site.


CGI makes it interactive

This is done by so called "CGI-programs" or "scripts".
(CGI stands for Common Gateway Interface, but you may forget that again).

They are little programs, written in a special language (called Perl or C or C++, forget that too) and they reside on a specific place at your host called the CGI-bin directory.
(You can make directories on your host computer the same way you can do that on your own PC. This one should be provided by your host).

To make them work you have to "call" such a script from within your pages.
In our samples delivered with the download there's a guestbook. If you look at the code of the form that your visitor has to fill out, you'll see it starts with:

<FORM method="POST"
action=http://www.anownsite.com/cgi-bin/gbook.cgi>

The action-command specifies where the guestbook script is. It's on my site (www.anownsite.com) in the cgi-bin and the name of the program is gbook.cgi.

This action-command invokes that program and checks the information provided by the visitor, redirect him/her to a thank-you page and sends an Email to you. That's interaction.

Still with me? OK, we're nearly there.

CGI-programs are technical. You have to be a programmer and learn the special language Perl or C if you want to write them. If you do this and you are really good at it, boy, can you make a lot of money!

But most of us, myself included, we're just simple users. We do not know anything about programming. So we can't write CGI-programs.

But our technical colleagues who do write these programs have made a lot of them available for us, as a package, including a description how to install them. You can find the best resources for these programs in the Resource Page.

To install these packages you need some information.
Basically you need to know:
  1. where the Perl program on your host computer is located.
    You have to ask your host about that or search in their help pages. The script needs to know where Perl is so it can use it. In most cases it looks like this:
    #!/usr/bin/perl
  2. where your hosts Email program is. Same story here, ask your host. Example
    $mailprog = '/usr/bin/sendmail';
  3. the Unix-path to the script: this is the path from the server of your host to the program and looks like:
    /data1/hypermart.net/cgi-bin/gbook.cgi
  4. the URL of some page like this:
    http://ownsite.hypermart.net/gbook.html


If you try to install a script, do the following:
  1. FTP (transfer) the scripts that you prepared to the CGI-bin on your host computer;

  2. CHMOD the script and other necessary files.
    CHMOD means to allow access to the program.
    There are three access levels: read, write and execute.
    The CHMOD value is included in the help files.


Try some of the FREE scripts from the Resource Page if you like or find some help to have them installed.

Other examples of scripts are:
- Mailing Lists management for sending mails to your list of clients/prospects and to subscribe/unsubscribe;
- Tracking software for logfile analysis;
- Referral programs that let your visitor send a message about your site to a friend;
- surveys where you ask your visitor's opinion.

The script can store all data on your host where you can put it in a database for further handling.

We have a free referral script for you at
http://www.anownsite.com/free-cgi-script.html

Phew, am I glad I have this one done! Quite complicated eh?
Hope you understand something. Otherwise help is available at the Net. Try the Resource Pages or do a search in your favorite search engine for +CGI +tutorials.

At Hypermart you can host CGI-programs. At the Members Section there are many tools to FTP and CHMOD your files via your browser.

Other technical stuff is available in the form of Java.
It's a special language (again) that can perform special functions. Basically you have two options. One is included in your HTML as a script (Java Script) and the other one is to invoke Java programs (applets).
Using Java makes your site look COOL! It can do some nice tricks as:
- change color of your buttons as the mouse moves over;
- pop up new windows;
- currency conversion;
- little calculations.
Cool stuff, but Java takes capacity from your visitors computer. I do not use it a lot, but this will become more popular in future I guess.

OK, furthermore I need to mention:
- DHTML, the Dynamic version of HTML. I don't use it, but it's there so I mention it,
- Client side: this means every program or application that is on YOUR computer. You can run your Mailing List from your computer if you want that, but I always found this very slow;
- Server side: this means every program or application that is on your host's computer. Running a Mailing List server side is way much faster.

Well, that's all.
Hope it wasn't too complicated. I like to look around in scripts and change them to my needs (just copy and paste). But I realize it may not be the most interesting subject, but it needs to be told. It's there and you can use it. If you have technical help, you can talk about these topics now.
You can find excellent CGI information at
http://www.cgi-resources.com/.

If you can't solve problems just send an Email to:


Warm regards,
Case Stevens
Moderator

CGI Tutorials - Top of Page

Other interesting sites:
Internet Marketing Expertise


 
World Wide Web
Web Concept
Promotion
Email
Selling
Technics arrow
Testing
Make Money
E-commerce
Build it


An Own Site
Copyright © 2003 AnOwnSite. All rights reserved.