The (unofficial) hk.super.net WWW FAQ

Maintained and posted to hk.super.net whenever necessary by John Blackburne

Questions

  1. How do I create World Wide Web pages ?
  2. How do I upload my pages to Supernet ?
  3. Does this means people will be able to access other files in my home directory ?
  4. How do I access my pages after I've uploaded them ?
  5. What does CGI/CGI-BIN stand for ?
  6. Can I write my own cgi programs for my pages and upload them myself ?
  7. Why not ?
  8. Are there any pre-instlled cgi programs I can use ?
  9. How can I find out who is/how many people are accessing my pages ?
  10. Does this mean anyone on Supernet can see who is accessing my pages ?
  11. How do I find out how many bytes of my WWW files are being transferred ?
  12. Can I write programs to update my files on a regular basis ?
  13. Can I use server side includes in my pages ?
  14. Are there any counters I can use in my pages ?
  15. Can I use frames/Chinese characters/Java/plugins etc. in my pages ?
This is a much much expanded version of this FAQ, which is now intended to be a fairly comprehensive distillation of most of the questions I've been asked or have answered about the Web in general and on Supernet in particular.

To keep it short and focussed I have deliberately left out anything that is well documented elsewhere. In particular, if you want to know more about HTML, forms, imagemaps, the common gateway interface and server side includes you can find detailed information on the Web - no, I don't have the URLs - while you can find out about unix commands such as chmod, rz, kermit, perl and cron by typing

  man <commandname>
at the unix prompt, where <commandname> is the command you are interested in. There are also good books on many of the above topics available from HK bookstores.

I've added so much to this in one go that almost certainly some of it is wrong. Feel free to mail me with any corrections, suggestions how it could be improved or request for what else you would like to see in it

1) How do I create World Wide Web pages ?

To create World Wide Web (WWW) pages you do not need any special software. WWW pages, technically called Hyper-Text Markup Language (HTML) files, are just specially formatted text documents, so you can use any text editor or word processor. There are also special programs to help you get started, as well as add-ons for many popular programs. Try looking on Supernet's ftp sites for HTML editors, translators and similar tools for your platform.

To learn how to create HTML files you should:

2) How do I upload my pages to Supernet ?

To put your pages online, you must first create a for them, called 'public_html', as a subdirectory of your home directory, either by dialing in and using the UNIX shell, telnetting in, or while connected over ftp.

You can now upload your files to this directory. There are two obvious ways to do this. The first way is to upoad them using kermit or z-modem from the command line, using the 'kermit' or 'rx' commands. In my experience neither of these is very user friendly or efficient. Easier is to FTP in to Supernet, using an FTP client over a SLIP or PPP connection. The main thing to remember here is to ftp to the server where your home directory is and which you telnet into, i.e. one of is1., is2. or is3..

The last thing you need to do is give people access to your files. To do this you need to make the files publicly readable, to open up your public_html directory so people can access files in there, and open up your home directory so people can get to your public_html directory. The following commands will do this for you.

  chmod 755 ~/public_html/*
  chmod 711 ~/public_html
  chmod 711 ~
If you are ftping in you can also use the SITE CHMOD command, or if your ftp browser supports it directly change the permissions of the files with a menu command. If you create directories within your public_html directory you can to use
  chmod 755 ~/public_html/*/*
To make all such files accessible.

If you upload more files at a later date you may need to repeat the first command to make the newly uploaded files publicly accessible.

3) Does this means people will be able to access other files in my home directory ?

It depends what files you have there and what their permissions are. The command
  chmod 711 ~
makes your home directory executable but not readable. This means other people cannot see what files are there, but if they know or can guess the name of a file or directory in your home directory they can access it if it is publicly readable. To prevent this you can use
  chmod 700 ~/file_name
