This script from packet: hubwebstats lua5 (http://www.wooshman.ath.cx/downloads) uses files *.dat. But new PtokaX DC Hub 0.3.3.21 uses files *.xml. I would like that this script could read xml files. If it is possible please modify it for xml files used in the newest Ptokax.
## PART ONE ##
#!c:/perl/bin/perl.exe
#!/usr/bin/perl
# CHANGE ABOVE LINE ACCORDING TO YOUR OS AND WEB SERVER
#############################################################
# #
# Ptokax Hub Stats via web page #
# wooshman@thelandofkaraoke.ath.cx #
# landofkaraoke.ath.cx #
# landofkaraoke2.ath.cx #
# #
# #
# Displays Current online users, owners/masters, ops, #
# vips and regs. Shows if the hub is on or offline. #
# Shows number of users in the hub. #
# Also displays all Permbanned users. #
# #
# This script must be used in conjuntion with webstats.lua #
# by WooshMan to allow for the hub status and online #
# users to be displayed. Without that only pbanned #
# users will be displayed and reg'ed members of the #
# hub #
# #
# Version: 1.0 - Date: 12 March 2004 #
# #
# Email wooshman@thelandofkaraoke.ath.cx for #
# suggestions, bugs or script addition requests. #
# #
# Please keep this header intact. #
# #
# INTRUCTIONS #
# Change the paths and locations below and also your #
# colour preferences in page templates. #
# You do not need to change anything below that. #
#############################################################
use CGI;
use CGI::Carp qw(fatalsToBrowser);
use LWP::UserAgent;
my $cgi = new CGI;
## CHANGES GO HERE ##
######################################
# Configure paths / locations
$pagetitle = "LOK Stats"; # Page title for Internet Explorer
$hubname = "landofkaraoke.ath.cx"; # Name of hub
$partofnetwork = 1; # Is Hub part of network 0 = no, 1 = yes
$networkname = "UKIA"; # If part of a network, put network name only. Web page will read "Part of the xxxx Network"
$ptokax = "c:/ptokax/"; # Exact path to ptokax. Include trailing /
$hubstat = "yes"; # Always show the online/offline and current user count status of hub on all pages? Yes or No
######################################
# Page Templates
$tablecol = "red"; # Table Background colour. red / white / black / blue / green
$textstyle = "verdana"; # Text Style (font). arial / verdana / georgia
$bgcolour = "#ffffcc"; # Colour of web page background. Value in Hex. #ffffff is white, #000000 is black.
## END OF CHANGES ##
#########################################################################################
#########################################################################################
###### DO NOT CHANGE ANYTHING BELOW THIS LINE UNLESS YOU KNOW WHAT YOU ARE DOING ######
#########################################################################################
#########################################################################################
$permban = $ptokax ."/PermBan.dat";
$online = $ptokax ."scripts/webstats/userlist.txt";
$countusers = $ptokax ."scripts/webstats/count.lst";
$red = "#ff0000";
$whilte = "#ffffff";
$black = "#000000";
$blue = "#0000ff";
$green = "#00ff00";
########################################
## Setup of main page
########################################
print $cgi ->header;
print qq(
$pagetitle
Welcome to $hubname
);
if ($partofnetwork == "1") {
print qq(
Part of the $networkname Network);
}
else {
print qq(
);
}
print qq(
|
|
|
|
|
|
);
if ($hubstat eq "no") {
print qq(
|
);
}
print qq(
);
if ($hubstat eq "yes") {
&online;
if (@raw_data < 1) {
print qq(
$hubname is Offline);
} else
{
&countusers;
print qq(
$hubname is OnlineThere is currently $count users in the hub);
}
}
print qq(
);
################################
## admin link clicked
###############################
if($ENV{'QUERY_STRING'} =~ /^admin/) {
print "
\n";
print "$hubname Hub Owners / Admins
\n";
print "
\n";
print "\n";
#open data file
open(DAT, $ptokax ."RegisteredUsers.dat") || die("Could not open file!");
@raw_data=;
close(DAT);
#Sort by value of userlevel
$x = 2; # this is the column to sort
@sorted_data = sort {
@a = split(/\|/, $a);
@b = split(/\|/, $b);
$a[$x] <=> $b[$x];
} @raw_data;
foreach $users (@sorted_data) {
chomp($users);
($username,$password,$userlev)=split(/\|/,$users);
if ($userlev == 0) {
$userlevel = "Owner";
print "$username | $userlevel |
\n";
}
}
print "
\n";
end
}
## END OF PART ONE ##
################################
## Op link clicked
###############################
if($ENV{'QUERY_STRING'} =~ /^ops/) {
print "\n";
print "$hubname Hub Operators
\n";
print "
\n";
print "\n";
#open data file
open(DAT, $ptokax ."RegisteredUsers.dat") || die("Could not open file!");
@raw_data=;
close(DAT);
#Sort by value of userlevel
$x = 2; # this is the column to sort
@sorted_data = sort {
@a = split(/\|/, $a);
@b = split(/\|/, $b);
$a[$x] <=> $b[$x];
} @raw_data;
print "User Name | User Level |
\n";
foreach $users (@sorted_data) {
chomp($users);
($username,$password,$userlev)=split(/\|/,$users);
if ($userlev == 1) {
$userlevel = "Op";
print "$username | $userlevel |
\n";
}
}
end
}
################################
## VIP link clicked
###############################
if($ENV{'QUERY_STRING'} =~ /^vip/) {
print "\n";
print "$hubname Hub VIP's
\n";
print "
\n";
print "\n";
#open data file
open(DAT, $ptokax ."RegisteredUsers.dat") || die("Could not open file!");
@raw_data=;
close(DAT);
#Sort by value of userlevel
$x = 2; # this is the column to sort
@sorted_data = sort {
@a = split(/\|/, $a);
@b = split(/\|/, $b);
$a[$x] <=> $b[$x];
} @raw_data;
print "User Name | User Level |
\n";
foreach $users (@sorted_data) {
chomp($users);
($username,$password,$userlev)=split(/\|/,$users);
if ($userlev == 2) {
$userlevel = "VIP";
print "$username | $userlevel |
\n";
}
}
end
}
################################
## Reg link clicked
###############################
if($ENV{'QUERY_STRING'} =~ /^reg/) {
print "\n";
print "$hubname Hub Regs
\n";
print "
\n";
print "\n";
#open data file
open(DAT, $ptokax ."RegisteredUsers.dat") || die("Could not open file!");
@raw_data=;
close(DAT);
#Sort by value of userlevel
$x = 2; # this is the column to sort
@sorted_data = sort {
@a = split(/\|/, $a);
@b = split(/\|/, $b);
$a[$x] <=> $b[$x];
} @raw_data;
print "User Name | User Level |
\n";
foreach $users (@sorted_data) {
chomp($users);
($username,$password,$userlev)=split(/\|/,$users);
if ($userlev == 3) {
$userlevel = "Reg";
print "$username | $userlevel |
\n";
}
}
end
}
################################
## Online Users link clicked
###############################
if($ENV{'QUERY_STRING'} =~ /^online/) {
print "\n";
print "Current Users Online
\n";
print "
\n";
print "\n";
&online;
if (@raw_data < 1) {
print "\n";
print "The Hub is currently OffLine |
\n";
exit;
}
else {
#open data file
open(DAT, $online);
@raw_data=;
close(DAT);
#Sort by value of logo
$x = 1; # this is the column to sort
@sorted_data = sort {
@a = split(/\|/, $a);
@b = split(/\|/, $b);
$a[$x] <=> $b[$x];
} @raw_data;
print "User Name | User Level | Connected Details |
\n";
foreach $users (@sorted_data) {
chomp($users);
($crap, $ip, $username,$level,$conned)=split(/\|/,$users);
print "$username | $level | $conned |
\n";
}}
end;
}
################################
## pban link clicked
###############################
if($ENV{'QUERY_STRING'} =~ /^pban/) {
print "\n";
print "$hubname Hub Permanently Banned Users
\n";
print "
\n";
print "\n";
#open data file
open(DAT, $permban); ##|| die("Could not open file!");
@raw_data=;
close(DAT);
print "IP Address | Nick or Reason Banned |
\n";
foreach $users (@raw_data) {
chomp($users);
($ip,$reason)=split(/\|/,$users);
print "$ip | $reason |
\n";
}
}
################################
## hub status link clicked
###############################
if($ENV{'QUERY_STRING'} =~ /^stats/) {
print "\n";
print "$hubname Hub Status
\n";
print "
\n";
&online;
if (@raw_data < 1) {
print "\n";
print "The Hub is currently OffLine |
\n";
exit;
}
print "\n";
print "The Hub is Online |
\n";
end;
}
########################################################
sub online {
open(DAT, $ptokax ."scripts/webstats/hubonline.dat");
@raw_data=;
close(DAT);
}
sub countusers {
open(DAT, $ptokax ."scripts/webstats/count.lst");
@raw_data=;
close(DAT);
foreach $counter (@raw_data) {
chomp($users);
($num)=split(/\|/,$counter);
}
$count = $num
}
## END ##