home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Spezial
/
SPEZIAL2_97.zip
/
SPEZIAL2_97.iso
/
ANWEND
/
DEVELOP
/
CGINB123
/
readme
< prev
Wrap
Text File
|
1997-10-07
|
9KB
|
267 lines
6 October 1997
CGI Notebook v1.23
It is assumed that you are the Webmaster administrating the server and
are already familiar with the HTML language tags and their uses. Also,
that you understand the operation of the OS/2 Warp environment and can
perform the described tasks in the documentation.
This software is provided on an "as-is" basis. I offer no warranty on this
software whatsoever, and you use it at your own risk.
This software is freeware so you may freely use and distribute it.
1. What is the CGI notebook?
The CGI Notebook is a CGI (Common Gate Interface) program which allows
you to ask users of your Web Pages for some information and records the
information to desired file. In addition, visitors of your site can view
the information if you allow it.
I wrote the program to help Webmasters which are not familiar with CGI
programming to record forms (<FORM> tag) data in a file. The Notebook
will help to make Guest Book, Registration Form and so on ...
2. System requirements.
OS/2 Warp 3 or later and Web Server software (e.g. Internet Connection
Server) installed on your computer.
3. Installation.
Archive cginb123.zip contains:
nb.exe - executable file
nb.cfg - notebook configuration file
nb.htm - example use of the Notebook
nb.rsp - response file
nb.snb - template file for viewing notebook data
readme - this file
NOTE:
----
If you use PlanetWide OS/2 Web Server you have to delete lines
Pragma: no-cache
Cache-Control: no-cache
Content-Type: text/html
from the beginning of files nb.rsp and nb.snb.
It is nesessary becouse Planet Wide OS/2 Web Server is not full CGI compliant.
ENDNOTE
-------
It is easy to install the Notebook.
Make directory /notebook inside /cgi-bin directory of your Web server,
then put files nb.exe, nb.cfg into /cgi-bin and nb.rsp, nb.snb into
/cgi-bin/notebook directory.
HTML file nb.htm contains an example of use the Notebook and you may
put the file whereever you want in your Web pages directories.
4. Using the Notebook.
4.1. Simple use.
Type URL http://yourhost/path_to_nb.htm/nb.htm in your browser.
You will see example of using the Notebook.
4.2. Normal use.
4.2.1. File nb.cfg - setting up notebooks.
First you have to describe a notebook in nb.cfg file.
The file contains a number of lines which describe different notebooks.
Format of nb.cfg file:
identificator1=notebookfile1,responsefile1,viewtemplate1,wrapwidth1
identificator2=notebookfile2,responsefile2,viewtemplate2,wrapwidth2
...
where
identificatorI - a key string to select the notebook
notebookfileI - file which data are stored in
responsefileI - file which is sent to remote after submitting
viewtemplateI - file which uses as a template for viewing
notebook data
wrapwidthI - decimal digit (0-256), to limit the line to wrapwidth
characters when viewing the notebook, 0 means no wrap.
Note: Format of lines in nb.cfg must be quite similar to above one.
No spaces and tabs are allowed.
Example of nb.cfg:
main=notebook/datafile,notebook/nb.rsp,notebook/nb.snb,64
Above line says that notebook "main" uses file "notebook/datafile" to record
data, file "notebook/nb.rsp" will be sent to remote after submitting and
file notebook/nb.snb will be used as template for view the notebook.
main = notebook/datafile , notebook/nb.rsp,notebook/nb.snb, 64
Above line is wrong because of spaces in it.
4.2.2. Recording data in a notebook
After describing a notebook in nb.cfg, you have to insert to your Web page
the <FORM> tag:
<FORM METHOD="POST" ACTION="/cgi-bin/nb">
<INPUT TYPE="hidden" NAME="notebookident" VALUE="main">
<!-- Your input elements here -->
<INPUT TYPE="submit" VALUE="Submit to the notebook"> <INPUT TYPE="reset" VALUE="Clear Note">
</FORM>
Values are:
notebookident - identificator of the notebook (see nb.cfg format)
If you use Russian language then you have to add line:
<INPUT TYPE="hidden" NAME="codepage" VALUE="ibm866">
in FORM tag.
codepage - ibm866, win1251 or koi8r for translation
beetwin cyrillic codepages. Set codepage which your
clients use.
If you use only English then don't insert codepage line in FORM tag
becouse if codepage variable is defined then the CGI notebook will use
Russian messages instead of English.
Inside the form you may insert any input elements.
Data are stored in the specified file ( notebookfileI in nb.cfg) in the
next format:
:START
Message from : remote_address
:name_of_input_element1
value_of_input_element1
:name_of_input_element2
value_of_input_element2
.......................
:END
4.2.3. Multiple notebooks support
File 'nb.cfg' and 'notebookident' are needed for handle a number of
different notebooks.
For example, you need 2 different notebooks. First notebook is Guestbook,
second is Notebook_for_Clients.
You can do it.
File nb.cfg should contains data like that:
Guestbook=notebook/guests,notebook/guests.rsp,notebook/nb.snb,64
Notebook_for_Clients=notebook/clients,notebook/clients.rsp,notebook/nb.snb,64
Then you write in your guest page:
<FORM METHOD="POST" ACTION="/cgi-bin/nb">
<INPUT TYPE="hidden" NAME="notebookident" VALUE="Guestbook">
<!-- Your input elements here -->
<INPUT TYPE="submit" VALUE="Submit to the notebook"> <INPUT TYPE="reset" VALUE="Clear Note">
</FORM>
and in clients page
<FORM METHOD="POST" ACTION="/cgi-bin/nb">
<INPUT TYPE="hidden" NAME="notebookident" VALUE="Notebook_for_Clients">
<!-- Your input elements here -->
<INPUT TYPE="submit" VALUE="Submit to the notebook"> <INPUT TYPE="reset" VALUE="Clear Note">
</FORM>
So you have 2 different notebooks.
First notebook:
ident = Guestbook
file to save data = notebook/guests
file to send to remote = notebook/guests.rsp
template to view the notebook = notebook/nb.snb
Second notebook:
ident = Notebook_for_Clients
file to save data = notebook/clients
file to send to remote = notebook/clients.rsp
template to view the notebook = notebook/nb.snb
4.2.4. Viewing data in notebook
Version 1.23 of the CGI notebook allow to view notebook data with Web
browser.
To view notebook data you have to insert next FORM tag in your Web page:
<FORM METHOD="POST" ACTION="/cgi-bin/nb">
<INPUT TYPE="hidden" NAME="notebookident" VALUE="view:main">
<INPUT TYPE="submit" VALUE="View the Notebook">
</FORM>
So you have to prepend identificator of a notebook to be viewed with 'view:'.
File nb.snb is a template which is used to show notebook data.
NOTE:
----
If you use Apache Web Server you have to replace
ACTION="/cgi-bin/nb"
with
ACTION="/cgi-bin/nb.exe"
ENDNOTE
-------
5. CGI Notebook Revisions.
v1.00 - first release, non public, has a great security bug
v1.01 - cyrillic codepage support added. Still non public.
Security bug not fixed.
v1.10 - security bug fixed. First version with nb.cfg.
v1.20 - View notebook feature added. Reverse DNS lookup added.
v1.21 - Added support for ICS and GoServer. Little changes in documentaion.
v1.22 - No changes in executables. Corrections in nb.rsp, nb.snb and readme.
Apache server support: note in documentation.
v1.23 - Little bug in view feature fixed. Added word wrap feature.
Changes in documentation. Format of nb.cfg is changed.
6. Acknowledgements.
Special thanks to Ted Romer, who has helped me in improving the CGI
Notebook.
7. Conclusion.
If you have ANY problems with the Notebook that I can help you with,
send me E-mail to
Vitali.Pelenyov@dpt.ustu.ru
or leave your message in my notebook:
http://194.226.228.11/eng/nb.htm
Latest version of the Notebook is available in my FTP archive
ftp://194.226.228.11/pub/os2/tcpip
Look for cginb???.zip.
My site is up from 4 to 11 GMT.
If you use the Notebook, send me some mail and let me know.
I would love to hear from you.
Sorry for any typos and bad grammar. I will gladly accept any corrections to
this short manual.
Vitali Pelenyov ( Vitali.Pelenyov@dpt.ustu.ru )