www.pudn.com > bbs3000afree.zip > bbs2.cgi


#!/usr/bin/perl 
#------------------------------------------------------# 
#¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡±¾³ÌÐòΪYuzi¹¤×÷ÊÒÌṩ¡¡  ¡¡¡¡¡¡¡¡¡¡# 
#¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡YuziÂÛ̳3000(BBS3000)v4.00¡¡¡¡¡¡¡¡¡¡¡¡# 
#------------------------------------------------------# 
$cgipa=".";  # CGI³ÌÐòÎļþµÄ¾ø¶Ô·¾¶ 
###################### 
## ÒÔϲ¿·Ö²»ÐèÐÞ¸Ä ## 
###################### 
require "$cgipa/setup.cgi"; 
&GetCookies; 
$cgiurl="bbs2.cgi"; 
########## 
if ($ENV{'REQUEST_METHOD'} eq "POST") { 
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); 
} 
else { 
$buffer = $ENV{'QUERY_STRING'}; 
} 
@pairs = split(/&/, $buffer); 
foreach $pair (@pairs) { 
($name, $value) = split(/=/, $pair); 
$value=~tr/+/ /; 
$value=~s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; 
$value=~s/\t/    /g; 
$value=~s/>/>/g; 
$value=~s//g; 
$value=~s///g; 
$FORM{$name} = $value; 
} 
########## 
$id=$FORM{'id'}; 
$see=$FORM{'see'}; 
$emote=$FORM{'emote'}; 
$username=$FORM{'username'}; 
$userpsd=$FORM{'userpsd'}; 
$titles=$FORM{'titles'}; 
$comment=$FORM{'comment'}; 
$search=$FORM{'search'}; 
$menu=$FORM{'menu'}; 
$replytime=$FORM{'replytime'}; 
$retitles=$FORM{'retitles'}; 
$deltitle=$FORM{'deltitle'}; 
$rdcomment=$FORM{'rdcomment'}; 
if ($username eq ""){$username=$Cookies{username}}; 
if ($userpsd eq ""){$userpsd=$Cookies{password}}; 
$id=~s/\.\.//g; 
$username=~s/\ //g; 
$username=~s/\¡¡//g; 
if($id=~m/[\#\&\*\=\+\\\:\"\/\<\>?'`ÿ]/){&errorview("IDÖв»Äܺ¬ÓÐÌØÊâ×Ö·û!");} 
if($username=~m/[\#\&\*\=\+\\\:\"\/\<\>?'`ÿ]/){&errorview("Ãû×ÖÖв»Äܺ¬ÓÐÌØÊâ×Ö·û!");} 
if($loginok eq "1" && $Cookies{username} eq ""){ 
print "Content-type: text/html\n\n";exit; 
} 
########## 
if (-d "$filepath/list/$id"){ 
open (CHAT,"$filepath/list/$id.cgi"); 
$line=; 
close(CHAT); 
($bzmc,$secret,$bzrmail,$outurl,$bbsname,$fbzmc2,$rtime,$htmlt,$htmlw,$jj,$fbzmc)=split(/\t/,$line); 
if ($Cookies{secret} ne $secret && $secret ne ""){print "Content-type: text/html\n\n";exit;}}else{&errorview("ϵͳ²»´æÔÚ´ËIDµÄÂÛ̳! ");} 
if($username ne ""){ 
$yhzlurl ="$filepath/yhzl/$username.cgi"; 
if($regok eq "0"){unless(-f $yhzlurl){ 
open(PSD,">$yhzlurl"); 
print PSD $userpsd."\t".$username."\t\t\t".$lasttime; 
close(PSD); 
chmod(0666,$yhzlurl);}} 
open(PSD,"$yhzlurl")||&errorview("¶Ô²»Æð£¬´ËÓû§Ãû»¹Ã»ÓÐ×¢²á!"); 
$liness=; 
close(PSD); 
($rdpassword,$rdname,$rdmail,$rdhome,$rlast,$rdqm,$rdsex,$rdwork,$rdcity,$rdlove,$rfy,$rhf,$tu,$jiao,$iewin,$QQ,$photo,$savecookie)=split(/\t/,$liness); 
if($rdpassword ne $userpsd){&errorview("¶Ô²»Æð£¬ÄúµÄÃÜÂë´íÎó!");}} 
if($bbsname eq ""){$bbsname="¹«¸æÀ¸";} 
if($FORM{'page'}){$page=$FORM{'page'};}else{$page =0;} 
if($menu eq "listtitle"){&listtitle;exit;} 
elsif($menu eq "findtitle"){&findtitle;exit;} 
elsif($menu eq "win"){&win;exit;} 
elsif($menu eq "deltitle"){do "$cgipa/sub/deltitle.cgi";exit;} 
elsif($menu eq "editform"){do "$cgipa/sub/editform.cgi";exit;} 
elsif($menu eq ""){ 
print "Content-type: text/html\n\n"; 
print < 
$bbsname 
 
 
 
EOF 
exit; 
} 
exit; 
########## 
sub listtitle{ 
&people; 
if ($username ne ""){ 
$counter ="$filepath/guest/2$username.cgi"; 
open(NUMBER,"$counter")||open(NUMBER,">$counter"); 
$NUMBER=; 
close(NUMBER); 
($lys,$oldlys,$money,$charm)=split(/\t/,$NUMBER); 
if ($lys>0){ 
$lytrue=1; 
open(NUMBER,">$counter"); 
print NUMBER "0"."\t"."$oldlys"."\t"."$money"."\t"."$charm"; 
close(NUMBER); 
}} 
if ((-z "$filepath/list/$id/bbs")&&($members > 9)){print "Content-type: text/html\n\n";exit;} 
open(TITLES,"$filepath/list/$id/bbs")||open(TITLES,">$filepath/list/$id/bbs"); 
@hastitles=; 
close(TITLES); 
$size=@hastitles; 
if ($size < 2){print "Content-type: text/html\n\nÕýÔÚ¸üÐÂË÷ÒýÎļþ...";exit;} 
$syy=$page-$perpage; 
&css; 
print <if(top==self)document.location='$cgiurl?id=$id'; 
$bbsname$htmlt 
< < < $bbsname > > >
EOF if ($lys<1){ print "ÎÒµÄÁôÑÔ²¾"; }else{ print "ÄúÓÐ $lys ÌõÐÂÁôÑÔ"; } print <ÔÚÏßÈËÊý: $people ÁôÑÔÊý: $size

ÇëʹÓà IE 5.X ÒÔ¼° 800*600 ·Ö±æÂÊä¯ÀÀ¡¡¡¡¡¡¡¡|  EOF if(($outurl ne "")&&($outurl ne "http://")){ print "·µ»ØÖ÷Ò³ "; }else{ print "·µ»ØÖ÷Ò³ ";} print <ǩдÁôÑÔ | Ãâ·ÑÉêÇë | Óû§×¢²á | ʹÓðïÖú |

EOF for ($i=$page; $i<$page+$perpage; $i++){ $hastitle=@hastitles[$i]; chomp($hastitle); open(TITLES,"$filepath/list/$id/$hastitle"); $m=; close(TITLES); ($rtitles,$rthistime,$rusername,$nr,$rfrom,$rhasreply,$emote,$lastname,$lasttime,$re,$rhassee)=split(/\t/,$m); if($Cookies{badname} ne $rusername){ if (length($rtitles) > 30) {$rtitles = substr($rtitles,0,30);$rtitles.="\...";} if (length($nr) > 1000) {$nr=~s/function(.+?)HTML´úÂëÈçÏÂ://isg;$nr=~s/<([^<])*>//g;$nr = substr($nr,0,1000);$nr.="\...";} unless($rhassee){$rhassee="0";} if ($NO_count <4) { $NO_count ++; } else { $NO_count =1; } print "
"; print "

" if ($NO_count==2); print "

" if (($NO_count==1) or ($NO_count==3)); print "

" if ($NO_count==4); if ($NO_count ==1){$bgcolor="#FFDD78";} if ($NO_count ==2){$bgcolor="#33CC99";} if ($NO_count ==3){$bgcolor="#66CCFF";} if ($NO_count ==4){$bgcolor="#FF99FF";} print <

   $rtitles
EOF if (-f "$filepath/yhzl/$rusername.cgi"){ open(PSD,"$filepath/yhzl/$rusername.cgi"); $lines=; close(PSD); chomp($lines); ($rpassword,$rname,$rmail,$rhome,$rlast,$rqm,$rsex,$rwork,$rcity,$rlove,$rfy,$rhf,$tu,$jiao,$iewin,$QQ,$photo,$savecookie,$levelname,$level)=split(/\t/,$lines); } print <¸´ÖÆÁôÑÔÄÚÈÝ¡¡½«±¾ÁôÑÔÄÚÈÝͨ¹ýEmail´ò°üÏÂÔØ¡¡¸ø$rusernameÁôÑÔ  EOF if(($rmail ne "")){ print "¸ø$rusername·¢ÐÅ¡¡"; } if(($rhome ne "")&&($rhome ne "http://")){ print "·ÃÎÊ$rusernameµÄÖ÷Ò³¡¡"; } if ($QQ ne ""){ print "$rusernameµÄQQºÅÂ룺$QQ¡¡"; } print <±à¼­ÁôÑÔ¡¡É¾³ý´ËÁôÑÔ
¡¡$rusername  -- $rthistime


$level

$nr


 ²é¿´$rusernameµÄ¸öÈË×ÊÁÏ

²é¿´$rusernameµÄIPµØÖ· EOF if($rcity eq ""){($ip1,$ip2,$ip3,$ip4)=split(/\./,$rfrom);$rfrom="$ip1.$ip2.$ip3.*";$rcity=$rfrom;} print <

EOF }} print <
BBS ·ç¸ñ ÌÖÂÛÇø·ç¸ñ ÁôÑÔ²¾·ç¸ñ

ËùÓÐʱ¼äΪ ±±¾©Ê±¼ä. ¸ñʽ: Äê-ÔÂ-ÈÕ.¡¡¡¡¡¡¡¡¡¡¡¡¡¡ EOF if($syy>-1){ print "| ÉÏÒ»Ò³ "; }else{ print "| ÉÏÒ»Ò³ "; } if(($size>$perpage)&&($i<$size)){ print "| ÏÂÒ»Ò³ "; }else{ print "| ÏÂÒ»Ò³ "; } print <·µ»Ø |


ÊäÈëÄúÒªËÑË÷µÄ×Ö·û
ÄúµÄÐÕÃû ÄúµÄÃÜÂë

$htmlw
±¾ÂÛ̳ÑÔÂÛ´¿Êô·¢±íÕ߸öÈËÒâ¼û£¬Óë $zyname Á¢³¡ÎÞ¹Ø
Ãâ·ÑÂÛ̳·þÎñÓÉ $zyname Ìṩ ¼¼ÊõÖ§³Ö£ºYuzi¹¤×÷ÊÒ
Yuzi Bulletin BoardTM Version $ver EOF exit; } ########## sub findtitle{ if($search eq ""){&errorview("ÊäÈëÄúÒªËÑË÷µÄ×Ö·û£¡");} if($Cookies{search} eq "" || $ENV{'HTTP_COOKIE'} eq ""){print "Content-type: text/html\n\nÕýÔÚËÑË÷...";exit;} print "Set-Cookie:search=\n"; opendir (MEMBERDIR, "$filepath/list/$id"); @hastitles = readdir(MEMBERDIR); closedir (MEMBERDIR); @hastitles=reverse @hastitles; $size=0; foreach $hastitle (@hastitles){ if(length($hastitle) eq "14"){ open(TITLES,"$filepath/list/$id/$hastitle"); $a=; close(TITLES);} if ($a =~ /$search/gi){ $size++; @hastitles[$size]="$a\n"; $a=""; }} &css; print <$bbsname$htmlt
< < < $bbsname > > >
ÎÒµÄÁôÑÔ²¾ ËÑË÷×Ö·û: $search ÕÒµ½Ïà¹ØÁôÑÔ: $size

ÇëʹÓà IE 5.X ÒÔ¼° 800*600 ·Ö±æÂÊä¯ÀÀ¡¡¡¡¡¡¡¡|  EOF if(($outurl ne "")&&($outurl ne "http://")){ print "·µ»ØÖ÷Ò³ "; }else{ print "·µ»ØÖ÷Ò³ ";} print <ǩдÁôÑÔ | Ãâ·ÑÉêÇë | Óû§×¢²á | ʹÓðïÖú |

EOF for ($i=$page; $i<$page+$perpage; $i++){ $hastitle=@hastitles[$i]; chomp($hastitle); if($hastitle ne ""){ ($rtitles,$rthistime,$rusername,$nr,$rfrom,$rhasreply,$emote,$lastname,$lasttime,$re,$rhassee,$jing,$index)=split(/\t/,$hastitle); if (length($nr) > 1000) {$nr=~s/function(.+?)HTML´úÂëÈçÏÂ://isg;$nr=~s/<([^<])*>//g;$nr = substr($nr,0,1000);$nr.="\...";} if($Cookies{badname} ne $rusername){ if ($NO_count <4) { $NO_count ++; } else { $NO_count =1; } print "
"; print "

" if ($NO_count==2); print "

" if (($NO_count==1) or ($NO_count==3)); print "

" if ($NO_count==4); if ($NO_count ==1){$bgcolor="#FFDD78";} if ($NO_count ==2){$bgcolor="#33CC99";} if ($NO_count ==3){$bgcolor="#66CCFF";} if ($NO_count ==4){$bgcolor="#FF99FF";} print <

   $rtitles
EOF if (-f "$filepath/yhzl/$rusername.cgi"){ open(PSD,"$filepath/yhzl/$rusername.cgi"); $lines=; close(PSD); chomp($lines); ($rpassword,$rname,$rmail,$rhome,$rlast,$rqm,$rsex,$rwork,$rcity,$rlove,$rfy,$rhf,$tu,$jiao,$iewin,$QQ,$photo,$savecookie,$levelname,$level)=split(/\t/,$lines); } print <¸´ÖÆÁôÑÔÄÚÈÝ¡¡½«±¾ÁôÑÔÄÚÈÝͨ¹ýEmail´ò°üÏÂÔØ¡¡¸ø$rusernameÁôÑÔ  EOF if(($rmail ne "")){ print "¸ø$rusername·¢ÐÅ¡¡"; } if(($rhome ne "")&&($rhome ne "http://")){ print "·ÃÎÊ$rusernameµÄÖ÷Ò³¡¡"; } if ($QQ ne ""){ print "$rusernameµÄQQºÅÂ룺$QQ¡¡"; } print <±à¼­ÁôÑÔ¡¡É¾³ý´ËÁôÑÔ
¡¡$rusername  -- $rthistime


$level

$nr


 ²é¿´$rusernameµÄ¸öÈË×ÊÁÏ

²é¿´$rusernameµÄIPµØÖ· EOF if($rcity eq ""){($ip1,$ip2,$ip3,$ip4)=split(/\./,$rfrom);$rfrom="$ip1.$ip2.$ip3.*";$rcity=$rfrom;} print <

EOF }}} print <
BBS ·ç¸ñ ÌÖÂÛÇø·ç¸ñ ÁôÑÔ²¾·ç¸ñ

ËùÓÐʱ¼äΪ ±±¾©Ê±¼ä. ¸ñʽ: Äê-ÔÂ-ÈÕ.¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ EOF if($syy>-1){ print "| ÉÏÒ»Ò³ "; }else{ print "| ÉÏÒ»Ò³ "; } if(($size>$perpage)&&($i<$size)){ print "| ÏÂÒ»Ò³"; }else{ print "| ÏÂÒ»Ò³"; } print <·µ»Ø |


ÊäÈëÄúÒªËÑË÷µÄ×Ö·û
ÄúµÄÐÕÃû ÄúµÄÃÜÂë

$htmlw
±¾ÂÛ̳ÑÔÂÛ´¿Êô·¢±íÕ߸öÈËÒâ¼û£¬Óë $zyname Á¢³¡ÎÞ¹Ø
Ãâ·ÑÂÛ̳·þÎñÓÉ $zyname Ìṩ ¼¼ÊõÖ§³Ö£ºYuzi¹¤×÷ÊÒ
Yuzi Bulletin BoardTM Version $ver EOF exit; } sub people{ if($Cookies{estate} eq "1"){$tu=estate;} $people=1; open (FILE,"$filepath/data/people.cgi"); @LINES=; close(FILE); $SIZE=@LINES; open (FILE,">$filepath/data/people.cgi"); for ($i=0;$i<$SIZE;$i++) { $_=$LINES[$i]; ($addr,$come_hour,$come_min,$come_sec,$olduser)=split(/\t/,$_); $flag=($hour-$come_hour)*3600+($min-$come_min)*60+($sec-$come_sec); if($addr eq $from && $olduser eq $Cookies{username}){ print FILE $from."\t".$hour."\t".$min."\t".$sec."\t".$Cookies{username}."\t$tu\t$bbsname\t$rtitles\t$cgiurl?$ENV{'QUERY_STRING'}\n"; $check=1; } elsif ($flag < $timepop && $flag > 0) { print FILE $_; $people++; }} if ($check == 0) { print FILE $from."\t".$hour."\t".$min."\t".$sec."\t".$Cookies{username}."\t$tu\t$bbsname\t$rtitles\t$cgiurl?$ENV{'QUERY_STRING'}\n"; } close (FILE); } ######################### END OF SCRIPT #########################