Previous Thread
Next Thread
Print Thread
Rate Thread
#54541 09/02/2002 8:32 AM
Joined: Nov 2001
Posts: 12
Junior Member
Junior Member
Offline
Joined: Nov 2001
Posts: 12
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);

Sponsored Links
Entire Thread
Subject Posted By Posted
IP list RandyM 09/02/2002 12:55 AM
Re: IP list 1QuickSI 09/02/2002 4:12 AM
Re: IP list RandyM 09/02/2002 4:41 AM
Re: IP list syswsb 09/02/2002 3:32 PM
Re: IP list mb 05/01/2003 4:24 AM
Re: IP list syswsb 05/08/2003 2:59 PM

Link Copied to Clipboard
Donate Today!
Donate via PayPal

Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.

Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.
Recommended Hosts
We have personally worked with and recommend the following Web Hosts:
Stable Host
bluehost
InterServer
Visit us on Facebook
Member Spotlight
Zarzal
Zarzal
Berlin, Germany
Posts: 808
Joined: July 2001
Forum Statistics
Forums63
Topics37,574
Posts293,926
Members13,850
Most Online5,166
Sep 15th, 2019
Today's Statistics
Currently Online
Topics Created
Posts Made
Users Online
Birthdays
Top Posters
AllenAyres 21,079
JoshPet 10,369
LK 7,394
Lord Dexter 6,708
Gizmo 5,833
Greg Hard 4,625
Top Posters(30 Days)
Top Likes Received
isaac 82
Gizmo 20
Brett 7
WebGuy 2
Morgan 2
Top Likes Received (30 Days)
None yet
The UBB.Developers Network (UBB.Dev/Threads.Dev) is ©2000-2024 VNC Web Services

 
Powered by UBB.threads™ PHP Forum Software 8.0.0
(Preview build 20240506)