📄 lb.lib.pl
字号:
sub uplogintime {
my($nametocheck,$visit) = @_;
my $nametochecktemp = $nametocheck;
$nametocheck =~ s/ /\_/g;
$nametocheck =~ tr/A-Z/a-z/;
$userregistered = "";
my $filetoopen = "$lbdir" . "members/$nametocheck.cgi";
$filetoopen = &stripMETA($filetoopen);
if (-e $filetoopen) {
&winlock($filetoopen);
open(FILE,"$filetoopen");
flock (FILE, 1) if ($OS_USED eq "Unix");
my $filedata = <FILE>;
close(FILE);
chomp($filedata);
(my $membername, my $password, my $membertitle, my $membercode, my $numberofposts, my $emailaddress, my $showemail, my $ipaddress, my $homepage, my $aolname, my $icqnumber ,my $location ,my $interests, my $joineddate, my $lastpostdate, my $signature, my $timedifference, my $privateforums, my $useravatar, my $misc1,my $misc2, my $misc3, my $personalavatar, my $personalwidth, my $personalheight, my $rating, my $lastgone, my $visitno,my $addjy,my $meili, my $mymoney, my $postdel, my $sex, my $education, my $marry, my $work, my $born, my $useradd1,my $useradd2, my $jhmp) = split(/\t/,$filedata);
if ($visit eq "T") {
$visitno++;
if ($usertype eq "0") {
if (($membercode eq "rz")||($membercode eq "ad")||($membercode eq "smo")||($membercode eq "mo")) {
$mymoney=$mymoney+$loginmoney;
$meili=$meili+$loginml;
}
}
}
else {
$mymoney=$mymoney+$loginmoney;
$meili=$meili+$loginml;
}
if (($membername ne "")&&($password ne "")) {
open(FILE,">$filetoopen");
flock (FILE, 2) if ($OS_USED eq "Unix");
$lastgone=time;
print FILE "$nametochecktemp\t$password\t$membertitle\t$membercode\t$numberofposts\t$emailaddress\t$showemail\t$ipaddress\t$homepage\t$aolname\t$icqnumber\t$location\t$interests\t$joineddate\t$lastpostdate\t$signature\t$timedifference\t$privateforums\t$useravatar\t$misc1\t$misc2\t$misc3\t$personalavatar\t$personalwidth\t$personalheight\t$rating\t$lastgone\t$visitno\t$addjy\t$meili\t$mymoney\t$postdel\t$sex\t$education\t$marry\t$work\t$born\t$useradd1\t$useradd2\t$jhmp\t\n";
close(FILE);
}
&winunlock($filetoopen);
}
}
sub getmemberstime {
local($nametocheck) = @_;
$nametocheck =~ s/ /\_/g;
$nametocheck =~ tr/A-Z/a-z/;
my $filetoopen = "$lbdir" . "members/$nametocheck.cgi";
$filetoopen = &stripMETA($filetoopen);
if (-e $filetoopen) {
&winlock($filetoopen);
open(FILE,"$filetoopen");
flock(FILE, 1) if ($OS_USED eq "Unix");
my $filedata = <FILE>;
close(FILE);
&winunlock($filetoopen);
(my $trash, $trash, $trash, $trash, $trash, $trash, $trash, $trash, $trash, $trash, $trash ,$trash ,$trash, $trash, $trash, $trash, $timedifferencevalue, $trash) = split(/\t/,$filedata);
}
else { $userregistered = "no"; $timedifferencevalue = 0; }
}
sub numerically { $a <=> $b }
sub alphabetically { lc($a) cmp lc($b) }
sub whosonline {
local($instruct) = @_;
(my $tempusername, my $where, my $method, my $where2) = split(/\t/, $instruct);
if ($badwords) {
@pairs = split(/\&/,$badwords);
foreach (@pairs) {
($bad, $good) = split(/=/,$_);
chop $good;
$where2 =~ s/$bad/$good/isg;
}
}
my $ipaddress = $ENV{'REMOTE_ADDR'};
$trueipaddress = $ENV{'HTTP_X_FORWARDED_FOR'};
$trueipaddress = $ipaddress if (($trueipaddress eq "")||($trueipaddress eq "unknown"));
my $trueipaddress1 = $ENV{'HTTP_CLIENT_IP'};
$trueipaddress = $trueipaddress1 if (($trueipaddress1 ne "")&&($trueipaddress1 ne "unknown"));
my $ipall = "$ipaddress=$trueipaddress";
my $tempusername1=$tempusername;
if ($tempusername eq "客人") {
$tempusername = "客人($ipaddress)";
}
$guests = 0;
$members = 0;
$filetoopen = "$lbdir" . "data/hidden.cgi";
open (FILE, "$filetoopen");
flock(FILE, 1) if ($OS_USED eq "Unix");
@hiddenmember1 = <FILE>;
close (FILE);
unshift (@hiddenmember1,"客人");
@hiddenmember = @hiddenmember1;
@hiddenmember = "客人" if ($membercode eq "ad");
undef @onlinedata;
undef @onlinedata1;
my $currenttime = time;
my $userexpire = $currenttime - ($membergone * 60);
my $memberprinted = "no";
$osinfo=&osinfo();
$browseinfo=&browseinfo();
$screenmode=7 if ($screenmode eq "");
my $filetoopen = "$lbdir" . "data/onlinedata.cgi";
&winlock($filetoopen);
open(FILE,"$filetoopen");
flock (FILE, 1) if ($OS_USED eq "Unix");
my @onlinedata1 = <FILE>;
close(FILE);
&winunlock($filetoopen);
my $onlinedatafiles=1 if (-e "$filetoopen");
my $onlinedatanumber=@onlinedata1;
foreach my $line (@onlinedata1) {
chomp $line;
(my $savedusername, my $savedcometime, my $savedtime, my $savedwhere, my $savedipaddress, my $saveosinfo, my $savebrowseinfo, my $savedwhere2, my $fromwhere) = split(/\t/, $line);
(my $lookfor, my $no) = split(/\(/,$savedusername);
next if (((length($savedusername)>12)&&($lookfor ne "客人"))||(length($fromwhere) > 30));
next if ((length($saveosinfo) > 15)||(length($savebrowseinfo) > 30));
$savedusername =~ s/\_/ /g;
$tempusername =~ s/\_/ /g;
if ($userexpire <= $savedtime) {
if (($savedusername eq $tempusername)||(($savedusername eq "客人($ipaddress)")&&($ipall eq $savedipaddress))) {
if ((($currenttime - $savedtime) <= $banfreshtime)&&($savedwhere eq $where)&&($savedwhere2 eq $where2)&&(($thisprog eq $postprog)||($thisprog eq $forumsummaryprog)||($thisprog eq $forumsprog)||($thisprog eq $threadprog))) {
print header(-charset=>gb2312);
print "<BR>服务器忙,请 $banfreshtime 秒后按刷新键继续。<BR><BR>出错原因:你刷新页面过快,或者你打开了过多窗口来浏览本网站。";
exit;
}
if ($memberprinted ne "yes") {
$tempdata = "$tempusername\t$savedcometime\t$currenttime\t$where\t$ipall\t$osinfo\t$browseinfo\t$where2\t$fromwhere\t$membercode\t" ;
$tempdata =~ s/\n//isg;
$fromwhere1 = $fromwhere;
push(@onlinedata,$tempdata);
}
$memberprinted = "yes";
}
else {
$line =~ s/\n//isg;
push(@onlinedata,$line);
}
}
else {
&uplogintime("$savedusername","") if (($savedusername !~ /^客人/)&&(($thisprog eq $forumsprog)||($thisprog eq $forumsummaryprog)));
}
}
if ($memberprinted eq "no") {
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" ;
if (($thisprog eq $forumsprog)||($thisprog eq $forumsummaryprog)) {
$filetomake = "$lbdir" . "data/stats.cgi";
if (!(-e "$filetomake.lck")) {
&winlock($filetomake);
open(LOGFILE, ">>$filetomake");
flock(LOGFILE, 2) if ($OS_USED eq "Unix");
print LOGFILE "$currenttime|$browseinfo|$osinfo|$fromwhere|\n";
close(LOGFILE);
&winunlock($filetomake);
}
$filetomake = "$lbdir" . "data/refers.cgi";
$laiyuan = $ENV{'HTTP_REFERER'};
if ($noself eq "on") {
$recoder=1;
}
else {
if ($laiyuan =~ m/$homeurl/isg) {
$recoder=0;
}
else {
$recoder=1;
}
}
if ((!(-e "$filetomake.lck"))&&($laiyuan ne "")&&($laiyuan !~ m/unknow /i)&&($laiyuan !~ m/$boardurl/isg)&&($recoder==1)) {
if (-e "$filetomake") {
&winlock($filetomake);
open(LOGFILE, "$filetomake");
flock(LOGFILE, 1) if ($OS_USED eq "Unix");
@refersall= <LOGFILE>;
close(LOGFILE);
$refersall = @refersall;
if ($refersall<$newrefers) { $newrefers=$refersall; } else { $newrefers--; }
open(LOGFILE, ">$filetomake");
flock(LOGFILE, 2) if ($OS_USED eq "Unix");
unless (($noself eq "off")&&($laiyuan =~ m/$homeurl/isg)) {
print LOGFILE "$laiyuan|$ipall|$currenttime|\n";
}
for ($i=0;$i<$newrefers;$i++) {
print LOGFILE $refersall[$i];
}
close(LOGFILE);
&winunlock($filetomake);
}
else {
open(LOGFILE, ">>$filetomake");
print LOGFILE "$laiyuan|$ipall|$currenttime|\n";
close(LOGFILE);
}
}
}
$fromwhere1 = $fromwhere;
&uplogintime("$tempusername","T") if ($tempusername !~ /^客人/);
$tempdata =~ s/\n//isg;
push(@onlinedata,$tempdata);
}
unless (($onlinedatanumber eq 0)&&($onlinedatafiles eq 1)) {
if (!(-e "$filetoopen.lck")) {
$onlinedatanum = @onlinedata;
&winlock($filetoopen);
open(FILE,"$filetoopen");
flock (FILE, 1) if ($OS_USED eq "Unix");
my @ondatas = <FILE>;
close(FILE);
$onlinnownum = @ondatas;
if ($onlinedatanum > $onlinnownum) { $delmaxuser=int($onlinedatanum/3); } else { $delmaxuser=int($onlinnownum/3); }
$delmaxuser = 30 if ($delmaxuser < 30);
if (($onlinedatanum > 0)&&(($onlinnownum - $onlinedatanum) < $delmaxuser)) {
open(FILE,">$filetoopen");
flock(FILE, 2) if ($OS_USED eq "Unix");
foreach $line (@onlinedata) {
chomp $line;
print FILE "$line\n" if ($line ne "");
}
close(FILE);
}
&winunlock($filetoopen);
}
}
if (($thisprog eq $forumsummaryprog)||($thisprog eq $forumsprog)||($thisprog eq $threadprog)) {
my $addcountflag = 0;
$onlinemax = @onlinedata;
foreach $line (@onlinedata1) {
chomp $line;
($savedusername, $savedcometime, $savedtime, $savedwhere, $saveipaddress, $saveosinfo, $savebrowseinfo, $savedwhere2, $fromwhere) = split(/\t/, $line);
if ($tempusername eq $savedusername) {
$addcountflag =1;
last;
}
}
$filetomake = "$lbdir" . "data/counter.cgi";
my $countfiles=1 if (-e "$filetomake");
&winlock($filetomake);
open(FILE,"$filetomake");
flock (FILE, 1) if ($OS_USED eq "Unix");
my $count = <FILE>;
close(FILE);
&winunlock($filetomake);
($count1,$count2,$onlinemax1,$onlinemaxtime1) = split(/\t/, $count);
$onlinemaxtime = time;
$onlinemaxtime1 = time if ($onlinemaxtime1 eq "");
$count2++;
$count1++ if ($addcountflag == 0);
$count1=0 if ($count1 eq "");
if ($onlinemax < $onlinemax1) {
$onlinemax = $onlinemax1;
$onlinemaxtime = $onlinemaxtime1;
}
unless (($count2 eq 1)&&($countfiles eq 1)) {
if (!(-e "$filetomake.lck")) {
if (($count1 ne 0)&&($count2 ne 0)&&($count1 ne "")&&($count2 ne "")&&($onlinemax ne 0)&&($onlinemax <= 2000)) {
&winlock($filetomake);
open(FILE, ">$filetomake");
flock (FILE, 2) if ($OS_USED eq "Unix");
print FILE "$count1\t$count2\t$onlinemax\t$onlinemaxtime\t";
close(FILE);
&winunlock($filetomake);
}
}
}
}
undef @onlinedata1;
if ($method eq "both") {
$memberoutput =" ";
$memberoutput1 =" ";
my $lengthmark= 0;
foreach my $line (@onlinedata) {
chomp $line;
(my $savedusername, my $savedcometime, my $savedtime, my $savedwhere, my $postipaddresstemp, my $saveosinfo, my $savebrowseinfo, my $savedwhere2, my $fromwhere, my $memcod) = split(/\t/, $line);
if ($memcod eq "ad") {$mspic=0;}
elsif ($memcod eq "smo") {$mspic=3;}
elsif ($memcod eq "mo") {$mspic=4;}
else {$mspic=1;}
(my $lookfor, my $no) = split(/\(/,$savedusername);
($savedipaddress,$truepostipaddress) = split(/\=/,$postipaddresstemp);
$fromwhere = "已设置保密" unless (($pvtip eq "on")||($membercode eq "ad")||(($membercode eq 'smo')&&($smocanseeip eq "no")));
(my $ip1, my $ip2, my $ip3, my $ip4) = split(/\./,$savedipaddress);
if ($membercode eq "ad") {
$savedipaddress="$ip1.$ip2.$ip3.$ip4";
}
elsif ($membercode eq "smo") {
if ($smocanseeip eq "no") { $savedipaddress="$ip1.$ip2.$ip3.$ip4"; }
else {
if ($pvtip eq "on") { $savedipaddress="$ip1.$ip2.$ip3.$ip4"; }
else { $savedipaddress="已设置保密"; }
}
}
elsif ($membercode eq "mo") {
if ($pvtip eq "on") { $savedipaddress="$ip1.$ip2.$ip3.*"; }
else { $postipaddress="已设置保密"; }
}
else {
if (($pvtip eq "on")&&($inmembername ne "客人")) {
$savedipaddress="$ip1.$ip2.*.*";
}
else { $savedipaddress="已设置保密"; }
}
$savedcometime = &dateformatshort($savedcometime + ($timezone*3600) + ($timedifferencevalue*3600));
$savedtime = &dateformatshort($savedtime + ($timezone*3600) + ($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 $checkhidden=0;
if ($lookfor !~/\(/ && $lookfor =~/\)/ ){$lookfor="客人";}
my $guestmode=$screenmode*2-1;
foreach (@hiddenmember){
if ($_=~/^$lookfor/) {
$guests++;
$checkhidden=1;
if ($_ ne "客人") {
$memberoutput1 .= qq~<img src=$imagesurl/images/messages2.gif width=12 height=11 alt=请勿打扰!><a href=# nowarp TITLE=\"来访时间:$savedcometime\n活动时间:$savedtime\nIP地址:$savedipaddress\n来源鉴定:$fromwhere\">隐身</a> ~;
$memberoutput1 .= qq~<br> ~ if ($guests == int($guests/$guestmode)*$guestmode);
}
else {
$memberoutput1 .= qq~<img src=$imagesurl/images/messages2.gif width=12 height=11 alt=快注册呀!><a href=# nowarp TITLE=\"目前位置:$savedwhere\n目前动作:$savedwhere2\n来访时间:$savedcometime\n活动时间:$savedtime\n操作系统:$saveosinfo\n浏 览 器:$savebrowseinfo\nIP地址:$savedipaddress\n来源鉴定:$fromwhere\">客人</a> ~;
$memberoutput1 .= qq~<br> ~ if ($guests == int($guests/$guestmode)*$guestmode);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -