📄 lb.lib.pl
字号:
$lookfor =~ s/[\a\f\n\e\0\r\t\`\~\!\@\#\$\%\^\&\*\(\)\+\=\\\{\}\;\'\:\"\,\.\/\<\>\?\[\]]//isg;
$savedusername =~ s/\_/ /g;
$tempusername =~ s/\_/ /g;
if ($userexpire <= $savedtime) {
if (($thisprog eq "topic.cgi")||($thisprog eq "team.cgi")||($thisprog eq "friendlist.cgi")||($thisprog eq "blocklist.cgi")) { if ($savedusername !~ /^客人/) { if ($savehidden ne 1) { $onlineuserlist = "$onlineuserlist$savedusername\_"; } else { $onlineuserlisthidden = "$onlineuserlisthidden$savedusername\_"; } } }
if ((lc($savedusername) eq lc($tempusername))||(($savedusername eq "客人($ipaddress)")&&($ipall eq $savedipaddress)&&($tempusername =~ /^客人/))) {
if ((($currenttime - $savedtime) <= $banfreshtime - 1)&&($savedwhere eq $where)&&($savedwhere2 eq $where2)&&(($thisprog eq "post.cgi")||($thisprog eq "leoboard.cgi")||($thisprog eq "forums.cgi")||($thisprog eq "topic.cgi")||($thisprog eq "printpage.cgi")||($thisprog eq "whosonline.cgi"))) {
print header(-charset=>gb2312);
print "<BR>服务器忙,请 $banfreshtime 秒后按刷新键继续。<BR><BR>出错原因:你刷新页面过快,或者你打开了过多窗口来浏览本网站。";
exit;
}
if ($memberprinted eq "no") {
$savehidden = $hidden if ($hidden ne "");
$tempdata = "$tempusername\t$savedcometime\t$currenttime\t$where\t$ipall\t$saveosinfo\t$savebrowseinfo\t$where2\t$fromwhere\t$membercode\t$savehidden\t$sex\t" ;
$osinfo=$saveosinfo;
$browseinfo=$savebrowseinfo;
$tempdata =~ s/[\a\f\n\e\0\r]//isg;
$fromwhere1 = $fromwhere;
push(@onlinedata,$tempdata);
$memberprinted = "yes";
$onlinetimeadd = $currenttime - $savedcometime if (($thisprog eq "post.cgi")||($thisprog eq "poll.cgi")||($thisprog eq "messanger.cgi"));
}
}
else {
$line =~ s/[\a\f\n\e\0\r]//isg;
push(@onlinedata,$line);
}
}
else {
&uplogintime("$savedusername","") if ($savedusername !~ /^客人/);
}
}
if ($memberprinted eq "no") {
if (($onlinedatanumber >= $arrowonlinemax)&&($arrowonlinemax > 0)&&($membercode ne "ad")&&($membercode ne "cmo")&&($membercode ne "smo")&&($membercode ne "mo")) {
print header(-charset=>gb2312);
print "<BR>服务器忙,已经超出论坛允许的最大在线人数。<BR><BR>目前论坛在线 $onlinedatanumber 人,最大允许同时在线 $arrowonlinemax 人。";
exit;
}
require "${lbdir}testinfo.pl";
$osinfo=&osinfo();
$browseinfo=&browseinfo();
my $fromwhere = &ipwhere("$trueipaddress");
my $tempdata = "$tempusername\t$currenttime\t$currenttime\t$where\t$ipall\t$osinfo\t$browseinfo\t$where2\t$fromwhere\t$membercode\t$hidden\t$sex\t" ;
$fromwhere1 = $fromwhere;
&uplogintime("$tempusername","T") if ($tempusername !~ /^客人/);
$tempdata =~ s/[\a\f\n\e\0\r]//isg;
push(@onlinedata,$tempdata);
}
my $filetoopen = "$lbdir" . "data/onlinedata.cgi";
$filetoopens = &lockfilename($filetoopen);
if (!(-e "$filetoopens.lck")) {
&winlock($filetoopen) if (($OS_USED eq "Unix")||($OS_USED eq "Nt"));
if (open(FILE4,">$filetoopen")) {
flock(FILE4, 2) if ($OS_USED eq "Unix");
foreach $line (@onlinedata) {
chomp $line;
next if ($line eq "");
my ($fileusername, $no) = split(/\t/, $line);
next if ($fileusername eq "客人($ipaddress)" && $memberprinted eq "no" && $tempusername !~ m/^客人/);
print FILE4 "$line\n";
}
close(FILE4);
}
&winunlock($filetoopen) if (($OS_USED eq "Unix")||($OS_USED eq "Nt"));
if ($currenttime-$fileinfo[9] >= 200) {
if (open(FILE4,">${filetoopen}.cgi")) {
foreach $line (@onlinedata) {
chomp $line;
print FILE4 "$line\n" if ($line ne "");
}
close(FILE4);
}
}
}
if (($thisprog eq "leoboard.cgi")||($thisprog eq "forums.cgi")||($thisprog eq "index.cgi")) {
$filetomake = "${lbdir}data/counter.cgi";
my $countfiles=1 if (-e "$filetomake");
$onlinemax = @onlinedata;
&winlock($filetomake) if (($OS_USED eq "Unix")||($OS_USED eq "Nt"));
open(FILE,"$filetomake");
flock (FILE, 1) if ($OS_USED eq "Unix");
my $count = <FILE>;
close(FILE);
($count1,$count2,$onlinemax1,$onlinemaxtime1) = split(/\t/, $count);
$onlinemaxtime1 = $currenttime if ($onlinemaxtime1 eq "");
$count2++;
$count1++ if ($memberprinted eq "no");
$count1=0 if ($count1 eq "");
if ($onlinemax < $onlinemax1) {
$onlinemax = $onlinemax1;
$onlinemaxtime = $onlinemaxtime1;
}
else {
$onlinemaxtime = $currenttime;
}
unless (($count2 eq 1)&&($countfiles eq 1)) {
if (($count1 > 0)&&($count2 > 0)&&($onlinemax > 0)&&($onlinemax <= 5000)) {
if (open(FILE, ">$filetomake")) {
flock (FILE, 2) if ($OS_USED eq "Unix");
print FILE "$count1\t$count2\t$onlinemax\t$onlinemaxtime\t\n";
close(FILE);
}
}
}
else {
my @fileinfo = stat("$filetomake");
unlink ($filetomake) if ($fileinfo[7] < 10) ;
}
&winunlock($filetomake) if (($OS_USED eq "Unix")||($OS_USED eq "Nt"));
}
@onlinedata1=();
if ($method ne "none") {
$memberoutput = qq~<script language="javascript">
function OLO(img, name, name1, place, action, time, time1, os, browser, ip, where, xa, xb) {document.write("<td width=12 align=center><img src=$imagesurl/images/" + img + " border=0 width=12 align=absmiddle alt='发送一个短消息给 " + name + "' onClick=\\"javascript:openScript('messanger.cgi?action=new&touser=" + name1 + "', 420, 320)\\" style='cursor: hand'></td><td width=108><span onClick=\\"javascript:O9('" + name1 + "')\\" nowarp title=\\"目前位置:" + place + "\\n目前动作:" + action + "\\n来访时间:" + time + "\\n活动时间:" + time1 + "\\n操作系统:" + os + "\\n浏 览 器:" + browser + "\\nIP地址:" + ip + "\\n来源鉴定:" + where + "\\" style='cursor: hand'>" + xa + name + xb + "</span></td>");}
function OHO(time, time1, ip, where, xa, xb) {document.write("<td width=12 align=center><img src=$imagesurl/images/messages2.gif width=12 align=absmiddle alt='请勿打扰!'></td><td width=108><a href=# nowarp title=\\"来访时间:" + time + "\\n活动时间:" + time1 + "\\nIP地址:" + ip + "\\n来源鉴定:" + where + "\\">" + xa + "隐身会员" + xb + "</a></td>");}
~;
$memberoutput1 = qq~<script language="javascript">
function OGO(place, action, time, time1, os, browser, ip, where, xa, xb) {document.write("<td width=12 align=center><img src=$imagesurl/images/messages2.gif border=0 width=12 align=absmiddle alt='快注册呀!'></td><td width=108><a href=# nowarp title=\\"目前位置:" + place + "\\n目前动作:" + action + "\\n来访时间:" + time + "\\n活动时间:" + time1 + "\\n操作系统:" + os + "\\n浏 览 器:" + browser + "\\nIP地址:" + ip + "\\n来源鉴定:" + where + "\\">" + xa + "客人" + xb + "</a></td>");}
~;
foreach my $line (@onlinedata) {
chomp $line;
$line =~ s/*#!&*//;
my ($savedusername, $savedcometime, $savedtime, $savedwhere, $postipaddresstemp, $saveosinfo, $savebrowseinfo, $savedwhere2, $fromwhere, $memcod, $hiddened, $savesex) = split(/\t/, $line);
if ($memcod eq "ad") {$mspic="messages0.gif";}
elsif ($memcod eq "smo") {$mspic="messages6.gif";}
elsif ($memcod eq "cmo") {$mspic="messages3.gif";}
elsif ($memcod eq "mo") {$mspic="messages4.gif";}
elsif ($memcod eq "rz") {$mspic="messages5.gif";}
else {$mspic="messages1.gif";}
my ($lookfor, $no) = split(/\(/,$savedusername);
next if ($lookfor =~ m/[\(\)\*]/ || $lookfor eq "");
($savedipaddress,$truepostipaddress) = split(/\=/,$postipaddresstemp);
$totleonlineall++;
$fromwhere = "已设置保密" unless (($pvtip eq "on")||($membercode eq "ad")||(($membercode eq 'smo')&&($smocanseeip eq "no")));
if ($membercode eq "smo")
{
$savedipaddress = "已设置保密" unless ($pvtip eq "on" || $smocanseeip eq "no");
}
elsif ($membercode eq "cmo" || $membercode eq "mo")
{
if ($pvtip eq "on")
{
my ($ip1, $ip2, $ip3, $ip4) = split(/\./, $savedipaddress);
$savedipaddress = "$ip1.$ip2.$ip3.*";
}
else
{
$savedipaddress = "已设置保密";
}
}
elsif ($membercode ne "ad")
{
if ($pvtip eq "on" && $inmembername ne "客人")
{
my ($ip1, $ip2, $ip3, $ip4) = split(/\./, $savedipaddress);
$savedipaddress = "$ip1.$ip2.*.*";
}
else
{
$savedipaddress = "已设置保密";
}
}
my $savedcometime = &dateformatshort($savedcometime + ($timezone+$timedifferencevalue)*3600);
my $savedtime = &dateformatshort($savedtime + ($timezone+$timedifferencevalue)*3600);
$savedwhere2 =~s/\<a \s*(.*?)\s*\>\s*(.*)/“$2”/isg;
$savedwhere2 =~s/\<\/a\>//isg;
$savedwhere2 =~s/\<b\>//isg;
$savedwhere2 =~s/\<\/b\>//isg;
$savedwhere2 =~s/\"/\\\"/;
my $wherebaomi = $method . "(密)";
if ($savedwhere eq $method || $savedwhere eq $wherebaomi || $method eq "both")
{
if ((($hiddened eq 1 && $membercode ne "ad") || ($savedusername =~ /^客人/)) && (lc($savedusername) ne lc($inmembername)))
{
$XA = $XB = "";
if (lc($savedusername) eq lc($inmembername) || $savedusername eq "客人($trueipaddress)")
{
$XA = "<font color=$onlineselfcolor>";
$XB = "</font>";
}
if ($hiddened eq 1)
{
$members++;
$memberoutput .= qq~\nOHO("$savedcometime","$savedtime","$savedipaddress","$fromwhere","$XA","$XB")~;
$memberoutput .= qq~\n</script></tr><tr>\n<script>~ if ($members == int($members / $screenmode) * $screenmode);
}
else
{
$guests++;
$memberoutput1 .= qq~\nOGO("$savedwhere","$savedwhere2","$savedcometime","$savedtime","$saveosinfo","$savebrowseinfo","$savedipaddress","$fromwhere","$XA","$XB")~;
$memberoutput1 .= qq~\n</script></tr><tr>\n<script>~ if ($guests == int($guests / $screenmode) * $screenmode);
}
}
else
{
$members++;
my $cleanmember = $savedusername;
$cleanmember =~ s/ /\_/g;
$cleanmember =~ tr/A-Z/a-z/;
$cleanmember = uri_escape($cleanmember) if ($uri_escape ne "no");
$XA = $XB = "";
$XA = "<font color=$mcolor>" if ($savesex eq "m");
$XA = "<font color=$fcolor>" if ($savesex eq "f");
if (lc($savedusername) eq lc($inmembername))
{
$XA = "<font color=$onlineselfcolor>";
$XB = "</font>";
}
if ($hiddened eq 1)
{
$hiddeninfo = "\\n-=> 目前处于隐身状态 <=-";
}
else
{
$hiddeninfo = "";
}
$memberoutput .= qq~\nOLO("$mspic","$savedusername","$cleanmember","$savedwhere","$savedwhere2","$savedcometime","$savedtime","$saveosinfo","$savebrowseinfo","$savedipaddress","$fromwhere$hiddeninfo","$XA","$XB")~;
$memberoutput .= qq~\n</script></tr><tr>\n<script>~ if ($members == int($members / $screenmode) * $screenmode);
}
}
}
$memberoutput .= qq~\n<\/script>\n~;
$memberoutput1 .= qq~\n<\/script>\n~;
$memberoutput1 = "" if ($dispguest eq 3 || ($dispguest ne 2 && $members > 50 && $guests > 20));
$memberoutput = "$memberoutput</tr><tr>" if ($memberoutput ne "" && $memberoutput1 ne "");
$memberoutput .= $memberoutput1;
undef $memberoutput1;
my $totleonline = $members + $guests;
$membertongji = $method eq "both" ? "目前总共有 <a href=whosonline.cgi><b>$totleonlineall</b></a> 人在线。其中注册用户 <b>$members</b> 人,访客 <b>$guests</b> 人。" : " 目前论坛总在线 <b>$totleonlineall</b> 人,本分论坛共有 <b>$totleonline</b> 人在线。其中注册用户 <b>$members</b> 人,访客 <b>$guests</b> 人。";
}
undef @onlinedata unless ($thisprog eq "whosonline.cgi");
return;
}
sub lbhz {
my($str, $maxlen) = @_;
return $str if (length($str) <= $maxlen);
$str = substr($str, 0, $maxlen-4);
if ($str =~ /^([\000-\177]|[\200-\377][\200-\377])*([\000-\177]|[\200-\377][\200-\377])$/)
{
return $str . " ...";
}
else
{
chop($str);
return $str . " ...";
}
}
sub cleaninput {
my $text = shift;
study($text);
$text =~ s/\ / /g;
$text =~ s/\@ARGV/\&\#64\;ARGV/isg;
$text =~ s/\;/\&\#59\;/isg;
$text =~ s/\&/\&/g;
$text =~ s/\&\#/\&\#/isg;
$text =~ s/\&\;(.{1,6})\&\#59\;/\&$1\;/isg;
$text =~ s/\&\#([0-9]{1,6})\&\#59\;/\&\#$1\;/isg;
$text =~ s/"/\"/g;
$text =~ s/ / \ /g;
$text =~ s/</\</g;
$text =~ s/>/\>/g;
$text =~ s/[\a\f\e\0\r\t]//isg;
$text =~ s/ / /g;
$text =~ s/\n\n/<p>/g;
$text =~ s/\n/<br>/g;
$text =~ s/<script>/\<script\>/ig;
$text =~ s/document.cookie/documents\&\#46\;cookie/isg;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -