hubwebstats modify to xml
 

News:

29 December 2022 - PtokaX 0.5.3.0 (20th anniversary edition) released...
11 April 2017 - PtokaX 0.5.2.2 released...
8 April 2015 Anti child and anti pedo pr0n scripts are not allowed anymore on this board!
28 September 2015 - PtokaX 0.5.2.1 for Windows 10 IoT released...
3 September 2015 - PtokaX 0.5.2.1 released...
16 August 2015 - PtokaX 0.5.2.0 released...
1 August 2015 - Crowdfunding for ADC protocol support in PtokaX ended. Clearly nobody want ADC support...
30 June 2015 - PtokaX 0.5.1.0 released...
30 April 2015 Crowdfunding for ADC protocol support in PtokaX
26 April 2015 New support hub!
20 February 2015 - PtokaX 0.5.0.3 released...
13 April 2014 - PtokaX 0.5.0.2 released...
23 March 2014 - PtokaX testing version 0.5.0.1 build 454 is available.
04 March 2014 - PtokaX.org sites were temporary down because of DDOS attacks and issues with hosting service provider.

Main Menu

hubwebstats modify to xml

Started by Marco52, 07 August, 2005, 00:04:58

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Marco52

This script from packet: hubwebstats lua5 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 Online There 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 "\n"; } } print "
$username$userlevel
\n"; end }

## END OF PART ONE ##

Marco52

#1
################################
## 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 "\n"; foreach $users (@sorted_data) { chomp($users); ($username,$password,$userlev)=split(/\|/,$users); if ($userlev == 1) { $userlevel = "Op"; print "\n"; } } end } ################################ ## VIP link clicked ############################### if($ENV{'QUERY_STRING'} =~ /^vip/) { print "
User NameUser Level
$username$userlevel
\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 "\n"; foreach $users (@sorted_data) { chomp($users); ($username,$password,$userlev)=split(/\|/,$users); if ($userlev == 2) { $userlevel = "VIP"; print "\n"; } } end } ################################ ## Reg link clicked ############################### if($ENV{'QUERY_STRING'} =~ /^reg/) { print "
User NameUser Level
$username$userlevel
\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 "\n"; foreach $users (@sorted_data) { chomp($users); ($username,$password,$userlev)=split(/\|/,$users); if ($userlev == 3) { $userlevel = "Reg"; print "\n"; } } end } ################################ ## Online Users link clicked ############################### if($ENV{'QUERY_STRING'} =~ /^online/) { print "
User NameUser Level
$username$userlevel
\n"; print "

Current Users Online

\n"; print "
\n"; print "
\n"; &online; if (@raw_data < 1) { print "
\n"; print "\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 "\n"; foreach $users (@sorted_data) { chomp($users); ($crap, $ip, $username,$level,$conned)=split(/\|/,$users); print "\n"; }} end; } ################################ ## pban link clicked ############################### if($ENV{'QUERY_STRING'} =~ /^pban/) { print "
The Hub is currently OffLine
User NameUser LevelConnected Details
$username$level$conned
\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 "\n"; foreach $users (@raw_data) { chomp($users); ($ip,$reason)=split(/\|/,$users); print "\n"; } } ################################ ## hub status link clicked ############################### if($ENV{'QUERY_STRING'} =~ /^stats/) { print "
IP AddressNick or Reason Banned
$ip$reason
\n"; print "

$hubname Hub Status

\n"; print "
\n"; &online; if (@raw_data < 1) { print "
\n"; print "\n"; exit; } print "
The Hub is currently OffLine
\n"; print "\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 ##

SMF spam blocked by CleanTalk
The Hub is Online