#!/usr/bin/perl ############################################################# # LeoBoard ver.5000 / LB5000 / 雷傲超级论坛 ver.5000 # # 版权所有: 雷傲工作室(原蓝宝石软件工作室) # # 制作人 : 山鹰糊 (Shining Hu) # 花无缺 (Ifairy Han) # # 主页地址: http://www.CGIer.com/ CGI 编程者之家 # http://www.LeoBoard.com/ 雷傲论坛支持主页 # http://www.leoBBS.com/ 本论坛直通车 # # ************************* # LB论坛推荐虚拟主机服务商: # 雷傲科技: http://www.leoboard.com.cn # 全面支持LB所有功能,拥有2年提供LB论坛空间的以及500多个LB用户的经验,可以做的更好 # ************************** # ############################################################# BEGIN { $start_time = (times)[0] + (times)[1]; $LBPATH = '.'; my $pgm = $0; $pgm =~s/\\/\//g; $pgm =~s/^.*\/([^\/]+)$/$1/g; unless (-e $LBPATH.'/'.$pgm) { foreach ($0, $ENV{'SCRIPT_FILENAME'}, $ENV{'PATH_TRANSLATED'}) { s!\\!/!g; s/^(.*)\/[^\/]+$/$1/g; if (-e $_ . '/' .$pgm) { $LBPATH = $_; last; } } } unshift (@INC, "$LBPATH"); } use LBCGI; $LBCGI::POST_MAX=2000; $LBCGI::DISABLE_UPLOADS = 1; $LBCGI::HEADERS_ONCE = 1; require "data/boardinfo.cgi"; require "data/styles.cgi"; eval { ($0 =~ m,(.*)/[^/]+,) and unshift (@INC, "$1"); ($0 =~ m,(.*)\\[^\\]+,) and unshift (@INC, "$1"); require "data/boardstats.cgi"; }; if ($@) { open(FILE, "${lbdir}data/allforums.cgi"); flock(FILE, 1) if ($OS_USED eq "Unix"); @forums = ; close(FILE); $totle1 = 0; $totle2 = 0; foreach $forum (@forums) { chomp $forum; next if ($forum eq ""); (my $tempno,my $no, $no, $no, $no, $no ,$no ,$no ,$no, $no ,$no ,$no, $threads, $posts, $no, $no, $no,$no,$no,$no) = split(/\t/,$forum); next if ($tempno !~ /^[0-9]+$/); $totle1 += $threads; $totle2 += $posts; } opendir (DIRS, "$lbdir"); my @memdir = readdir(DIRS); closedir (DIRS); @memdir = grep(/^members/i, @memdir); my $memdir = $memdir[0]; opendir (DIR, "${lbdir}$memdir/old"); my @filedata = readdir(DIR); closedir (DIR); my @countvar = grep(/\.cgi$/i,@filedata); $newtotalmembers = @countvar; open(FILE, ">${lbdir}data/boardstats.cgi"); flock(FILE, 2) if ($OS_USED eq "Unix"); print FILE "\$lastregisteredmember = \'nodisplay\'\;\n"; print FILE "\$totalmembers = \'$newtotalmembers\'\;\n"; print FILE "\$totalthreads = \'$totle1\'\;\n"; print FILE "\$totalposts = \'$totle2\'\;\n"; print FILE "\n1\;"; close (FILE); } require "data/boardstats.cgi"; require "lb.lib.pl"; require "visitforum.lib.pl"; $|++; # Unbuffer the output $thisprog = "leoboard.cgi"; require "imagead.cgi" if (($useimagead eq "1")||($useimagead1 eq "1")); $query = new LBCGI; if ($COOKIE_USED eq 1) {$cookiepath ="";} else { $boardurltemp =$boardurl; $boardurltemp =~ s/http\:\/\/(\S+?)\/(.*)/\/$2/; $cookiepath = $boardurltemp; $cookiepath =~ s/\/$//; # $cookiepath =~ tr/A-Z/a-z/; } &ipbanned; #封杀一些 ip $action = $query->param('action'); $catlog = $query->param('catlog'); $catlog2= $catlog; $te = "catlog".$catlog; if ($catlog ne "") { $catlog1=$query->cookie("$te"); if ($catlog1 ne "no") { $catlog1cookie = cookie(-name => "$te", -value => "no", -expires => "+30d", -path => "$cookiepath/"); } else { $catlog1cookie = cookie(-name => "$te", -value => "yes", -expires => "+30d", -path => "$cookiepath/"); } } $inmembername = $query->cookie("amembernamecookie"); $inpassword = $query->cookie("apasswordcookie"); $inmembername =~ s/[\a\f\n\e\0\r\t\`\~\!\@\#\$\%\^\&\*\(\)\+\=\\\{\}\;\'\:\"\,\.\/\<\>\?]//isg; $inpassword =~ s/[\a\f\n\e\0\r\t\|\@\;\#\{\}\$]//isg; if ($action eq "delcookieall") { $namecookie = cookie(-name => "amembernamecookie", -value => "", -path => "$cookiepath/"); $passcookie = cookie(-name => "apasswordcookie" , -value => "", -path => "$cookiepath/"); $onlineviewcookie = cookie(-name => "onlineview" , -value => "", -path => "$cookiepath/"); $advpostcookie = cookie(-name => "advpost" , -value => "", -path => "$cookiepath/"); $threadcookie = cookie(-name => "threadages" , -value => "", -path => "$cookiepath/"); $viewcookie = cookie(-name => "viewMode" , -value => "", -path => "$cookiepath/"); $nodisp = cookie(-name => "nodisp" , -value => "", -path => "$cookiepath/"); $freshtimecookie = cookie(-name => "freshtime" , -value => "", -path => "$cookiepath/"); $tanchumsgcookie = cookie(-name => "tanchumsg" , -value => "", -path => "$cookiepath/"); $cookie = cookie(-name => "lastvisit" , -value => "", -path => "$cookiepath/"); $tempcookie = cookie(-name => "templastvisit" , -value => "", -path => "$cookiepath/"); $catlogcookie = cookie(-name => "catlog" , -value => "", -path => "$cookiepath/"); $unioncookie = cookie(-name => "union" , -value => "", -path => "$cookiepath/"); $banfreshcookie = cookie(-name => "banfresh" , -value => "", -path => "$cookiepath/"); $treeviewcookie = cookie(-name => "treeview" , -value => "", -path => "$cookiepath/"); $tecookie = cookie(-name => "catlog" , -value => "", -path => "$cookiepath/"); print header(-cookie=>[$tecookie, $cookie,$tempcookie, $catlogcookie,$unioncookie,$banfreshcookie, $treeviewcookie, $onlineviewcookie,$advpostcookie,$threadcookie,$viewcookie, $nodisp, $freshtimecookie, $tanchumsgcookie, $namecookie,$passcookie], -charset=>gb2312); print qq ~~; exit; } if ($inmembername eq "") { $inmembername = "客人"; } else { # &getmember("$inmembername"); &getmembernolock("$inmembername"); &error("普通错误&密码与用户名不相符,请重新登录!") if ($inpassword ne $password); &error("普通错误&此用户根本不存在!") if ($userregistered eq "no"); &getlastvisit; } $union = $query->cookie("union"); $union = 1 if ($union eq ""); $screenmode = $query->cookie("screenmode"); $screenmode = 8 if ($screenmode eq ""); $onlineview = 1 if ($onlineview eq ""); $catlog = $query->cookie("catlog") if ($catlog eq ""); $cpudisp = 1 if (($membercode eq "ad")||($membercode eq "smo")||($membercode eq "cmo")||($membercode eq "mo")); $onlineview1 = $query->cookie("onlineview"); $onlineview = $onlineview1 if ($onlineview1 ne ""); $onlineview = 1 if ($onlineview eq ""); $timeadd = $timedifferencevalue*3600 + $timezone*3600; $filetoopen = "$lbdir" . "data/allforums.cgi"; &winlock($filetoopen) if (($OS_USED eq "Unix")||($OS_USED eq "Nt")); open(FILE, "$filetoopen"); flock(FILE, 1) if ($OS_USED eq "Unix"); @forums = ; close(FILE); &winunlock($filetoopen) if (($OS_USED eq "Unix")||($OS_USED eq "Nt")); $currenttime = time; $outputbutton= ""; $a = 0; foreach $forum (@forums) { $a = sprintf("%09d",$a); chomp $forum; next if ($forum eq ""); ($forumid, $category, $categoryplace, $forumname, $forumdescription, $forummoderator ,$htmlstate ,$idmbcodestate ,$privateforum, $startnewthreads ,$lastposter ,$lastposttime, $threads, $posts, $forumgraphic,$tmp,$tmp,$forumpass,$hiddenforum,$indexforum,$teamlogo,$teamurl, $fgwidth, $fgheight, $miscadd3, $miscadd4, $miscad5) = split(/\t/,$forum); next if ($forumid !~ /^[0-9]+$/); if($category =~/^childforum-[0-9]+/){ $topforumno=$category; $topforumno=~s/^childforum-//; $threadadds[$topforumno]+=$threads; $postadds[$topforumno]+=$posts; ($olastposttime,undef)=split(/\%\%\%/,$lastposttime[$topforumno]); ($clastposttime,undef)=split(/\%\%\%/,$lastposttime); if(($clastposttime > $olastposttime || ($lastposttime[$topforumno] eq "" && $lastposter[$topforumno] eq "")) && $privateforum ne "yes" && (($hiddenforum eq "no")||($membercode eq "ad")||($membercode eq "smo"))) { $lastposttime[$topforumno]=$lastposttime."%%%$forumid"; $lastposter[$topforumno]=$lastposter; } if (($hiddenforum eq "no")||($membercode eq "ad")||($membercode eq "smo")||($membercode eq "cmo")) { $outputbutton .= qq~~; } $lvisit .= "$forumid-$currenttime--"; }else{ $lastposttime[$forumid]=$lastposttime; $lastposter[$forumid]=$lastposter; $categoryplace = sprintf("%09d",$categoryplace); $rearrange = ("$categoryplace\t$a\t$category\t$forumname\t$forumdescription\t$forummoderator\t$htmlstate\t$idmbcodestate\t$privateforum\t$startnewthreads\t$lastposter\t$lastposttime\t$threads\t$posts\t$forumgraphic\t$ratings\t$misc\t$forumpass\t$hiddenforum\t$indexforum\t$forumid\t$teamlogo\t$teamurl\t$fgwidth\t$fgheight\t$miscadd3\t$miscadd4\t$miscad5\t"); if (($hiddenforum eq "no")||($membercode eq "ad")||($membercode eq "smo")||($membercode eq "cmo")) { push (@rearrangedforums, $rearrange); $outputbutton .= qq~~; $lvisit .= "$forumid-$currenttime--"; } $a++; } } if ($action eq "onlineview") { if ($onlineview == 1) { $onlineview=0; } else { $onlineview=1; } } $treecat1 = $query->cookie("treeview"); $treeview = 0 if (($treecat1 ne "")||($catlog ne "")); $treeview = 1 if ($treeview eq ""); if ($action eq "union") { if ($union == 1) { $union=0; } else { $union=1; }} elsif ($action eq "expand") { $catlog="expand"; } elsif ($action eq "depand") { $catlog="depand"; } elsif ($action eq "resetall") { $cookie = cookie(-name => "lastvisit" , -value => "$lvisit", -path => "$cookiepath/", -expires => "+30d"); $tempcookie = cookie(-name => "templastvisit", -value => "$lvisit", -path => "$cookiepath/", -expires => "+30d"); print header(-cookie =>[$cookie, $tempcookie], -charset=>gb2312); print qq ~~; exit; } $onlineviewcookie = cookie(-name => "onlineview", -value => "$onlineview", -path => "$cookiepath/" , -expires => "+30d"); $catlogcookie = cookie(-name => "catlog" , -value => "$catlog" , -path => "$cookiepath/" , -expires => "+30d"); if ($onlineview==1){ $onlinetitle="关闭详细列表"; } else { $onlinetitle="显示详细列表";} if (open(SFFILE,"${lbdir}data/shareforums.cgi")) { # flock(SFFILE, 1) if ($OS_USED eq "Unix"); @lmforums = ; close(SFFILE); $lmforums = @lmforums; } $uniontitle="(共有 $lmforums 个联盟论坛)"; $unioncookie = cookie(-name => "union", -value => "$union", -path => "$cookiepath/" , -expires => "+30d"); if ($union==0) { $unionview="显示联盟列表"; } else { $unionview="关闭联盟列表"; } &title; if ($CACHE_MODE ne 1) { print header(-cookie =>[$onlineviewcookie, $cookie, $tempcookie ,$unioncookie,$catlogcookie, $catlog1cookie], -charset=>gb2312); } else { print header(-cookie =>[$onlineviewcookie, $cookie, $tempcookie ,$unioncookie,$catlogcookie, $catlog1cookie], -charset=>gb2312, -expires=>'-1d'); } $forumsize=@forums; if (($forumsize == 0)&&(-e "$filetoopen.pl")){ open(FILE, "$filetoopen.pl"); flock (FILE, 1) if ($OS_USED eq "Unix"); @forums = ; close(FILE); open(FILE, ">$filetoopen"); flock (FILE, 2) if ($OS_USED eq "Unix"); foreach (@forums) { print FILE "$_"; } close(FILE); &error("论坛分类丢失&系统已经自动还原了分类信息,请刷新本页查看论坛;如果还是看不到分区,请坛主到管理区重建论坛主界面!"); } elsif ($forumsize > 0) { if (!(-e "$filetoopen.pl")){ open(FILE, ">$filetoopen.pl"); foreach (@forums) { print FILE "$_\n"; } close(FILE); } } else { &error("论坛还没建立&请先在管理区建立分论坛!或者分类信息完全丢失,请坛主到管理区重建论坛主界面!"); } $cleanlastregistered = $lastregisteredmember; $cleanlastregistered =~ y/ /_/; $cleanlastregistered =~ tr/A-Z/a-z/; $cleanlastregistered = qq~$lastregisteredmember~; if ($useadscript ne 0) { $adscript = &HTML("$adscript"); $adscript =~ s/\$imagesurl/$imagesurl/isg; } else { $adscript =""; } if ($useadfoot ne 0) { $adfoot = &HTML("$adfoot"); $adfoot =~ s/\$imagesurl/$imagesurl/isg; } else { $adfoot =""; } $insidead = "" if ($useimagead ne "1"); $insidead1 = "" if ($useimagead1 ne "1"); $output .= qq~$insidead$insidead1~; $output .= qq~~ if ($midiaddr2 ne ""); if ($boardlogo ne "") { if ($boardlogo =~ /\.swf$/i) {$boardgraphic = qq~<\/embed>~} else {$boardgraphic = qq~~}; } $output .= qq~
$boardgraphic
$adscript


