Can someone please tell me how to call this from my Ultimate.cgi so it will display the ubb stats. I run my ubb on a NT server, does that matter?
here is the ubbstats.pl file.
thanks!
#!/usr/bin/perl
#change this file to ubbstats.pl
print ("Content-type: text/htmlnn");
# Define the variables please
# Example $MembersPath = "/home/yourpathto/cgi-bin/ubbcgi/Members";
$MembersPath = "/cgi-bin/Members";
# Example $UBBPath = "/home/yourpathto/cgi-bin/ubbcgi";
$UBBPath = "/cgi-bin";
# No need to edit below this line unless you know what your doing
# Open the memberlist
open (MEMBFILE, "<$MembersPath/memberslist.cgi") or die ("Can't open file: $MembersPath/memberslist.cgi!");
# Require the rest of the files
require $UBBPath . "/UltBB.setup";
require $UBBPath . "/Styles.file";
require $UBBPath . "/UltBB.setup";
# set the active thread count to 1 for the last post time (is there a more efficent way of doing this?
$num_threads = 1;
# Initialise the counts to zero
$cnt = 0;
$cntforums = 0;
$TotPosts = 0;
# Start processing
while ($line =
) {
chomp($line);
($name, $unknown, $userno) = split(/|/, $line);
open (USRFILE, "<$MembersPath/$userno.cgi") or die ("Can't open file: $MembersPath/userno.cgi!");
for ($i=0; $i < 7; $i++) {
$line = ;
if ($i == 2) {$mailto = $line};
}
$place = $line;
chomp($place);
chomp($mailto);
$line = ;
$TotPosts += $line;
$posts = sprintf("%7d", $line);
for ($i=0; $i < 4; $i++) {
$line = ;
}
close (USRFILE);
$memblist[$cnt++];
}
close (MEMBFILE);
$NoMembers = $cnt;
@newlist = sort {$b cmp $a} @memblist;
@forumlines = ("");
open(FORUMS, "<$UBBPath/forums.cgi") || die "Could not open forums.cgin";
while( )
{
push(@forumlines,$_);
$cntforums++;
}
close(FORUMS);
open (F,"$UBBPath/forums.cgi");
while ( ) {
(@parts) = split(/|/,$_);
push @forums, $parts[8];
}
close F;
foreach $forum (@forums) {
$filetoopen = $NonCGIPath . "/Forum" . $forum . "/forum" . $forum . ".threads";
open (T,"$filetoopen");
while ( ) {
(@threads) = split(/|/,$_);
$numdate = $threads[10];
$year = substr ($numdate,0,4);
$month = substr ($numdate,4,2);
$day = substr ($numdate,6,2);
$hour = substr ($numdate,8,2);
$min = substr ($numdate,10,2);
@months = ("","January","February","March","April","May","June","July","August","September","October","November","December");
$ExpandedMonth = $months[$month];
$Date = "$ExpandedMonth $day, $year at $hour:$min";
$ordered = "$threads[10]|$threads[4]|$threads[2]|$Date|$forum";
push @allthreads, $ordered;
}
close T;
}
@sortedthreads = sort {$b cmp $a} @allthreads;
$x = 0;
for (@sortedthreads) {
$x++;
unless ($x > $num_threads) {
(@threaddata) = split(/|/,$_);
}
}
open (F,"$MembersPath/memberslist.cgi");
@members = ;
close F;
$featured = $members[int(rand(@members))];
(@member) = split(/|/,$featured);
chomp($member[2]);
$filetoopen = $member[2] . ".cgi";
open (M,"$MembersPath/$filetoopen");
while () {
chomp;
push @mdata, $_;
}
close M;
# Last member
@lastmember = reverse(@members);
$LastReg = $lastmember[0];
($user,$number)=split(/|!!|/,$LastReg);
$LastRegCoded = $LastReg;
chomp($LastReg);
($username,$junk,$number)=split(/|/,$LastReg);
# Print the output
print<
$BBName |
There are currently $NoMembers members |
We have $cntforums forums |
We have had $TotPosts contibutions |
Last post $threaddata[3] |
Todays featured member is $mdata[0] |
Last member to register is $username |
TOTALPOSTS