#####################################################
#  LEO SuperCool BBS / LeoBBS X / 雷傲極酷超級論壇  #
#####################################################
# 基於山鷹(糊)、花無缺製作的 LB5000 XP 2.30 免費版  #
#   新版程式製作 & 版權所有: 雷傲科技 (C)(R)2004    #
#####################################################
#      主頁地址： http://www.LeoBBS.com/            #
#      論壇地址： http://bbs.LeoBBS.com/            #
#####################################################

sub addadminlog {
	my ($message, $intopic) = @_;
	my $logtime = time;
	my $trueipaddress = $ENV{"HTTP_CLIENT_IP"};
	$trueipaddress = $ENV{"HTTP_X_FORWARDED_FOR"} if ($trueipaddress eq "" || $trueipaddress eq "unknown" || $trueipaddress =~ m/^192\.168\./ || $trueipaddress =~ m/^10\./);
	$trueipaddress = "no" if ($trueipaddress eq "" || $trueipaddress eq "unknown" || $trueipaddress =~ m/^192\.168\./ || $trueipaddress =~ m/^10\./);

	my $filetomake = "${lbdir}boarddata/adminlog$inforum.cgi";
	&winlock($filetomake) if ($OS_USED eq "Nt");
	open(FILE, ">>$filetomake");
	flock(FILE, 2) if ($OS_USED eq "Unix");
	print FILE "$inmembername\t$logtime\t$intopic\t$ENV{'REMOTE_ADDR'}\t$trueipaddress\t$message\n";
	close(FILE);
	&winunlock($filetomake) if ($OS_USED eq "Nt");
	return;
}
1;