~; &whosonline("$inmembername\t论坛首页\tboth\t查看论坛信息"); undef $memberoutput if ($onlineview != 1); $createmon = sprintf("%02d",$createmon); $createday = sprintf("%02d", $createday); $createyear = sprintf("%02d", $createyear); $createyear = 1900+$createyear if ($createyear<100); if (($createyear>0)&&($createmon>0)&&($createday>0)) { $createday = "自 $createyear年$createmon月$createday日 创建以来,";} else { $createday =""; } if ($announcements eq 'yes') { if (open(FILE, "${lbdir}data/news.cgi")) { @announcementdata = ; close(FILE); } $totalannouncements = @announcementdata; if ($totalannouncements eq 0) { $dateposted = $currenttime; $title = "当前没有公告"; $announcetemp1 = qq~总论坛暂时无公告!~; } else { ($title, $dateposted, my $trash) = split(/\t/, $announcementdata[0]); $announcetemp1 = qq~总论坛公告!共 $totalannouncements 条!~; } $dateposted = $dateposted + $timeadd; $dateposted = &longdate("$dateposted"); if ($announcemove eq "on") { if ($title ne "当前没有公告") { $title = ""; $newstitleid = ""; foreach (@announcementdata) { chomp $_; (my $newstitle,my $dateposted) = split(/\t/,$_); next if ($newstitle eq ""); $dateposted = $dateposted + $timeadd; $dateposted = &longdate("$dateposted"); $newstitleid++; $title .= qq~ $newstitleid. $newstitle [$dateposted]   ~; } } else { $title = "$title [$dateposted]"; } $announcedisp=qq~$title~; } else { $titletemp = &lbhz($title,25); $announcedisp=qq~ $titletemp [$dateposted]~; } undef $titletemp; undef $title; undef $newstitleid; } $output .= qq~
$announcetemp1$announcedisp  显示管理团队管理团队 显示用户列表用户列表 显示发帖量排名发帖排名

