
//228ҳԴ

var HTML:string;
begin
HTML:='<HTML>';
HTML:=HTML+'<BODY>';
HTML:=HTML+'<H1>һ̬HTMLҳ</H1>';
HTML:=HTML+'<P>һISAPI͵Ķ̬ӿӡ</P>'
HTML:=HTML+'</BODY>';
HTML:=HTML+'</HTML>';
Response.Content:=HTML;
end;


//231ҳԴ

var HTML:string;
begin
HTML:='<HTML>';
HTML:=HTML+'<BODY>';
HTML:=HTML+'<H1>ǰںʱ:</H1>';
HTML:=HTML+DateTimetostr(now);
HTML:=HTML+'</BODY>';
HTML:=HTML+'</HTML>';
Response.Content:=HTML;
end;



//232-233ҳԴ

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>Web</title> </head>
<body bgcolor="#FFFFFF">
<h2 align="center">Web</h2>
<h3>û</h3>
<font size=-1><p>˵ISAPI̬ӿνû,ҸӦӦϢ</p>
<p>Ĵݲȷϡ</p>
<hr>
<p>õGET</p></font>
<form action="project3.dll/parsefile" method="get">
<font size=-1><p><input type="text" size="20" name="name"></p>
              <p>䣺<input type="text" size="20" name="age"></p>
              <p>Ա<input type="text" size="20" name="sex"></p>
              <p><input type="submit" value="ύ">
<input type="reset"></p>
</font></form>
<hr>
<font size=-1><p>õPOST</p>
<form action="project3.dll/parsefile" method="post">
              <p><input type="text" size="20" name="name"></p>
              <p>䣺<input type="text" size="20" name="age"></p>
              <p>Ա<input type="text" size="20" name="sex"></p>
              <p><input type="submit" value="ύ">
<input type="reset"></p>
</form></font>
</body>
</html>




//234ҳԴ

<html>
<head>
<title>лл!</title>
</head>
<body bgcolor="#ffffff">
<h1 align="center">WebûӦϢ</h1>
<h3>Ϣ</h3>
<hr>
<table border="0">
  <tr>
    <td></td>
    <td><#name></td>
  </tr>
  <tr>
    <td>䣺</td>
    <td><#age></td>
  </tr>
  <tr>
    <td>Ա</td>
    <td><#sex></td>
  </tr>
</table>
<h4>ллĺ!</h4>
</body>
</html>



//235ҳԴ

var
data:TStrings;
begin
data:=nil;
with request do
begin
case MethodType of
mtget:data:=queryfields;
mtpost:data:=ContentFields;
end;
replacetext:=data.Values(tagstring);
end;



//238ҳԴ

<html>
<head>
<title>ʾݱ</title></head>
<body>
<center>
<h1><font color="#ff0000">һʾݱ</font></h1>
</center>
<!--header.htm ends here-->


<!--note:footer.htm begins here-->
<hr>
<p>thank you</p>
</body>
</html>
<!--footer.htm ends here-->



//239ҳԴ

begin
with datasettableproducer1 do
begin
caption:='<h1>ݱemployee.db </h1>';
caption:alignment:=catop;
dataset.Open;
response.Content:=datasettableproducer1.content;
dataset.close;
end;
end;



//240ҳԴ

select master."symbol" as symbol,
  master."rcmndation" as recommend,
  industry."ind_name" as industry
from "master.DBF"master,"industry.DBF"industry
where (master.industry=industry.ind_code)and
((master."risk"=:risk)and(master."rating"=:rate))
order by industry."ind_name"



//240-241ҳԴ

begin
with querytableproducer1 do
begin
caption:='stock recommendations';
//ñͷ
header.add('<html>');
header.add('<body>');
//ñβ
footer.add('</body>');
footer.add('</html>');
//Query1ؼ
query:=query1;
query.open;
response.Content:=querytableproducer1.content;
query.Close;
end;
end;



//241ҳԴ

begin
//ȡֵΪbuy,ɫΪɫ
if celldata='BUY' then bgcolor:='green'
//ȡֵΪsell,ɫΪɫ
else if celldata='SELL' then bgcolor:='red'
//ȡֵΪhold,ɫΪɫ
else if celldata='HOLD' then bgcolor:='white';
end;



