program log;
{$apptype console}
// je vous laisse l'adapter pour Linux :)
uses
windows, sysutils;
var
i:integer;
s:string;
p:pchar;
flog:textfile;
begin
assignfile(flog,'c:\temp\log.txt');
rewrite(flog);
WriteLn('Content-Type: text/html');
WriteLn('');
WriteLn('<html><head><title>Dump CGI</title></head><body>');
WriteLn('<h1>Dump CGI:</h1>');
WriteLn('<a href=#Parms>Paramètres du programme</a><br>');
WriteLn('<a href=#Query>Paramètres CGI</a><br>');
WriteLn('<a href=#Env>Variables d''environnement</a><br>');
WriteLn('<a href=#Info>Plus d''info</a><br>');
WriteLn('<hr>');
WriteLn('<a name=Parms><h2>ParamCount=',IntToStr(ParamCount),'</h2><ul>');
WriteLn(fLog,'ParamCount=',IntToStr(ParamCount));
for i:=0 to ParamCount do begin
WriteLn('<li>',ParamStr(i));
WriteLn(fLog,'-',ParamStr(i));
end;
// fichier en entrée
WriteLn(fLog,'Input :');
WriteLn('<h2>StdInput:</h2><ul>');
if Not Eof(Input) then begin
Read(Input,s);
WriteLn('<li>',s);
WriteLn(fLog,s);
end;
Writeln(fLog,'QUERY_STRING=',ParmString);
WriteLn('<a name=Env><h2>Variables d''environnement :</h2><ul>');
p:=GetEnvironmentStrings;
while StrLen(p)<>0 do begin
WriteLn('<li>',p);
WriteLn(fLog,':',p);
p:=strend(p);
inc(p);
end;
WriteLn('</ul><hr>');
WriteLn('<a name=Info><a href="http://www.multimania.com/tothpaul">');
WriteLn('plus d''info sur le CGI</a>');
WriteLn('</body></html>');
end.
|