home *** CD-ROM | disk | FTP | other *** search
- program get;
- {
- get version 1.06.
- get is a demonstration CGI script supplied with vqServer.
- get is written in Borland Pascal version 7.
- get.exe runs on MS-DOS systems only.
- get and vqServer are copyright vqSoft and Steve Shering 1997-98.
- }
- uses
- dos;
-
-
- const
- endfield='=';
- enddata='&';
-
- var
- querystring:string;
-
- tnf:integer;
- tfield:array[1..10]of string;
- tdata:array[1..10]of string;
-
- fname:string;
- fnum:longint;
- fref:text;
-
- chrsread:integer;
- datalength:integer;
-
- i:integer;
-
- year,month,day,dow,hour,min,sec,sec100:word;
-
-
- function strof(tnum:longint):string;
- var
- tstr:string;
- begin
- str(tnum,tstr);
- strof:=tstr;
- end;
-
- function numof(tstr:string):integer;
- var
- tnum:integer;
- errcode:integer;
- begin
- val(tstr,tnum,errcode);
- numof:=tnum;
- end;
-
- function readchar:char;
- var
- tchar:char;
- begin
- if chrsread<datalength then
- begin
- chrsread:=chrsread+1;
- tchar:=querystring[chrsread];
- end
- else
- tchar:=chr(0);
- readchar:=tchar;
- end;
-
- function readword(endchar:char):string;
- var
- done:boolean;
- tword:string;
- i1:char;
- begin
- done:=false;
- tword:='';
- while (not done) do
- begin
- i1:=readchar;
- if i1='%' then
- tword:=tword+chr(numof('$'+readchar+readchar))
- else if i1='+' then
- tword:=tword+' '
- else if (i1=endchar) or (i1=chr(0)) then
- done:=true
- else
- tword:=tword+i1;
- end;
- readword:=tword;
- end;
-
- procedure readpair(tpair:integer);
- begin
- tfield[tpair]:=readword(endfield);
- tdata[tpair]:=readword(enddata);
- end;
-
- procedure readdata;
- var
- datalengthstring:string;
- begin
- querystring:=getenv('query_string');
- datalength:=length(querystring);
- chrsread:=0;
- tnf:=0;
- while chrsread<datalength do
- begin
- tnf:=tnf+1;
- readpair(tnf);
- end;
- end;
-
- begin
-
- writeln('Content-type: text/html');
- writeln;
- writeln('<html>');
- writeln('<head>');
- writeln('<title>Demo CGI script (GET method)<TITLE>');
- writeln('</head>');
- writeln('<body bgcolor=#add8af>');
- writeln('<table border=0 cellspacing=0 cellpadding=2 cols=3 width=100%>');
- writeln('<tr>');
- writeln('<td valign=top>');
- writeln('<center>');
- writeln('<H1>Demo CGI script (GET method)</H1>');
- writeln('</center>');
- writeln('<P><HR></P>');
-
- readdata;
-
- writeln('<P>This is some of the information your browser sent.</p>');
- writeln('<LI>','Your name: ',getenv('REMOTE_HOST'),'</LI>');
- writeln('<LI>','Your IP address: ',getenv('REMOTE_ADDR'),'</LI>');
- writeln('<LI>','Bytes of data: ',getenv('CONTENT_LENGTH'),'</LI>');
-
- i:=1;
- writeln('<P>The following information was received by the server.</P>');
- while i<=tnf do
- begin
- writeln('<LI>',tfield[i],': ',tdata[i],'</LI>');
- i:=i+1;
- end;
-
- writeln('<P><hr></P>');
- writeln('<P>This page was generated by <i>get.exe</i> version 1.06.');
- writeln(' <i>get.exe</i> and <i>vq</i>Server are copyright © <i>vq</i>Soft and Steve Shering 1997-8.</p>');
- writeln('</td>');
- writeln('<td width=20></td>');
- writeln('<td valign=top width=150>');
- writeln('<A HREF=/index.html><IMG WIDTH=15 HEIGHT=15 BORDER=0 SRC=/vq/server/icons/utab.gif>Home page</A>');
- writeln('</td>');
- writeln('</tr>');
- writeln('</table>');
- writeln('</body>');
- writeln('</html>');
-
- end.