TLwebmgr README


TLwebmgr README file V:1.0.1
The web manager onsists of a series of modules. Each handles a single function group
and generates output which is either sent out as a web page, or as an email letter.
THERE IS AN EXCEPTION, TLlistmaster.py, whcih RECEIVES email replys. This is also
used in the EMAIL channel of control, so it kills 2 birds with one stone!

TLwebmgr.py generates a menu page. It reads all the info files, recording their names,
and the FIRST LINE ONLY of the info file. This is supposed to be a TERSE description of
the list. If the viewer wishes to read more, they click on the name of the list,
which is a html hotlink. This link is the name of the next script, with the name of
THAT LIST appended on the end after a single '?' mark. This tells the web server to
store everything AFTER that mark in a environment variable called QUERY_STRING.

When a program is run, it is handed a COPY of the environment, loaded with any special
values such as this one. This is how the next script knows what it is doing.

You must go into the script and edit the internal path declaration. This means the
operating system path, from root to the web cgi-bin.

Now CRITTER my server has several small domains in it, and one big one, my email
company. Therefore we do not simply stick our web pages into /www dir, but instead each
domain get's it's own setup UNDER /www dir. In the case of tinylist.org, this path is

/www/www.tinylist.org

and by normal convention, the WEB cgi-bin is right under it, in

/www/www.tinylist.org/cgi-bin

Which tells the script where it is, and where other scripts are at.

you want to also tell it who it is- that is, the name of your domain. This is rather
important. This is simply the bare name and name extension for your domain.

domainname=tinylist.org

Now the WEB dir is immediately above the web cgi-bin in normal practice, and is
automatically referred to by default. (hah! default my sorry arse. We define it in
the apache files for each domain.) if no path is declared after the domain name. The
WEB path for this site is

http://www.tinylist.org/

which ALL BY ITSELF gets a peek at the internal directory /www/www.tinylist.org/ and
as there is no file name specified, earns you the default page, which is 'index.html'.

Now remember, the web cgi-bin is immediately under the web directory, so the WEB path
to the script is

http;//www.tinylist.org/cgi-bin/TLwebmgr.py

including the actual name of the script to run. That is an ACTUAL complete and FUNCTIONAL
address to our menu script.

NOw, cgi is not quite as mysterious as it may apper- at least when you use the GET
method. If I wanted to talk to TLwebform2.py and ask it to tell me about the list
'tinylist-users', I could compost that URL above as:

http;//www.tinylist.org/cgi-bin/TLwebform2.py?tinylist-users

Simple enough. That is a REAL working url, it IS cgi, IT is one of many such formed by
the operation of the TLwebmgr.py script. Look at out list menu page. Put the mouse
pointer on the name of a list- the names are html hotlinks. LOOK AT THE BOTTOM OF THE
BROWSER. See the url? Down there in that bottom border frame, the (grey?) bar across the
bottom. see the small print appear? Move the mouse off the link. See it vanish? That is
good old html. HTML that was WRITTEN BY A ROBOT. In this case, TLwebmgr.py!

EVERYTHING after the first '?' in the URL is stored in an environment string called
QUERY_STRING that is available to THAT run of the program. EACH program runnign gets
it's won copy, so if another request also came in a mere millisecond later from someone
else talking about tinylist-devlopers list, there would be no confusion. THAT copy of
the program running in it's own space has it's own copy of the environment, and in it
is it's very own QUERY_STRING environment variable. Any output from the program that is
not SPECIFICALLY directed at a file is redirected by the web server back at the
connected browser, so a normal print statement will send output back to the screen on
your pc or Imac.

THAT, in a nutshell, is bare bones stupid CGI101 for abject idiots. Like me. TRUST ME, cgi
can get a HELL of a lot more complex and powerful than that, but this is a beginning.

OK. Now we want to look at the we manager menu. This is one level down in the tree in the
cgi-bin, and is TLwbmgr.py. So we use this url in the browser:

http://www.tinylist.org/cgi-bin/TLwebmgr.py

Now being wise, our apache is set up to permit cgi programs to run, this directory and the
programs in it have the X bit set (means eXecute=ok), and the permissions on the cgi-bin
dir itself also let ALL THE WORLD execute programs there (permissions are 755 for you un*x
sorcerers out there). So the webserver gets that url request, and it fires up the program
specified, and hands it a copy of the environment.

THE ENVIRONMENT is where the computer stores a BUNCH of things different things not only
reffered to by assorted programs, but by the operating system in it's operations as well.
The opsys and several programs want to look at it from time to time. Some of these are
CRITICAL to the operation of the operating system, and if mulched can CRASH THE
SYSTEM, or with more subtle and evil peversion, allow an intruder to TAKE CONTROL OF IT
FOR NEFARIOUS PURPOSES, like DOS attacks, ACCOUNT DELETION OR CREATION, SPAM runs, or
simply the ever popular STEALING CREDIT CARD INFORMATION. so we do not let casual program
access happen. Instead, the hand each program a COPY of it to play with as needed. (A
shell program can directly modify the environment. This is why shell scripts are a
REAL BAD THING to use as cgi programs. You COULD install subroutines INTENDED to filter
out evil data designed to capture control of your computer, but even then the risk is
simply too great. Python gets a COPY and does not have simple and direct access to the
REAL environment, where it could turn your server into a vegtable- or a slave.) 

IN THAT COPY, is THAT sesion's QUERY_STRING, loaded with out request for the information
all about 'tinylist-users', whatever that is.

At this point, the gentle reader is encvouraged to move on to the next readme,
'TLwebform2.README'.



This one will make your blood BOIL!
02


 

BACK

This file last modified Sunday January 13 2002 11 46 PM
ODD#X.XX.02/kdb/XXXXXX.shtml

Peace.