for each file (or directory) you want to protect, to make the file or files specified readable only by you, or even use
  chmod 700 ~/*
To protect all of your files (use this before using the command to open up your public_html directory, or before you create it).

4) How do I access my pages after I've uploaded them ?

The URL of any page you upload is
  http://www.hk.super.net/~username/file_name.html
where username is your userID and CODE>file_name.html is the name of a file you uploaded. If you leave off the file name, e.g.
  http://www.hk.super.net/~username/
it looks for a default page called home.html, so this is a good name to use for the index or main page of your pages, or for the only page if you only upload one page.

5) What does CGI/CGI-BIN stand for ?

CGI stands for Common Gateway Interface, and is a way of interfacing programs to WWW servers and so to HTML pages. Such programs are usually used to provide user feedback or interactive capabilties on pages. They are also called cgi-bin programs, after the directory where they normally go.

6) Can I write my own cgi programs for my pages and upload them myself ?

No. For programs to run in response to users accessing your pages they must be in a certain directory, the cgi-bin directory. This directory is only accessible by Supernet's staff, so you cannot access it or upload files to it.

7) Why not ?

Supernet have not announced a policy on this, so I'm guessing a bit here, but here's what I think the reasons might be: Very few ISPs selling accounts to the public allow users to upload their own programs to the cgi-bin directory. There are alternatives to using cgi programs - see the answers to questions (8) and (12).

8) Are there any pre-instlled cgi programs I can use ?

Yes, there are two:

mailform.pl

This program is usseful for feeback forms and user resonse forms. It works by taking the output from a form, reformatting in an easily readable format and mailing it off to any address supplied. To use it use a FORM tag similar to the following:
  <FORM METHOD="POST"
    ACTION=="http:www.hk.super.net/cgi-bin/mailform.pl?johnb@hk.super.net">
Note how the e-mail address is part of the URL, while the method must be POST for it to work. You can examples on other peoples pages.

You can achive the same effect by specifying a mailto URL as the action, e.g.

  <FORM METHOD="POST" ACTION=="mailto:johnb@hk.super.net">
But this is only supported by some browsers and will only work if the user's web browser has been properly configured to connect to a mail server.

imagemap

This program does the work behind any clickable/sensitive images on Supernet's server. To use it you need to create an image and a imagemap (coordinate) file to go with it. The image can be any image that can be displayed on the Web, while the imagemap file is a text file specifying the 'hot spots' on the map, and which URLs they link to.

You can create this file by hand, or use a graphics program which understands the imagemap format. I use WebMap on the Mac to create these files, and then a text editor to tidy up the files it produces. Your imagemap files should be in NCSA format. Once you have created the file upload it you the same directory as your web pages.

Once you have both of these, include the image file into one or more of your Web pages, refering to it like this:

  <A HREF="/cgi-bin/imagemap/~johnb/mycoords"><IMG SRC="myimage.gif ISMAP></A>
The important things here are the word ISMAP, which tells the browser what to do with the map, and the file specification ~/johnb/mycoords. This tells the imagemap program where to find the coordinate file, and should include your user name and the path to the file in your public_html directory. The filename does not have to be the same as the filename of your imagemap file. Again there are examples on other people's pages.

It's now possible to use client-side imagemaps, which do not rely on the cgi-bin program and so are quicker and more user friendly. But these are new and are not supported by all browsers, so you should still create an imagemap coordinate file for use with the imagemap program.

9) How can I find out who is/how many people are accessing my pages ?

The Web server keeps a log of all accesses to it's files. This file can be found at:
  /hk/httpd/httpd_access_log
The easiest way to see who has accessed your pages is to type
  more /hk/httpd/httpd_access_log
This is not very practical though as the server is very busy and so this log gets very big very quickly, but it is a good place to start, just to quickly see what information is logged by the server. To see just those records of accesses to your files type
  perl -ne 'print if /~johnb\//' /hk/httpd/httpd_access_log
replacing johnb with your own login id. To save this data in a file rather than viewing it type
  perl -ne 'print if /~johnb\//' /hk/httpd/httpd_access_log > save_file
The log file only contains accesses for the day it is viewed, as it is removed at the end of each day and started again. Therefore any of the above will only provide details of accesses on the day you use them. To provide an accurate long term record you will either have to log on every day near midnight to use one of these, or use cron to install a program, either one you write yourself or one you download from the Web, to process the log on a regular basis.

You can also refer to my online records of accesses to individual's WWW pages, here and here. These pages are generated by QNDstat, which you might like to look at if you are interested in writing your own programs.

Note: none of the above programs work today as Supernet have hidden the http server access log. If the log reappears you may be able to use them on this server, and until then these techniques can be used on other servers.

10) Does this mean anyone on Supernet can see who is accessing my pages ?

Yes, anyone on Supernet can read the log can see who (or at least what IP addresses) are accesing your pages. This is a consequence of making the logs publicly available. If you want to avoid people knowing you have pages online you can set up another account with a different name, making sure the user ID and full name for this acccount are different from your own, then upload your WWW files to this account. Some Supernet users are already doing this.

Note: this is no longer a concern as Supernet have hidden the http server logs.

11) How do I find out how many bytes of my WWW files are being transferred ?

Type the following all on one line:
  perl -e 'while(<>){$t+=$1 if/ \/~johnb\/.* (\d+)$/}print $t' /hk/httpd/httpd_access_log
replacing johnb with your own account name. Again this only works on records in the current log, i.e. it only counts the number of bytes transferred today. You will want to write and install a more comprehensive program to count bytes transferred over a period longer than a day.

Note: the above doesn't work today as Supernet have hidden the http server access log. If the log reappears you may be able to use this on this server, and until then it can be used on other servers.

12) Can I write programs to update my files on a regular basis ?

Yes; my program QNDstat is one such program, as are my programs that run an is1 usage tracker. For example the following program will create a minimal page containing only the current date:
#!/usr/local/bin/perl
open (PAGE, "> ~/public_html/test_page.html");
print PAGE <<EOM;
<HTML>
<HEAD><TITLE>Test Page</TITLE>
</HEAD>
<BODY>
EOM
print PAGE `date`;
print PAGE <<EOM;
</BODY>
</HTML>
EOM
All you need is an idea of something to do and enough programming experience to carry it out. Once you have your program you can use cron to run it on a regular basis.

13) Can I use server side includes in my pages ?

No. Again I am guessing Supernet's policy here, but currently server side includes don't work and I very much doubt they will be enabled. Server side includes have some of the disadvantages of cgi programs, but also impose an additional performance burden because of the way they work.

Server side includes work by embedding commands within HTML files, with the server executing the commands and including the results in the file that it sends to the browser.

But to do this it must parse (i.e. read through and process) every file on the server that could contain server side includes, which in the worst case could be every page on the server. Multiply this by all the files and accesses on the server and you can imagine how this might effect performance.

As with cgi programs there are alternative ways to achieve the same results as server side includes.

14) Are there any counters I can use in my pages ?

Yes, there are quite a few. The easist way to find out about them is often to look for poges that contain them and either try copying the URL for the counter if it is simple or look on the site that contains the counter for information on how it works.

15) Can I use frames/Chinese characters/Java/plugins etc. in my pages

Yes, you can use any of these, and any other HTML or Web browser features, in your pages, as long as you have enough space online for the files. In most cases you can just create then upload the files with your HTML pages.

You might need to do one more thing if you upload a file that will be read by a browser plug-in. When the server delivers a file to a user it informs the user's browser what the MIME type of the file is, e.g. "text/html" for Web pages. To decide on the MIME type the server has a list mapping MIME types to file name suffixes, looking something like this:

text/html                      html
text/html                      htm
text/plain                     txt
image/gif                      gif
image/jpeg                     jpeg jpg jpe
video/mpeg                     mpeg mpg mpe
video/quicktime                qt mov    
video/x-msvideo                avi    
but with many more entries.

If you upload a file type that doesn't appear on this list, which is quite likely if you're using a new or unusual plugin, then the server won't be able to give it the right MIME type and browsers might not recognise the files and so might not use the correct plugin. If this happens you should mail HK Supernet's tech support, asking them to add the MIME information to the server's list, including both the MIME type and the file extension(s): this information should appear in the plugin's documentation.

© John Blackburne, johnb@hk.super.net, 8th July 1997


up to John's Home Page