procedure TForm1.IdHTTPServer1CommandGet(AThread: TIdPeerThread;
ARequestInfo: TIdHTTPRequestInfo; AResponseInfo: TIdHTTPResponseInfo);
var
sr:TSearchRec;
begin
if (Pos('
/login', LowerCase(aRequestInfo.Document)) = 1)
then
begin
aresponseinfo.ContentType:='
text/html';
if arequestinfo.Params.Values['
ParamName']='
'
then
begin
aresponseinfo.ContentText:='
<head><meta http-equiv="pragma" content="no-cache">'
+'
</head><html><body>
<form method="POST">
Name: <input type="text" Name="ParamName"</p>
'
+'
<input type="Submit" value="&Login"></p> </form></body></html>';
end
else
if arequestinfo.Params.Values['
ParamName']='
Passwort'
then
begin
aresponseinfo.ContentType:='
text/html';
AResponseinfo.ContentText:=
'
<html><head><META http-equiv="Content-Type" content="text/html; charset=UTF-8">'
+'
<title> Dateiliste </title></head><body><H1> Dateiliste </H1>'
+'
<hr color= "blue" />
<pre>' ;
//<pre>[url="/"][To Parent Directory][/url]
if FindFirst(extractfilepath(paramstr(0))+'
\*.*',$7f, sr) = 0
then
begin
repeat
if sr.Size> 0
then
AResponseinfo.ContentText:=AResponseinfo.ContentText+format('
%-20.20s%7s', [datetimetostr(FileDateToDateTime(sr.Time)),inttostr(sr.Size)])
+'
[url="/download/'+sr.
name+'
"]'+sr.
name+'
[/url]
' ;
until FindNext(sr) <> 0;
FindClose(sr);
AResponseinfo.ContentText:=AResponseinfo.ContentText+'
</pre><hr color= "blue" /></body></html>';
end;
exit;
end
else
aResponseInfo.ResponseNo := 403;
exit;
end;