#!/usr/bin/perl -w
use strict;
use LWP::Simple qw(get);
my $path="/xxx/xxx/xxxxxx";
####################
# extract ips by member
####################
my $DATE=localtime(time);
my $ip="";
my $posts="";
my @posts="";
my $filename="";
my $line="";
my @bpost="";
my $bpost="";
my $memnum=0;
my $mcnt=0;
my @ips=("") x 1000;
my $ips="";
my @ln="";
my $ln="";
my @pdn="";
my $pdn="";
my $ipctr=1;
my $test="";
my $ctr=0;
###################################
# print the document header stuff #
###################################
#################################################################
# main routine, loop thru each member record #
#################################################################
open(J,">$path/cgi-bin/iplist.txt");
# get member records
opendir (POSTLIST, "$path/cgi-bin/Members") || die "Cannot open member records";
@posts=grep (/cgi/, readdir POSTLIST);
# process each
foreach $filename (@posts) {
if(substr($filename,0,1) eq "0") {
open(P,"$path/cgi-bin/Members/$filename");
$ctr=0;
$memnum=$filename;
$test=index(".",$filename);
$memnum=substr($memnum,0,$test-3);
while(defined($line=
)) {
$ctr++;
chomp($line);
if($ctr==1) {$ln[$memnum]=$line;}
if($ctr==16) {$pdn[$memnum]=$line;}
if($ctr==34){
$ip=$line;
if(index($ips[$memnum],$ip) < 0){$ips[$memnum]=$ips[$memnum]." $ip";}
} # end of ctr=34
if($ctr==24){
$ip=$line;
$test=index("|",$line);
if($test>0){
$ip=substr($ip,$test+1);
if(index($ips[$memnum],$ip) < 0){$ips[$memnum]=$ips[$memnum]." $ip";}
} # end of $test
} # end of ctr=24
} # end of member file
close(P);
} # end of look for 0 in filename
} # end of $filenames
closedir(POSTLIST);
# get files
@posts="";
opendir(POSTLIST, "$path/cgi-bin/Members/user_posts") || die "Cannot open /files/: $!";
@posts=grep (/cgi/, readdir POSTLIST);
# process each file
foreach $filename (@posts) {
open(P,"$path/cgi-bin/Members/user_posts/$filename");
# process each line
while(defined($line=
)) {
chomp($line);
@bpost=split(/|/,$line);
$memnum=$filename;
$test=index(".",$filename);
$memnum=substr($memnum,0,$test-3);
#print "$memnumn";
$ip=$bpost[4];
if(index($ips[$memnum],$ip) < 0) {$ips[$memnum]=$ips[$memnum]." $ip";}
} # end of each file
close(P);
} # end of $filenames
closedir(POSTLIST);
while($ipctr<=$#ips) {
if($ips[$ipctr]) {print J substr("00000000".$ipctr,length("00000000".$ipctr)-8)." $ln[$ipctr] $pdn[$ipctr] $ips[$ipctr]n";}
$ipctr++;
} #end of array
close(J);