UBB.Dev
Posted By: RandyM IP list - 09/02/2002 12:55 AM
How about a way to dump a list containing 5 columns;

1. Member #

2. login names

3. public names

4. last post IP

5. registration IP

It would be really helpful to be able to access this data. Any ideas?
Posted By: 1QuickSI Re: IP list - 09/02/2002 4:12 AM
Idle, has an advanced IP recording modification that really is great. Does not break it down as you are looking but does list all the IPs the user has come in under.
Posted By: RandyM Re: IP list - 09/02/2002 4:41 AM
I have that installed thanks, I'm looking for something that will dump all users into a flat file with those columns. I would like to import it into a spreadsheet or a database and make it searchable outside of the UBB.
Posted By: syswsb Re: IP list - 09/02/2002 3:32 PM
I have a script that I think will do what you want. Minor difference is that it also scans all the posts to get ANY ip they've EVER posted from. It also only adds an ip if its not a duplicate of one already extracted.

You can remove the routine to scan the posts if you like (as well as the check for duplicates).

Here it is, just change $path to run it and see what you get. You might also have to bump @ips up if you have more than 1000 members (to avoid an "uninitialized value" message).

Hope this helps.

Code
#!/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") &#0124;&#0124; 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);
Posted By: mb Re: IP list - 05/01/2003 4:24 AM
Bill,
I want to be able to dump all the member fields that I have out to the flat file. Is there a quick way to articulate how to modify the script to get everything?

Thanks!
Marianne
Posted By: syswsb Re: IP list - 05/08/2003 2:59 PM
Sorry I took so long to respond, but yes, I've emailed you a script to output all the fields.

Let me know if you have any questions laugh
© UBB.Developers