¼³Ä¡Çؼ »ç¿ëÇÏ´ø cgi °Ô½ÃÆÇ(¿Í¿ìº¸µå)À», ¸ù¶¥ ´Ù¿î¹Þ¾Æ¼
´Ù¸¥¼¹ö·Î ¿Å°å°Åµç¿ä.
¿¹»óÇÑ ¹ÙÁö¸¸.....¾ÈµÇ´Â±º¿ä.
Á¤·É ÀÌ°Ô ¾ÈµÇ´Â°É±î¿ä?
³»°¡ »ý°¢ÇصÎ...³Ñ ¹«¸ðÇß¾ú´ø°Í °°¾Æ¿©...
^^..
¹ÙÀ̳ʸ®·ç ´Ù¿î¹Þ¾Æ¼...¿Ã·È±¸.
±×..°æ·Î¸¦ º¸¸é...
-wowboard-upload
-theme
-log
-icons
-data-data
-config
-cgi-lib
-background
-board.cgi
-admin-cgi
-cgi-bin
-board.html
´ëÃæ¿ä·¸°Ô µÇÀÖ±¸.............
ÀÌ¿Õ ¿Ã¸°°Å...board.cgi µÎ....¾Æ·¡ ÀÌ¾î¼ ¿Ã¸±²²¿©..
²ÀÁ¡....¾Ë·ÁÁÖ¼¼¿©~~!!
¿õ..³Ñ °Ç¹æÁö°Ô..¸¹Àº°É ¿ä±¸ÇصÎ..ÀÌÇØÇØÁÖ¼¼¿©........¤Ð.¤Ð
±×·³ Áñ°Å¿î ÁÖ¸»~!
#!/usr/local/bin/perl
require './cgi-lib/cgi-lib.pl';
require './cgi-lib/wowlib.pl';
$message='onMouseOver="window.status=';
&getHash(\%gcfg,'./config/gconfig.cgi');
$cgi_lib'writefiles=($gcfg{updir}?$gcfg{updir}:'./upload');
$gcfg{maxup}=131072 unless $gcfg{maxup};
$cgi_lib'maxdata=$gcfg{maxup};
&ReadParse(\%in,\%cgi_cfn,\%cgi_ct,\%cgi_sfn);
$data_directory="http://www.kimjin-clinic.com/html/wowboard/data/data $in{'bd'}";
$idx_file="$data_directory/indexdb";
$ct_file="$data_directory/contentdb";
$head_file=(-e "$data_directory/head.html" ? "$data_directory/head.html" : 'http://www.kimjin-clinic.com/html/wowboard/config/head.html ');
$cfg_file=(-e "$data_directory/bdconfig.cgi" ? "$data_directory/bdconfig.cgi" : 'http://www.kimjin-clinic.com/html/wowboard/config/bdconfig.cgi ');
umask 000;
&getHash(\%gcfg,'./config/gconfig.cgi');
&getHash(\%cfg,$cfg_file);
$nav{fore}=$nav{back}='';
require ($cfg{'language'} eq 'kr'?'./config/locale.kr':'./config/locale.en');
$page=($cfg{'page'}+0?$cfg{'page'}+0:15);
$table_size=$cfg{'numsize'}*$cfg{'numshow'}+$cfg{'filesize'}*$cfg{'fileshow'}
+$cfg{'dcountsize'}*$cfg{'dcountshow'}+$cfg{'titlesize'}*$cfg{'titleshow'}
+$cfg{'countsize'}*$cfg{'countshow'}+$cfg{'datesize'}*$cfg{'dateshow'}+$cfg{'namesize'}*$cfg{'nameshow'};
if(($in{'j'} eq 'form')||($in{'j'} eq 'reply')||($in{'j'} eq 'fix')){&WriteForm;
}elsif($in{'j'} eq 'dl'){&Download('board');
}elsif($in{'j'} eq 'write'){&DataWrite;
}elsif($in{'j'} eq 'content'){&ShowContent;
}elsif($in{'j'} eq 'delete'){&DeleteForm;
}elsif($in{'j'} eq 'delete_ok'){&DeleteData;
}elsif($in{'j'} eq 'viewIndex'){&viewIndex;
}else{$in{'j'}='';&ShowBoard;}
exit;
sub WriteForm{
&Err_Msg_Back('Permission denied') if($cfg{'g_nowr'}+$cfg{'g_nore'}+$cfg{'g_nomd'}==3);
if(($in{'j'} eq 'reply')||($in{'j'} eq 'fix')){
&getIndex(\@indexes );
$inum=&findKey(\@indexes ,$in{'c'},$in{'i'});
&Err_Msg_Back('Data Not Found') if($inum<0);
dbmopen %ct_data,$ct_file,0444 or Err_Msg_Back("wowboard error:\\n$msg{'eOpen'}");
($id,$passwd,$email,$title,$date,$weekday,$thetime,$count,$dcount,$realname,$upname,$child,$thread)
=@ct_data{$indexes[$inum].'na',$indexes[$inum].'pa',$indexes[$inum].'em',$indexes[$inum].'ti',
$indexes[$inum].'da',$indexes[$inum].'we',$indexes[$inum].'tm',$indexes[$inum].'co',
$indexes[$inum].'do',$indexes[$inum].'re',$indexes[$inum].'up',
$indexes[$inum].'ch',$indexes[$inum].'th'};
}
$td_66ccff="
"; $emailval=" value='$email'"; $nameval=" value='$id'"; $content=''; if($in{'j'} eq 'reply'){ if(open(CFILE,"< $data_directory/".$ct_data{$indexes[$inum].'ct'})){ while(){ $content.='>'.$_; } close CFILE; } $content="$id wrote :\n$content"; if($title!~/^¢Ñ/){$title="¢Ñ $title";} $checked_mail=($email?'checked':''); if($gcfg{use_smail} eq 'yes'){ $print_mail=" " ."$msg{'smail'}: "; }else{ $print_mail=''; } $emailval=''; $nameval=''; }elsif($in{'j'} eq 'fix'){ if(open(CFILE,"< $data_directory/".$ct_data{$indexes[$inum].'ct'})){ while(){ $content.=$_; } close CFILE; } } if(($gcfg{updir})&&($cfg{'g_noup'}==0)){ $file_up_ok="$td_66ccff $msg{'file'}\n \n"; $enc_type=" enctype=\"multipart/form-data\""; } $col_size=int($table_size/7); $font=""; print &PrintHead; print < END } sub DeleteForm{ &Err_Msg_Back('Deleting permission denied') if($cfg{'g_norm'}==1); $font=""; print &PrintHead; print < END } sub DeleteData{ &LimitAccess; &Err_Msg_Back('Deleting permission denied') if($cfg{'g_norm'}==1); dbmopen %ct_data,$ct_file,0666 or Err_Msg_Back("wowboard error:\\n$msg{'eOpen'}"); &getIndex(\@indexes ); $inum=&findKey(\@indexes ,$in{'c'},$in{'i'}); &Err_Msg_Back('Data Not Found') if($inum<0); &Err_Msg_Back($msg{'undeletable'}) if($ct_data{$indexes[$inum].'ch'}>0); $passwd=crypt($in{'passwd'},substr($ct_data{$indexes[$inum].'pa'},0,2)); &Err_Msg_Back($msg{'ePasswd'}) if($passwd ne $ct_data{$indexes[$inum].'pa'}); unlink "$gcfg{updir}/".$ct_data{$indexes[$inum].'up'}; unlink "$data_directory/".$ct_data{$indexes[$inum].'ct'}; ($del_th,$del_ch)=@ct_data{$indexes[$inum].'th',$indexes[$inum].'ch'}; if($del_th){ for($i=$inum-1;$i>=0;$i--){ if($ct_data{$indexes[$i].'th'}==$del_th-1){ $ct_data{$indexes[$i].'ch'}--; last; } } } @indexes=(@indexes[0..($inum-1),($inum+1)..$#indexes]); &saveIndex(\@indexes ); delete $ct_data{$indexes[$inum].'na',$indexes[$inum].'pa',$indexes[$inum].'em', $indexes[$inum].'ti',$indexes[$inum].'da',$indexes[$inum].'we', $indexes[$inum].'tm',$indexes[$inum].'co',$indexes[$inum].'do',$indexes[$inum].'ct', $indexes[$inum].'re',$indexes[$inum].'up',$indexes[$inum].'ch',$indexes[$inum].'th'}; &Refresh("?kw=$in{'kw'}&bd=".&UrlEncode($in{'bd'})."&c=$in{'u'}"); } sub DataWrite{ &LimitAccess; &Err_Msg_Back('Permission denied') if($cfg{'g_nowr'}+$cfg{'g_nore'}+$cfg{'g_nomd'}==3); $in{'id'}=~s/^[ \t]+//o; $in{'id'}=~s/[ \t]+/ /g; $in{'id'}=~s/<\;/g; $in{'title'}=~s/^[ \t]+//o; $in{'title'}=~s/[ \t]+/ /g; $in{'title'}=~s/<\;/g; $in{'email'}=~s/[ \t]+//g; $in{'email'}=~s/<\;/g; $in{'content'}=~s/\t/ /g; &Err_Msg_Back($msg{'wTitle'}) if ($in{'title'} eq ''); &Err_Msg_Back($msg{'wContent'}) if ($in{'content'} eq ''); &Err_Msg_Back($msg{'wScript'}) if ($in{'content'} =~/<[sS][cC][rR][iI][pP][tT]/); local($sec,$min,$hour,$day,$mon,$year,$wday,@tmp)=localtime(time); $mon=$mon+1; $mon="0".$mon if($mon<10); $day="0".$day if($day<10); $hour="0".$hour if($hour<10); $min="0".$min if($min<10); $in{'content'}=~s/\r//g; &SendMail($in{'email'},$in{'saddr'}, "$in{'id'}".($in{'email'}?"($in{'email'})":'').$msg{'sReply'}, "$msg{'title'}: $in{'title'}\n\n$in{'content'}\n") if($in{'smail'} eq 'yes'); &getIndex(\@indexes ); dbmopen %ct_data,$ct_file,0666 or Err_Msg_Back("wowboard error:\\n$msg{'eOpen'}"); if($in{'fix'}){ $inum=&findKey(\@indexes ,$in{'c'},$in{'i'}); &Err_Msg_Back('Data Not Found') if($inum<0); $passwd=crypt($in{'passwd'},substr($ct_data{$indexes[$inum].'pa'},0,2)); &Err_Msg_Back($msg{'ePasswd'}) if($passwd ne $ct_data{$indexes[$inum].'pa'}); @ct_data{$indexes[$inum].'na',$indexes[$inum].'em',$indexes[$inum].'ti', $indexes[$inum].'da',$indexes[$inum].'we',$indexes[$inum].'tm'} =($in{'id'},$in{'email'},$in{'title'},"$year/$mon/$day",$wday,"$hour:$min:$sec"); if(open(CFILE,"> $data_directory/".$ct_data{$indexes[$inum].'ct'})){ print CFILE $in{'content'}; close CFILE; } &Refresh("?kw=".&UrlEncode($in{'kw'})."&bd=".&UrlEncode($in{'bd'})); exit; } $in{'passwd'}=($in{'passwd'}?crypt($in{'passwd'},chr(rand(25)+65).chr(rand(25)+65)):'*'); $upname=$cgi_cfn{'upfile'}; if(($upname ne '')&&($gcfg{updir})&&($cfg{'g_noup'}==0)&&(-s $cgi_sfn{'upfile'})){ $upname=~s/.+\\//g; $upname=~s/.+\///g; $upname=~s/\s/\_/g; $realname=$upname; $i=0; while(-e "$gcfg{updir}/$upname"){ $i++; $upname="$i\_$upname"; } if(open (SFILE, "< $cgi_sfn{'upfile'}")){ if(open (FILE, "> $gcfg{updir}/$upname")){ $buf=''; binmode(SFILE); binmode(FILE); while(read(SFILE,$buf,8192)){ print FILE $buf; } close(FILE); close(SFILE); }else{ close(SFILE); unlink "$cgi_sfn{'upfile'}"; &Err_Msg_Back($msg{'eSave'}); } }else{ unlink "$cgi_sfn{'upfile'}"; &Err_Msg_Back($msg{'eRead'}); } } unlink "$cgi_sfn{'upfile'}"; $new_filename=rand(99999999); while(-e "$data_directory/$new_filename.txt"){ $new_filename++; } $newindex=(sort {$b <=> $a} @indexes)[0]+1; if($in{'reply'}){ $inum=&findKey(\@indexes ,$in{'c'},$in{'i'}); &Err_Msg_Back('Data Not Found') if($inum<0); $ct_data{$indexes[$inum].'ch'}++; $thread=$ct_data{$indexes[$inum].'th'}+1; @indexes=(@indexes[0..$inum],$newindex,@indexes[$inum+1..$#indexes]); }else{ $thread=0; @indexes=($newindex,@indexes); } &saveIndex(\@indexes ); @ct_data{$newindex.'na',$newindex.'pa',$newindex.'em',$newindex.'ti',$newindex.'da', $newindex.'we',$newindex.'tm',$newindex.'co',$newindex.'do',$newindex.'ct', $newindex.'re',$newindex.'up',$newindex.'ch',$newindex.'th'} =($in{'id'},$in{'passwd'},$in{'email'},$in{'title'},"$year/$mon/$day",$wday, "$hour:$min:$sec",0,0,$new_filename.'.txt',$realname,$upname,0,$thread); if(open(CFILE,"> $data_directory/$new_filename.txt")){ print CFILE $in{'content'}; close CFILE; } &Refresh("?kw=".&UrlEncode($in{'kw'})."&bd=".&UrlEncode($in{'bd'})); } sub PrintHead{ return &PrintHeader ."\n
\°Ô½ÃÆÇ \n \n" .&ReadFilePrint($head_file) ."\\n"; } sub ShowBoard{ $image_dir=&checkIcon($cfg{icon}); local($total_data,$fore,$back,$total_line,$fp,$bp,$undeletable=1); local(@nums,@indexes,@idxs,@id,@email,@title,@date,@weekday,@realname,@upname,@count,@dcount,@thread); local @col1=('num','file','dcount','title','count','date','name'); local @col2=('size','tback','bback','tfore','bfore','show'); &fetchIndex('board'); $ttbgimage=($cfg{ttbgimg}?" background='background/$cfg{ttbgimg}'":''); $tbbgimage=($cfg{tbbgimg}?" background='background/$cfg{tbbgimg}'":''); local $print_str=&PrintHead; $print_str.=&print_table; $print_str.=&Button('board') if($cfg{'show_button'} ne 'none'); print "$print_str\