📄 search.cgi
字号:
#!/usr/bin/perl
#------------------------------------------------------#
# 本程序为Yuzi工作室提供 #
# Yuzi论坛3000(BBS3000)v4.00 #
#------------------------------------------------------#
$cgipa="."; # CGI程序文件的绝对路径
######################
## 以下部分不需修改 ##
######################
require "$cgipa/setup.cgi";
&GetCookies;
##########
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/<!--(.|\n)*-->//g;
$value=~s/\t/ /g;
$value=~s/>/>/g;
$value=~s/</</g;
$value=~s/\.\.//g;
$FORM{$name} = $value;
}
$username=$Cookies{username};
$userpsd=$Cookies{password};
##########
$menu=$FORM{'menu'};
$add=$FORM{'add'};
$ftime=$FORM{'ftime'};
$id=$FORM{'id'};
if($menu eq "add"){&add;exit;}
if($menu eq "del"){&del;exit;}
if($menu eq "index"){&index;exit;}
##########
open(ROOM,"$filepath/data/list.cgi");
@lines=<ROOM>;
close(ROOM);
&css;
print <<EOF;
<BODY background=$imagurl/bg.gif><CENTER><TABLE width="90%" border=0><TBODY><tr><TD align=center><IMG src=$imagurl/bbtitle5.gif></TD></FONT><TD align=middle><b><font size=4 color=$bgcolor0>搜索资料</font></b><BR><FONT size=1><ACRONYM title=编辑您的个人信息><a href="yhxiu.cgi"><IMG src="$imagurl/top_profile.gif" border=0></a></ACRONYM> <ACRONYM title=免费注册为新会员><a href="yhreg.cgi"><IMG src="$imagurl/top_register.gif" border=0></a></ACRONYM> <ACRONYM title=设置您的参数><a href="cookie.cgi?menu=setuppage"><IMG src="$imagurl/top_preferences.gif" border=0></a></ACRONYM> <ACRONYM title=搜索各论坛帖子的内容><IMG src="$imagurl/search.gif" border=0></ACRONYM> <A href="$imagurl/help.htm"><ACRONYM title="常见问题解答"><IMG src="$imagurl/top_faq.gif" border=0></ACRONYM></A>
</TD></TR></TBODY></TABLE><BR><BR><TABLE cellSpacing=1 cellPadding=4 width="500" border=0><TR bgColor=f7f7f7>
<TD align=right bgcolor=$bgcolor0 width="183"><FONT style=font-size:9pt color=$bgcolor4><B>检索关键字:</B></FONT>
</TD><FORM METHOD=POST action=bbs.cgi><input type=hidden name=menu value=findtitle><TD bgcolor=$bgcolor2 width="379"><INPUT maxLength=25 name=search> </TD></TR>
<TR bgColor=ffffff><TD align=right bgcolor=$bgcolor0 width="183"><FONT style=font-size:9pt color=$bgcolor4><B>搜索的论坛:</B></FONT>
</TD><TD bgcolor=$bgcolor2 width="379"><FONT style=font-size:9pt><SELECT name=id>
EOF
for ($i=0; $i<100; $i++){
$line=@lines[$i];
chomp($line);
if($line ne ""){
($username1,$sort)=split(/__/,$line);
if($username1 ne ""){
($username1)=split(/\t/,$username1);
open(TITLES,"$filepath/list/$username1.cgi");
$m=<TITLES>;
close(TITLES);
($rname,$rpass,$rmail,$rhome,$rtitle,$yhq,$rtime,$htmlt,$htmlw,$jj,$fbzmc)=split(/\t/,$m);
print <<EOF;
<OPTION value=$username1>『$rtitle』
EOF
}
}}
print <<EOF;
</OPTION></SELECT></FONT></TD></TR><TR bgColor=f7f7f7><TD align=right bgcolor=$bgcolor0 width="183"><FONT style=font-size:9pt color=$bgcolor4><B>搜索范围:</B></FONT> </TD>
<TD bgcolor=$bgcolor2 width="379"><SELECT name=SearchIn> <OPTION>所有帖子</OPTION></SELECT> </TD></TR>
<TR bgColor=ffffff><TD align=right bgcolor=$bgcolor0 width="183"><B><font style=font-size:9pt color=$bgcolor4>按时间范围检索:</font></B> </TD>
<TD bgcolor=$bgcolor2 width="379"><SELECT> <OPTION>任何时间</OPTION></SELECT> </TD></TR>
</TABLE><P> <INPUT type=submit value=开始检索 name=Submit> <INPUT type=reset value=重新输入> </FORM>
<P> </CENTER></BODY></HTML>
EOF
exit;
########
sub add{
if($username eq ""){
print "Content-type: text/html\n\n<script>alert('您当前的身份是访客,无法添加论坛!');history.back();</script>";
}
open(PSD,"$filepath/favorites/$Cookies{username}.cgi");
@lines=<PSD>;
close(PSD);
$fno=@lines;
foreach $line (@lines) {
($id)=split(/\t/,$line);
if($id eq $add){print "Content-type: text/html\n\n<script>alert('此论坛已经在您的私人珍藏中存在!');history.back();</script>";exit;}
open (CHAT,"$filepath/list/$id.cgi");
$linei=<CHAT>;
close(CHAT);
($bzmc,$secret,$bzrmail,$outurl,$bbsname)=split(/\t/,$linei);
if($id ne "" && $bbsname ne ""){
$zliao="$zliao$id\t$bbsname\n";
}}
open (CHAT,"$filepath/list/$add.cgi");
$linei=<CHAT>;
close(CHAT);
($bzmc,$secret,$bzrmail,$outurl,$bbsname)=split(/\t/,$linei);
if (length($bbsname) > 10){$bbsname=substr($bbsname,0,10);$bbsname.="...";}
$zliao="$zliao$add\t$bbsname\n";
open(PSD,">$filepath/favorites/$Cookies{username}.cgi");
print PSD $zliao;
close(PSD);
print "Content-type: text/html\n\n";
print <<EOF;
<body topmargin=0><META HTTP-EQUIV=Content-Type CONTENT=text/html; charset=gb2312><meta HTTP-EQUIV="REFRESH" CONTENT="3;URL=list.cgi?menu=many">
您已经成功地将该论坛添加到您的私人珍藏,请稍候,系统将自动返回......
EOF
exit;
}
########
sub del{
if($username eq ""){
print "Content-type: text/html\n\n<script>alert('您当前的身份是访客,无法添加论坛!');history.back();</script>";
}
open(TITLES5,"$filepath/favorites/$Cookies{username}.cgi");
@hastitles5=<TITLES5>;
close(TITLES5);
open(TITLES5,">$filepath/favorites/$Cookies{username}.cgi");
foreach $m5 (@hastitles5){
chomp($m5);
if($m5 ne ""){
($rthistime5)=split(/\t/,$m5);
if($rthistime5 ne $add){
print TITLES5 $m5."\n";
}}
}
close(TITLES5);
print "Content-type: text/html\n\n";
print <<EOF;
<body topmargin=0><META HTTP-EQUIV=Content-Type CONTENT=text/html; charset=gb2312><meta HTTP-EQUIV="REFRESH" CONTENT="3;URL=list.cgi?menu=many">
您已经成功地将该论坛从您的私人珍藏删除,请稍候,系统将自动返回.....
EOF
exit;
}
sub index{
open(TMP,"$filepath/data/fixindex");
$fixindex=<TMP>;
close(TMP);
if($fixindex eq $min){&errorview("系统正在自动进行维护,请稍后访问!");exit;}
open(TMP,">$filepath/data/fixindex");
print TMP $min;
close(TMP);
chmod(0777,"$filepath/list/$id");
unless(-f "$filepath/list/$id/00000000000000"){
open(TMP,">$filepath/list/$id/00000000000000");
print TMP "欢迎使用 BBS3000\t$thistime\t$admname\t感谢您选择了 BBS3000<br><br><table width=100%><tr><td align=right>Yuzi工作室</td></tr></table>\t$from\t0\t1\t--\t$thistime\t00000000000000b\t0";
close(TMP);
chmod(0666,"$filepath/list/$id/00000000000000");
}
unless(-f "$filepath/list/$id/00000000000001"){
open(TMP,">$filepath/list/$id/00000000000001");
print TMP "欢迎使用 BBS3000\t$thistime\t$admname\t感谢您选择了 BBS3000<br><br><table width=100%><tr><td align=right>Yuzi工作室</td></tr></table>\t$from\t0\t1\t--\t$thistime\t00000000000000b\t0";
close(TMP);
chmod(0666,"$filepath/list/$id/00000000000001");
}
chmod(0666,"$filepath/list/$id/bbs");
open(TITLES,"$filepath/list/$id/bbs")||open(TITLES,">$filepath/list/$id/bbs");
@hastitles=<TITLES>;
close(TITLES);
$size=@hastitles;
if ($size < 2){
opendir (MEMBERDIR2, "$filepath/list/$id");
@members2 = readdir(MEMBERDIR2);
closedir (MEMBERDIR2);
@b=reverse sort @members2;
foreach $m (@b){if(length($m) eq 14 ){$top="$top$m\n";}}
open(PSD,">$filepath/list/$id/bbs");
print PSD $top;
close(PSD);
chmod(0666,"$filepath/list/$id/bbs");
}
print "Content-type: text/html\n\n<meta HTTP-EQUIV=REFRESH CONTENT=3;URL=bbs.cgi?menu=listtitle&id=$id>正在生成索引文件...";exit;
}
######################### END OF SCRIPT #########################
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -