📄 lb.lib.pl
字号:
#############################################################
# LeoBoard ver.5000 / LB5000 / 雷傲超级论坛 ver.5000
#
# 版权所有: 雷傲工作室(原蓝宝石软件工作室)
#
# 制作人 : 山鹰糊 (Shining Hu)
# 花无缺 (Ifairy Han)
#
# 主页地址: http://www.CGIer.com/ CGI 编程者之家
# http://www.LeoBoard.com/ 雷傲论坛支持主页
# http://www.leoBBS.com/ 本论坛直通车
# http://maildo.com/ 大家一起邮
#
#############################################################
$versionnumber = "LB5000II v0818a";
$ENV{'REMOTE_ADDR'} = $ENV{'HTTP_X_FORWARDED_FOR'} if (($ENV{'REMOTE_ADDR'} eq "127.0.0.1")&&($ENV{'HTTP_X_FORWARDED_FOR'} ne "")&&($ENV{'HTTP_X_FORWARDED_FOR'} ne "unknow"));
sub ipbanned {
my $term_postipaddress = $ENV{'REMOTE_ADDR'};
my $term_postipaddress1 = $ENV{'HTTP_X_FORWARDED_FOR'};
$term_postipaddress = $term_postipaddress1 if (($term_postipaddress1 ne "")&&($term_postipaddress1 ne "unknown"));
my $trueipaddress1 = $ENV{'HTTP_CLIENT_IP'};
$term_postipaddress = $trueipaddress1 if (($trueipaddress1 ne "")&&($trueipaddress1 ne "unknown"));
my $term_filetoopen ="$lbdir" . "data/ipbans.cgi";
open(FILE,"$term_filetoopen");
my @term_bannedmembers = <FILE>;
close(FILE);
foreach $term_bannedip (@term_bannedmembers) {
$term_bannedip =~ s/\r//ig;
chomp $term_bannedip;
next if ($term_bannedip eq "");
if ($term_postipaddress =~ /^$term_bannedip/) { print header(-charset=>gb2312); &error(" IP 被禁止&由于你没遵守本站规定!你的 IP ($term_postipaddress)被禁止!如有疑问,请联系管理员。"); }
}
}
sub mischeader {
local($misctype) = @_;
my $filetoopen = "$lbdir" . "data/allforums.cgi";
&winlock($filetoopen);
open(FILE, "$filetoopen") or die "无法定位所需文件!";
flock (FILE, 1) if ($OS_USED eq "Unix");
my @forums = <FILE>;
close(FILE);
&winunlock($filetoopen);
foreach my $forumline (@forums) {
chomp $forumline;
next if ($forumline eq "");
(my $tempno, my $trash) = split(/\t/,$forumline);
if ($inforum eq $tempno) {
(my $forumid, my $category, my $categoryplace, $forumname, my $forumdescription, my $forummoderator, my $htmlstate, my $idmbcodestate, my $privateforum, my $startnewthreads, my $lastposter, my $lastposttime, my $threads, my $posts, $forumgraphic, my $ratings, my $misc, my $forumpass, my $hiddenforum, my $indexforum) = split(/\t/,$forumline);
}
}
$filetoopen = "$lbdir" . "forum$inforum/list.cgi";
&winlock($filetoopen);
open(FILE, "$filetoopen");
flock (FILE, 1) if ($OS_USED eq "Unix");
my @allthreads = <FILE>;
close(FILE);
&winunlock($filetoopen);
foreach my $line (@allthreads) {
($tempno, $trash) = split(/\t/, $line);
if ($intopic eq $tempno) {
($trash, my $topictitle, my $topicdescription, my $threadstate, $trash) = split(/\t/,$line);
}
}
if ($forumgraphic) {
$forumgraphic = qq~<a href=$forumsprog?forum=$inforum><img src=$imagesurl/images/$forumgraphic border=0></a>~;
}
else {
$forumgraphic = qq~<a href=$boardurl/$forumsummaryprog><img src=$imagesurl/images/$boardlogo border=0></a>~;
}
&title;
$inmembername =~ s/\_/ /g;
$output .= qq~
<table cellpadding=0 cellspacing=0 border=0 width=$tablewidth align=center>
<tr>
<td width=30% rowspan=2 valign=top>
$forumgraphic
</td>
<td valign=top>
~;
if ($indexforum ne "no"){
$output .= qq~
<font color=$fontcolormisc>
<img src=$imagesurl/images/closedfold.gif width=15 height=11> <a href=$forumsummaryprog>$boardname</a><br>
<img src=$imagesurl/images/bar.gif width=15 height=15><img src=$imagesurl/images/closedfold.gif width=15 height=11> <a href=$forumsprog?forum=$inforum>$forumname</a><br>
<img src=$imagesurl/images/bar.gif width=15 height=15><img src=$imagesurl/images/openfold.gif width=15 height=11> $misctype
~;
}else{
$output .= qq~
<font color=$fontcolormisc>
<img src=$imagesurl/images/closedfold.gif width=15 height=11> <a href=$forumsprog?forum=$inforum>$forumname</a><br>
<img src=$imagesurl/images/bar.gif width=15 height=15><img src=$imagesurl/images/openfold.gif width=15 height=11> $misctype
~;
}
$output .= qq~
</td>
$usermenu
</tr>
</table>
<p>
~;
}
sub title {
my $newmail = "<p>";
if ($mainonoff == 1) { &InMaintenance; }
if ($inmembername eq "" || $inmembername eq "客人") {
$inmembername = "客人";
$loggedinas = qq~<b>客人</b>: <a href="$loginprog?forum=$inforum">登陆</a> | <a href="$registerprog" >注册</a> | <a href="$lostpasswordprog" >忘记密码</a> | <a href="$onlineprog" >在线</a> | <a href="$searchprog" >搜索</a> | <a href="javascript:openScript('$helpprog',500,400)">帮助</a>~;
if (($regaccess eq "on")&&($thisprog ne "loginout.cgi")&&($thisprog ne $registerprog)&&($thisprog ne $profileprog)) {
print header(-cookie=>[$namecookie, $passcookie], -charset=>gb2312);
print "<script language='javascript'>document.location = 'loginout.cgi?forum=$inforum'</script>";
exit;
}
}
else {
my $memberfilename = $inmembername;
$memberfilename =~ s/ /\_/g;
$memberfilename =~ tr/A-Z/a-z/;
if ((!(-e "$lbdir" . "members/$memberfilename.cgi"))&&($thisprog ne $registerprog)&&($startnewthreads ne "all")){
$namecookie = cookie(-name => "amembernamecookie",
-path => "$cookiepath/",
-value => "",
-expires => "");
$passcookie = cookie(-name => "apasswordcookie",
-value => "",
-path => "$cookiepath/",
-expires => "");
$namecookie1 = cookie(-name => "amembernamecookie",
-path => "/",
-value => "",
-expires => "");
$passcookie1 = cookie(-name => "apasswordcookie",
-value => "",
-path => "/",
-expires => "");
print header(-cookie=>[$namecookie, $passcookie, $namecookie1, $passcookie1], -charset=>gb2312);
print "非法登录,你还没有注册呢!<br>刷新此页以客人身份继续浏览!";
exit;
}
my $filetoopen = "$lbdir". "messages/$memberfilename" . "_msg.cgi";
open (FILE, "$filetoopen");
@allmessages = <FILE>;
close (FILE);
$unread = 0;
foreach (@allmessages) {
(my $trash, my $readstate) = split(/\t/,$_);
$unread++ if ($readstate eq "no");
}
my $popnew = '<script language="JavaScript">JavaScript:PopWindow()</script>' if (($newmsgpop eq "on")&&($thisprog ne $threadprog));
$newmail = qq(<table width=$tablewidth cellpadding=2 cellspacing=0 align=center>
<tr>
<td align=right>
<bgsound src=$imagesurl/images/mail.wav border=0>$popnew
<a href="javascript:openScript('$messangerprog?action=inbox',420,320)"><img src=$imagesurl/images/newmail.gif border=0>有新短消息</a>
</td>
</tr>
</table>) if $unread;
$loggedinas = qq~$inmembername:<a href=$loginprog?forum=$inforum>重登陆</a> | <a href="javascript:openScript('$messangerprog?action=inbox',420,320)">短消息</a> | <a href="javascript:openScript('friendlist.cgi',420,320)">好友</a> | <a href=$profileprog?action=modify&user=memberfilename>更改信息</a> | <a href="javascript:openScript('$boardurl/$newpostsprog',500,400)">新贴</a> | <a href=$searchprog>搜索</a> | <a href=$onlineprog>在线</a> | <a href="javascript:openScript('$helpprog',500,400)">帮助</a> | <a href=$loginprog?action=logout>退出</a> ~;
}
&getmember("$inmembername");
$loggedinas .= qq~| <a href=$adminprog>管理中心</a>~ if (($membercode eq "ad")||($membercode eq "smo"));
if (($thisprog eq $threadprog)||($thisprog eq $forumsprog)) {
$loggedinas .= qq~
<script>
var tc_user="cnleo";
var tc_class="2";
var tc_union="";
var tc_type="1";
_dw('<a href=http://www.textclick.com/viewmain.asp?name='+tc_user+' target=_blank><img WIDTH=0 EIGHT=0 src=http://ad.t2t2.com/scripts/stat.dll?default&user='+tc_user+'&refer='+escape(document.referrer)+'&cur=type2 border=0></a>');
function _dw(string) {document.write(string);}
</script>
~;
}
$output = qq~
<table width=$tablewidth align=center cellspacing=0 cellpadding=1 border=0 bgcolor=$titleborder>
<tr><td>
<table width=100% cellspacing=0 cellpadding=4 border=0>
<tr><td bgcolor=$menubackground>
<font color=$menufontcolor>
>> 欢迎您,$loggedinas
</font>
</td>
<td bgcolor=$menubackground align=right>
<font color=$titlefont><a href=$homeurl target=_blank><b>返回主页</B></a></font>
</td></tr>
</table>
</td></tr>
</table>
$newmail
~;
if ($forumlastvisit) {
my $flv= $forumlastvisit + ($timedifferencevalue*3600) + ($timezone*3600);
my $flongdate = &longdate("$flv");
my $fshorttime = &shorttime("$flv");
$lastvisitdata = qq~ 最近访问论坛时间: $flongdate $fshorttime~;
}
else {
$lastvisitdata = qq~>> $forumname欢迎您的到来 <<~;
}
$uservisitdata = qq~
<tr>
<td valign=bottom align=right>
<font color=$menufontcolor>
<a href=$forumsprog?forum=$inforum&action=resetposts>标记论坛所有内容为已读</a> <a href="javascript:openScript('$helpprog?helpon=阅读标记',500,400)"><img src=$imagesurl/images/help_b.gif border=0></a> <br>$lastvisitdata
</font>
</td></tr>
~;
}
sub moderator {
my $filetoopen = "$lbdir" . "data/allforums.cgi";
&winlock($filetoopen);
open(FILE, "$filetoopen") or die "无法定位所需文件!";
flock (FILE, 1) if ($OS_USED eq "Unix");
my @forums = <FILE>;
close(FILE);
&winunlock($filetoopen);
foreach my $forumline (@forums) {
chomp $forumline;
next if ($forumline eq "");
(my $tempno, my $trash) = split(/\t/,$forumline);
if ($inforum eq $tempno) {
($trash, $trash, $trash, $trash, $trash, $forummoderator ,$trash, $trash, $trash, $trash) = split(/\t/,$forumline);
}
}
$forummoderator =~ s/\, /\,/gi;
$forummoderator =~ s/\, /\,/gi;
my @forummodnames = split(/\,/, $forummoderator);
my $totalmods = @forummodnames;
my $modcount = 1;
$inmembmod = "no";
foreach my $name (@forummodnames) {
chomp $name;
my $cleanedmodname = $name;
$cleanedmodname =~ s/ /\_/g;
$cleanedmodname =~ tr/A-Z/a-z/;
unless ($modcount eq $totalmods) {
$modoutput .= qq~<a href=$profileprog?action=show&member=$cleanedmodname>$name</a>, ~;
}
else {
$modoutput .= qq~<a href=$profileprog?action=show&member=$cleanedmodname>$name</a>~;
}
$inmembmod = "yes" if (lc($inmembername) eq lc($name));
$modcount++
}
unless ($inmembmod eq "yes") { $inmembmod = "no"; }
}
sub error {
my $errorinfo = shift;
(my $where, my $errormsg) = split(/\&/, $errorinfo);
$inmembername = cookie("amembernamecookie");
$inpassword = cookie("apasswordcookie");
&title;
$output .= qq~
<table cellpadding=0 cellspacing=0 border=0 width=$tablewidth align=center>
<tr>
<td width=30% rowspan=2 valign=top><img src="$imagesurl/images/$boardlogo"></td>
<td valign=top>
~;
if ($indexforum ne "no"){
$output .= qq~
<font color=$fontcolormisc>
<img src=$imagesurl/images/closedfold.gif width=15 height=11> <a href="$forumsummaryprog">$boardname</a><br>
<img src="$imagesurl/images/bar.gif" width=15 height=15><img src=$imagesurl/images/openfold.gif width=15 height=11> 错误: $where
~;
}else{
$output .= qq~
<font color=$fontcolormisc>
<img src=$imagesurl/images/openfold.gif width=15 height=11> 错误: $where
~;
}
$output .= qq~
</td></tr>
</table>
<p>
<table cellpadding=0 cellspacing=0 border=0 width=$tablewidth bgcolor=$tablebordercolor align=center>
<tr><td>
<table cellpadding=6 cellspacing=1 border=0 width=100%>
<tr><td bgcolor=$miscbacktwo align=center><font color=$fontcolormisc><b>错误: $where</b></font></td></tr>
<tr><td bgcolor=$miscbackone><font color=$fontcolormisc>
<b>关于$where错误的详细原因:</b>
<ul>
<li><b>$errormsg</b>
<li>您是否需要查看<a href="javascript:openScript('$helpprog',500,400)">帮助文件</a>?
</ul>
<b>产生$where错误的可能原因:</b>
<ul>
<li>密码错误<li>用户名错误<li>您不是<a href="$registerprog" >注册</a>用户
</ul>
<br><br>
<center><font color=$fontcolormisc> << <a href="javascript:history.go(-1)">返回上一页</a></center>
</tr></td>
</table>
</td></tr></table>
~;
&output(
-Title => $boardname,
-ToPrint => $output,
-Version => $versionnumber
);
}
sub getmember {
$nametocheck = shift;
$nametocheck =~ s/ /\_/g;
$nametocheck =~ tr/A-Z/a-z/;
$userregistered = "";
undef $filedata;
$filetoopen = "$lbdir" . "members/$nametocheck.cgi";
$filetoopen = &stripMETA($filetoopen);
if (-e $filetoopen) {
&winlock($filetoopen);
open(FILE,"$filetoopen");
flock(FILE, 1) if ($OS_USED eq "Unix");
$filedata = <FILE>;
close(FILE);
&winunlock($filetoopen);
chomp($filedata);
($membername, $password, $membertitle, $membercode, $numberofposts, $emailaddress, $showemail, $ipaddress, $homepage, $aolname, $icqnumber ,$location ,$interests, $joineddate, $lastpostdate, $signature, $timedifference, $privateforums, $useravatar, $misc1, $misc2, $misc3, $personalavatar, $personalwidth, $personalheight, $rating, $lastgone, $visitno, $addjy, $meili, $mymoney, $postdel, $sex, $education, $marry, $work, $born, $useradd1, $useradd2, $jhmp) = split(/\t/,$filedata);
$timedifferencevalue=$timedifference;
($numberofposts, $numberofreplys) = split(/\|/,$numberofposts);
chomp $privateforums;
if($privateforums) {
@private = split(/&/,$privateforums);
foreach $accessallowed (@private) {
chomp $accessallowed;
($access, $value) = split(/=/,$accessallowed);
$allowedentry{$access} = $value;
}
}
}
else { $userregistered = "no"; }
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -