окей, ловите люди.
может поможет:
Код: # Who's online feature.
sub whosonline {
local($instruct) = @_;
($tempusername, $where, $method) = split(/\|/, $instruct);
$guests = 0;
$members = 0;
$currenttime = time;
$membergone = 30;
$userexpire = $currenttime - ($membergone * 60);
$ipaddress = $ENV{'REMOTE_ADDR'};
$logname = $tempusername;
&getmember("$inmembername");
$tempusername = "$ibtxt{'0043'} $ipaddress" if ($tempusername eq "$ibtxt{'0043'}");
$filetoopen = "$ikondir" . "data/onlinedata.dat";
$filetoopen = &stripMETA($filetoopen);
open(FILE,"$filetoopen");
@onlinedata = <FILE>;
close(FILE);
open(FILE,">$filetoopen");
flock(FILE, 2);
$memberprinted = "no";
foreach $line (@onlinedata) {
chomp $line;
($savedusername, $savedtime, $savedwhere) = split(/\|/, $line);
$savedusername =~ s/\_/ /g;
$tempusername =~ s/\_/ /g;
$savedusername = &unHTML($savedusername);
$tempusername = &unHTML($tempusername);
unless ("$userexpire" > "$savedtime") {
if ("$savedusername" ne "$tempusername") { print FILE "$line\n"; }
elsif ("$savedusername" eq "$tempusername") { print FILE $savedusername."|$currenttime|$where\n"; $memberprinted = "yes";}
}
} # end foreach
if ($memberprinted eq "no") { print FILE "$tempusername|$currenttime|$where\n";}
close(FILE);
$referer = $ENV{'HTTP_REFERER'};
$browser = $ENV{'HTTP_USER_AGENT'};
$media = $ENV{'HTTP_ACCEPT'};
if ($method eq "$ibtxt{'0016'}") {
$filetoopen = "$ikondir" . "data/onlinedata.dat";
$filetoopen = &stripMETA($filetoopen);
open(FILE,"$filetoopen");
@onlinedata = <FILE>;
close(FILE);
foreach $line (@onlinedata) {
chomp $line;
($savedusername, $savedtime, $savedwhere) = split(/\|/, $line);
$lookfor = substr($savedusername, 0, 5);
if ($lookfor eq "$ibtxt{'0043'}") { $guests++; }
else {
$members++;
$cleanmember = $savedusername;
$cleanmember =~ s/ /\_/g;
$savedusername = substr($savedusername,0,20) if length $savedusername > 19;
$memberoutput .= qq~» <a href="$profileprog?action=show&member=$cleanmember">$savedusername </a>~;
}
}
}
} # end routine