program fucka; uses dos; const EOLN=Chr(13)+Chr(10); HTML='Content-type: text/html'+EOLN+EOLN; var s,s_name,s_tag:string; a,I:integer; f:text; Err_Bool:boolean; function Replace(str,s1,s2:string):string; var i,x:integer; begin repeat x:=pos(s1,str); if x > 0 then str:=copy(str,1,pos(s1,str)-1)+s2+copy(str,pos(s1,str)+Length(s1),Length(str)); until x=0; Replace:=str; end; function LeadingZero(w:Word):string; var s:string; begin str(w:0,s); if length(s)=1 then s:='0'+s; LeadingZero:=s; end; function RetTime:string; var h,m,s,dum:Word; begin GetTime(h,m,s,dum); if h > 12 then h:=h-12; RetTime:=(LeadingZero(h)+':'+LeadingZero(m)+':'+LeadingZero(s)); end; function RetDate:string; var m,d,y,dum :Word; mm,dd,yy :string; begin GetDate(y,m,d,dum); str(y,yy);str(m,mm); RetDate:=mm+'/'+LeadingZero(d)+'/'+Copy(yy,3,5); end; function hexval(h:string):byte; var hx:integer;func:byte; begin if h='0' then func:=0;if h='1' then func:=1;if h='2' then func:=2;if h='3' then func:=3; if h='4' then func:=4;if h='5' then func:=5;if h='6' then func:=6;if h='7' then func:=7; if h='8' then func:=8;if h='9' then func:=9;if h='A' then func:=10; if h='B' then func:=11;if h='C' then func:=12;if h='D' then func:=13;if h='E' then func:=14; if h='F' then func:=15;hexval:=func; end; function hexdec(hex:string):longint; var hh : string[1]; func : longint; st,ed,bb : byte; begin func:=0; ed:=length(hex); for st:=1 to ed do begin hh:=copy(hex,st,1); bb:=hexval(hh); func:=(func*16)+bb; end; hexdec:=func; end; begin WriteLN(HTML); {Write To LOG File...} Assign(F, 'hits.log'); Append(F); { ***REMEMBER TO CREATE FILE ON SERVER*** } WriteLN(f, 'IP: ',GetEnv('REMOTE_HOST'),' DATE: ',RetDate,chr(9),' TIME: ',RetTime); WriteLN(f, ' -- ',GetEnv('QUERY_STRING')); Close(F); {Get Data...} s:=GetEnv('QUERY_STRING'); {Check for Errors in Data...} Err_Bool:=false; s_name:=Copy(s,pos('name=',s)+5,pos('&',s)-6); s_tag :=Copy(s,pos('tag=',s)+4,Length(s)); if ((s_name = '') or (s_tag = '')) then Err_Bool:=true; if pos('%3C',s_name) > 0 then Err_Bool:=true; if pos('%3E',s_tag ) > 0 then Err_Bool:=true; {FIX SHIT} While Pos('%',s_tag) > 0 Do Begin i:=HexDec(Copy(s_tag,pos('%',s_tag)+1,2)); s_tag:=Replace(s_tag,Copy(s_tag,pos('%',s_tag),3),Chr(i)); End; While Pos('%',s_name) > 0 Do Begin i:=HexDec(Copy(s_name,pos('%',s_name)+1,2)); s_name:=Replace(s_name,Copy(s_name,pos('%',s_name),3),Chr(i)); End; {Write To WALL-HTML File...} If Err_Bool=false then begin Assign(F, 'wall_r.htm'); Append(F); { ***REMEMBER TO CREATE FILE ON SERVER*** } Write(f,'[ ',RetDate,' ] - <',s_name,'> ',s_tag,'
',EOLN); Close(F); end else begin Assign(F, 'wall_r.htm'); Append(F); { ***REMEMBER TO CREATE FILE ON SERVER*** } Write(f,'',EOLN); Close(F); end; {Write out HTML...} if Err_Bool = true then begin WriteLN('
An Error has occurred !



'); WriteLN('Possible Errors:'); WriteLN('
  • One or more form''s were left BLANK.
  • '); WriteLN('
  • There was an attempt at "hacking" the page, by using HTML tags.
  • '); WriteLN( '
    '); { WriteLN('
  • '); WriteLN('
  • '); WriteLN('
  • '); } end else begin WriteLN('
    Thank You, ',GetEnv('REMOTE_ADDR'),'!
    '); end; end.