unit main; 

{$mode objfpc}{$H+}

interface

uses
  Classes, SysUtils, FileUtil, LResources, SpiderCGI, SpiderUtils;

type

  { TDataModule1 }

  TDataModule1 = class(TDataModule)
    SpiderCGI1: TSpiderCGI;
    procedure DataModuleCreate(Sender: TObject);
    procedure SpiderCGI1Request(Sender: TObject; Request: TSpiderRequest;
      var Response: TSpiderResponse);
  private
    { private declarations }
  public
    { public declarations }
  end; 

var
  DataModule1: TDataModule1; 

implementation


{ TDataModule1 }

procedure TDataModule1.DataModuleCreate(Sender: TObject);
begin
  SpiderCGI1.Execute;
end;

procedure TDataModule1.SpiderCGI1Request(Sender: TObject;
  Request: TSpiderRequest; var Response: TSpiderResponse);
var
  Nome: String;
  Valor: String;
begin
  Nome := SpiderCGI1.Request.Form('nome');
  Valor := SpiderCGI1.Request.Form('valor');
  SpiderCGI1.Response.Add(Nome + ', o servidor disse que o quadrado de ' + Valor + ' vale ' +
                          IntToStr(StrToIntDef(Valor, 0) * StrToIntDef(Valor, 0)));
end;

initialization
  {$I main.lrs}


end.