~; if ($inmembername eq "客人") { $output .= qq~~; } else { if ($avatars eq "on") { if (($personalavatar)&&($personalwidth)&&($personalheight)) { #自定义头像存在 $personalavatar =~ s/\$imagesurl/${imagesurl}/o; if (($personalavatar =~ /\.swf$/i)&&($flashavatar eq "yes")) { $personalavatar=uri_escape($personalavatar) if ($uri_escape ne "no"); $useravatar = qq(
); } else { $personalavatar=uri_escape($personalavatar) if ($uri_escape ne "no"); $useravatar = qq(
); } } elsif (($useravatar ne "noavatar") && ($useravatar)) { $useravatar=uri_escape($useravatar) if ($uri_escape ne "no"); $useravatar = qq(
); } else { $useravatar=qq(
); } } else { $useravatar=qq(
); } $memberfilename = $inmembername; $memberfilename =~ s/ /\_/g; $memberfilename =~ tr/A-Z/a-z/; $totalmessages = @allmessages; open (MSGOUT, "${lbdir}$msgdir/out/${memberfilename}_out.cgi"); @allmessages = ; close (MSGOUT); $totalmessagesout = @allmessages; if ($unread eq "0") { $inboximg = qq~~; } else { $inboximg = qq~~; } $output .= qq~~; } $output .= qq~
-=> 快速登录入口  [ IP 是:$trueipaddress, 来自:$fromwhere1 。 操作系统:$osinfo, 浏览器:$browseinfo ]
 用户名 :   密 码 :   Cookie :

 登陆到 :    