//241-242ҳԴ

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>ISAPI DLL</title>
</head>
<body bgcolor="#ffffff">
<h1>ISAPI DLL</h1> 
<h2>ʾѯ</h2> 
<p>ӽISAPI DLLضݱĲѯ</p> 
<form action="project5.dll/querytable" method="post"> 
    <p>Rate:<select name="Rate" size="1"> 
        <option>A</option> 
        <option>B</option> 
        <option>C</option> 
    </select></p> 
    <p>Risk:<select name="Risk" size="1"> 
        <option>LOW</option> 
        <option>MED</option> 
        <option>HIGH</option> 
    </select></p>  
     
    <P><input type="submit"><input type="reset"></p> 
</form>
</body>
</html>



//243ҳԴ

  writeln('HTTP/1.0 200 OK');
  writeln('CONTENT-TYPE:TEXT/HTML');
  writeln;
  writeln('<html><head>');
  writeln('<title>ǰʱ</title>');
  writeln('</head><body>');
  writeln('<h1>ϵĵǰʱΪ</h1>');
  writeln('<hr>');
  writeln('<h4>');
  writeln(formatdatetime('"" dddd,mmmm d,yyyy,'
+'"<br>ǰʱ "hh:mm:ss AM/PM',now));
  writeln('</h4>');
  writeln('<hr>');
  writeln('<i>ҳCgiDate.exe</i>');
  writeln('</body></html>');



//244ҳԴ

<html>
<head>
<title>CGIҳ</title>
</head>
<body>
<a href="cgidate.exe">ǰʱ</a>
</body>
</html>




//245-246ҳԴ

<html>
<head>
<title>CGIݵ</title>
</head>
<body>
<a href="cgidate2.exe?time">ʾǰʱ</a><p>
<a href="cgidate2.exe?date">ʾǰ</a><p>
<a href="cgidate2.exe?both">ʾǰʱ</a><p>
<a href="cgidate2.exe?wrong"></a><p>
<a href="cgidate2.exe"></a><p>
</body>
</html>



//246-247ҳԴ

program cgidate2;
{$APPTYPE CONSOLE}
uses
  sysutils;
begin
  writeln('HTTP/1.0 200 OK');
  writeln('CONTENT-TYPE:TEXT/HTML');
  writeln;
  writeln('<html><head>');
  writeln('<title>ǰʱ</title>');
  writeln('</head><body>');
  writeln('<h1>ϵĵǰʱΪ</h1>');
  writeln('<hr>');
  writeln('<h4>');
  if paramcount>0 then
  begin
    if paramstr(1)='time' then
    writeln(formatdatetime('"ǰʱ "hh:mm:ss AM/PM',now))
    else if paramstr(1)='date' then
    writeln(formatdatetime('"" dddd,mmmm d,yyyy,'now))
    else if paramstr(1)='both' then
    writeln(formatdatetime('"" dddd,mmmm d,yyyy,'
+'"<br>ǰʱ "hh:mm:ss AM/PM',now))
    else
    writeln(',ЧĲ:'+paramstr(1)+'.');
  end
 else
   writeln('<,ûв.');
  writeln('</h4>');
  writeln('<hr>');
  writeln('<i>ҳCgiDate.exe</i>');
  writeln('</body></html>');
end.



//251ҳԴ

procedure TWebModule1.WebModule1WebActionItem1Action(Sender: TObject;
  Request: TWebRequest; Response: TWebResponse; var Handled: Boolean);
begin
  with DataSetTableProducer1 do begin
    Dataset.Open;
    Response.Content := Content;
    DataSet.Close
  end;
end;



//251ҳԴ

program Project1;

{$APPTYPE GUI}

uses
  WebBroker,
  CGIApp,
  Unit2 in 'Unit2.pas' {WebModule1: TWebModule};
{$R *.RES}
begin
  Application.Initialize;
  Application.CreateForm(TWebModule1, WebModule1);
  Application.Run;
end.
