Use these to jump around or read it all…
[You Must Be Able To…]
[Making a Directory For The CGI]
[Grab the CGI]
[Altering the Script For Your Server]
[Absolute Path]
[Turn On The CGI Directory]
[The HTML Directory]
[The BBS.html Page]
Go to the BBS Guestbook
Welcome back. Now that’s cool, huh? Follow me through this tutorial and you’ll be able to do just the same thing on your home page. First off, you need to be able to do a few things….
You Must Be Able To…
In order to do this, you must be able to do a few things with your Internet account. You must be able to:
- Gain access through telnet.
- Create directories.
- Change directory modification.
If you don’t know if you have these permissions, contact your system technician or just start following along. You’ll be told soon enough if something doesn’t jibe with the server.
So here we go…
Telnet (Click for a short tutorial regarding telnet)
For those of you who don’t know, “Telnet” is another way to attach to your Internet server. Using Telnet, you are attaching directly to the server “shell.” This is where you can enter commands that directly affect the UNIX settings.
When you signed up with your Internet Service Provider (ISP) you should have gotten a telnet program. If not, you still may be in luck. Windows-based computers have telnet programs already installed. In versions 3.x, it’s named “Terminal.” In W95, it’s named “Telnet.” Both can be found in the Accessories section.
Whatever telnet you are using, they all work the same way. Open the program, choose to connect, and type in your WWW address without the http://.
You’re good to go. Keep following along…
Making A Directory For The CGI To Use
First off, you will need to telnet into your server. Upon connecting, you will be asked for your user name and password. Put them in. Usually you will get a few welcome greeting messages and then a prompt of some sort will pop up. I have worked with seven different servers and the prompt has been different on all seven. It should look something like this:
telnet%
Does that look familiar? If not, don’t worry, you will see the blinking curser where you will enter information.
Your Public HTML Directory
When you send files over to your server, for them to be seen by the entire Internet community, you send the files to a directory. It has a name. You need to find that name. Most of the time the name is something like “public-html” or “www” or “default.”
For the sake of demonstration, we’ll say the directory’s name is WWW. That’s the shortest name and thus easiest to write a couple hundred more times. Depending on how your system is set up, you will either be in that directory when you telnet in, or you will be one above it. The smart money is that you are one above it. Type this at the prompt:
telnet% ls
(Please note, I am using “telnet% to represent the prompt. Your prompt may look different)
Hit return. You will get back a listing (that’s what “ls” means) of everything in that directory. If you see all the names of your HTML documents that Internet viewers can access, then you are already in the WWW directory. If you see the name of your Internet directory (I called it WWW above), then you are one above the directory. This is probably where most of you are. This is where I want you to be, one above your WWW directory.
You need to get one level above your WWW directory if you’re not already. Do that by typing this at the prompt:
telnet% cd .. (two dots)
“cd” stands for “change directory.” That’s what you just did. Now put in the “ls” command again and you should see your WWW directory.
Making the CGI Directory
This may already have been done for you. You should check that first. If when you typed one of the “ls” commands above you saw a cgi-bin, you need not do this.
Now you will need to create a special directory for your CGIs. No, they cannot sit where all the other files are located. Why will become clear in a moment. I suggest you name the directory you are about to create “cgi-bin” as that is what I am going to call it the rest of the way through this tutorial. Please notice that is a hyphen between the “cgi” and the “bin.” You will make the directory by typing this:
telnet% mkdir cgi-bin
If you get another prompt and no error messages, you did it. This is the first point at which you may be told you do not have the ability to place a CGI.
If you’d like to see your work, type this:
telnet% cd ls
You should see your cgi-bin. However, some servers are set up that as soon as you create a new directory, you are then put into it. I had a school server do this once. It’s actually helpful if you want to place files right away. If you do the list command above and see nothing, you’re probably in the directory you just created. Type this:
telnet% cd .. (those two dots again)
…and then this:
telnet% ls
You should see the new directory “cgi-bin.” Log out of telnet by typing “logout” at the prompt.
Grab the CGI
The CGI I am giving you here is the exact CGI I use on my system. The file is in text format. You need to save it to your hard drive as bbs.pl or bbs.cgi, depending on what format your server wants. I can’t answer that question. You’ll need to find out from your server’s technician which one is preferred.
Grab the Script
Altering the Script for Your Server
The process of creating this BBS page of e-mails is done almost totally in the CGI itself. You will need to open this CGI in a text editor and configure it for your server and your site. Make sure you only edit the CGI in a text editor that does not have margins! Use Notepad on an IBM and Simple Text on a MAC. If you want to use any other text editor, then turn off the word wrap function. Just moving margins to their widest setting is not enough. Lose them totally.
Let’s make some changes:
- Look at the first line: #!/usr/bin/perlThat is the path to PERL on your server. PERL is a big fancy program that will help run this CGI. It is required that you have the correct path to PERL here. What is on the CGI is the default path many servers use. Don’t expect yours does, too. Ask you server technician for the path to PERL. Write it in here.
- Look at the third line: $guestbook=”/directory/sub/sub/page.html”;That it the absolute path of the page that this CGI will create to post the e-mail messages. You need to offer the absolute path. A straight URL address won’t do. So, what’s an absolute path?
Absolute Path
This is a tough concept to grasp at first. Let’s say your home page URL has an address of:
http://www.server.com/~joe
http://www.server.com/names/men/tall/joe
Finding the Absolute Path
You’ll have to log back into telnet.
Follow the commands outlined above to once again get into the directory that contains your WWW files for the entire world to see. Do an ls command. You should see the cgi-bin sitting there. Now…
- Type pwd and hit Enter.
- What is sitting before you is the Absolute Path of that directory.
- Copy it down and enter it in the CGI, adding a slash and the name you want to give to the page that will contain the posted e-mail messages. For the sake of this tutorial, I’ll call that page “bbs.html.”
Log out of telnet.
Getting Back to the CGI
Open the CGI again in a text editor without margins and look down to the 4th line of text. It should look like this:
- $entriespage=”http://www.server.com/~joe/bbs.html”;This is the URL of the absolute path you found above. Basically, it will be your home page address followed by a slash and the name of the page you want the e-mails posted to. See that?
But why do I need to enter the same thing in two different formats?! Because that’s the way the CGI is set up. One posts the message, the other creates a link. They do different things, you see. - Now look at line 7: $maintainer=”user@emailaddress.com”;That’s where you put your address. Please make a point of keeping the backslash before the @ sign. If you remove that, the whole process stops.
That’s what needs to be altered for this to work. If you want, you can also go into other parts of the script and alter what is posted to the browser window. Look at the script under sub thank_you{.
That’s the text that pops up when someone sends a message. Change it to whatever you want. I would suggest you keep a clean copy of this CGI before messing too much with it. Losing just one little character will kill the whole deal real quick.
FTP the CGI
Whatever method you use for placing files on your server, use it now to transfer the bbs CGI to the cgi-bin directory. (Do not put the CGI in just any directory. It will not work anywhere but the cgi-bin.)
Transfer the file as ASCII. (Yes! I said ascii.)
Turn On The cgi-bin Directory
We’re getting close. Stay with me here. Log back in with telnet and get to the directory where you keep your WWW files. You should see the cgi-bin directory using an ls command. Now we’ll “turn on” the directory. Basically, what we are doing is setting the file’s modification instructions so the server knows that this directory can be written to, and read from, by other servers. Type this at the prompt:
telnet% chmod a+rx cgi-bin
If you get no error codes, success. You did it. If you did get an error code, try this instead:
telnet% chmod 775 cgi-bin
Sometimes that’s allowed but the other isn’t. If neither work, you don’t have the correct permissions. Talk to your server people to see if you can get them.
That done, we need to “turn on” the bbs CGI itself. At the prompt type:
telnet% cd cgi-bin (you just opened the directory)
then
telnet% chmod a+rx [cgi name]
Just put in the name you gave to the CGI. Again, if the a+rx doesn’t work, try 775.
The HTML Document
Remember when you went to see my BBS work? You entered the data into a “guestbook” sort of file. You need to have that for this CGI to work, and here it is:
Grab the Document
See this line:
<FORM ACTION=”/cgi-bin/bbs.cgi” method=post>
The BBS.html Page
You’re basically done. If everything is set correctly, then you will be able to log into your new page, fill out the elements, and get a bbs.html page created for all the world to see.
The problem is that this page fills quickly. It’ll get huge fast. And it will also happen that some idiot will post the “F” word or some other numbskull word thinking he or she is really cute. You’ll want to get rid of that, or empty the page now and again. Here’s how:
- Log into telnet. Use the above commands to get into your WWW pages directory. That’s where this bbs.html page is sitting.
- Type rm bbs.html [hit enter]
- Type touch bbs.html [hit enter]
- Type chmod a+rx bbs.html [hit enter]
(Use 775 in place of a+rx if it doesn’t work.)
What you just did was remove the bbs.html page and then replaced it with a page of the same name, but blank. You then “turned it on” again. Easy.
That’s It
Have fun. Now you can create BBS pages to your heart’s content. Just remember that these pages fill very, very quickly and must be kept up. I just hope mine doesn’t get too big that I have to take it down for sanity and space sake.
[You Must Be Able To…]
[Making a Directory For The CGI]
[Grab the CGI]
[Altering the Script For Your Server]
[Absolute Path]
[Turn On The CGI Directory]
[The HTML Directory]
[The BBS.html Page]