-=> 您的个人状态  [ IP 是:$trueipaddress, 来自:$fromwhere1 。 操作系统:$osinfo, 浏览器:$browseinfo ]
$inboximg $useravatar
* 我的短消息

[短消息收件箱]共有新信息: $unread
[短消息收件箱]共有信息数: $totalmessages
[短消息发件箱]共有信息数: $totalmessagesout
* 我的文章

主题发表数: $numberofposts
主题回复数: $numberofreplys
主题被删数: $postdel
 ■ 最后注册会员: $cleanlastregistered
 ■ 注册会员总数: $totalmembers 人
 ■ 论坛主题总数: $totalthreads
 ■ 论坛回复总数: $totalposts
 ■ 当前在线总数: $totleonlineall

~; @rearrangedforums = sort(@rearrangedforums); if ($catbackpic ne "") { $catbackpic = "background=$imagesurl/myimages/$catbackpic"; } foreach (@rearrangedforums) { chomp $_; ($categoryplace,my $a, $category, $forumname, $forumdescription, $forummoderator, $htmlstate, $idmbcodestate, $privateforum, $startnewthreads, $lastposter, $lastposttime1, $threads, $posts, $forumgraphic, $ratings, $misc,$forumpass,$hiddenforum,$indexforum,$forumid,$teamlogo,$teamurl, $fgwidth, $fgheight, $miscadd3, $miscadd4, $miscad5) = split(/\t/,$_); $categoryplace = sprintf("%01d",$categoryplace); $forumdescription = &HTML("$forumdescription"); $threads+=$threadadds[$forumid] if($threadadds[$forumid] ne ""); $posts+=$postadds[$forumid] if($postadds[$forumid] ne ""); $lastposttime1=$lastposttime[$forumid] if($lastposttime[$forumid] ne "" && $lastposter[$forumid] ne ""); $lastposter=$lastposter[$forumid] if($lastposttime[$forumid] ne "" && $lastposter[$forumid] ne ""); if ($categoryplace ne $lastcategoryplace) { undef $cmodoutput; if ($cancmodoutput ne "no") { if (open(CATEFILE,"${lbdir}boarddata/catemod$categoryplace.cgi")) { my $catemods =; close(CATEFILE); my @catemodnames = split(/\,/, $catemods); my $cmodnumber=@catemodnames; foreach (@catemodnames) { chomp $_; next if ($_ eq ""); my $cleanedmodname = $_; $cleanedmodname =~ s/ /\_/g; $cleanedmodname =~ tr/A-Z/a-z/; $cmodoutput .= qq~~; } } if ($cmodoutput ne "") { $cmodoutput = qq~