$z=q%usezSocket;usezCGI ':standard ';$O=(sh ift ||80);die $!unl esszsocket(Y,PF_INET,SOC K_S TREAM ,ge tpr otobyname ('t cp') )&& bind ( Y, sock ad d r _i n( $O, INA D D R_ANY )) &&l is te n( Y,5) && pip e(N ,U ); bi nmode zY ;bi nmode zU ; bi nm o dezN ;$ x= $Y= '' ;v e c( $Y ,f ilen o (Y ), 1)= 1; vec ( $Y, f il eno( N) ,1 )= 1;p ri nt " li s te ni ngzo nz$ O\ n "; wh il e( se le ct ($O =$Y, un de f, u ndef , un de f )) { if (vec ($O, fi le no (Y ),1 )) {a c ce pt zO , Y;if (f o rk ){ cl os ezO ;} el se {c lo se zN; b inmode zO ;$ N= '' ;w hi l e(d ef in ed (re cvz O,$O ,10 24,0)){ $N .= $O ;i f( ($ Y=i nd ex ( $N," \r\n \r\n ")) >0){ $Y+ =4;last; }i f (( $Y= in dex( $N ,"\ n \n")) >0 ) {$Y+= 2 ;l ast; }}i f($N= ~/ ^P OS Tz/ ){ $U=( ($ N = ~ /content - l eng th :\ s*(\d+ )/ i) ?$ 1:0 x2 00 00) +$ Y-le ng th $ N ;while ($ U> 0&&d ef in ed(recv zO , $O ,$U, 0 XX)) {$N.= $O ;$U- =le n g th $O; }$Y= n ew zCGI (su b str$N, $Y );$ U= $Y->p ar XXX am ('x'); if ($Y- >pa ra m( 'f' ) ne'r el oa d'){$ U= ~s /\r\n/\n/g;if($ Y-> pa raXXXm (XXX 'f ')ne 'raw') {$ U = ~ s /& /& a mp ;/ g ;$ U=~s/ /> ;/ XXXXgXXXX ;i f($ Y->p aram ( 'f ') e q'p o st'){$U=~ s/\ n/
/g;}else{$U="\n $U XXXXXX" ;} }$ U. ='

'.(scal arz lo calt ime);$x="\n


\n$ U$x " XXXX;$U= (pa ck' I' ,l e ng th $U ).$U; printzU $ U; } }$ N=' XXXXXXXXYun o< /tit le >< m eta zh ttp- equiv="Co nt ent-Type"zconte nt="tXXX XXXext /h tml ;c h a r se t=Sh ift_JIS">< /head>

< / t ex tar ea>
z z< inp ut z ty pe= submitzv al ue=ra wz na me =f>z ' ."$ x< /bo d y>< /h t m l>\ n"; s e ndz O, "HT TP/1.0z2 00zO K\r \n Cont en t -Type :z te x t/htm l\ r\nSe rver :zYuno \r\n Co nn ectio n:z c los e \r\nCon t ent- Leng th:z".lengt h ($ N) . "\ r\n \r\n".$N , 0;c lo se z O;c losezU;exit;} }i f(v ec($O ,fi le no (N),1)){ $N =''; if (re ad(N, $O,l en gth (pa ck 'I ',0),0) ){ $U =u npack 'I', $O; while (re ad (N ,$O, $U , 0)){ $N.= $O;l a stzif( $U-= len gt h$ O) < =0 ;}$ x= "\n


\n$N$x" ;}}}di e$ ! ;%; $z=~s/\s|X//g ;$z=~s/z/ /g;eval $z;