PDA

View Full Version : Webpage status perl script


Hitman69
09-07-2004, 06:46
Heres a small perl script I wrote to display the current users on teamspeak.

## START SCRIPT #######################################
#!/usr/bin/perl
use CGI::Carp qw(fatalsToBrowser);
print "Content-Type: text/html\n\n";

use IO::Socket;

## Variables ################################################## ##
$host = "your ip address";
$port = "8767";

$remote = IO::Socket::INET->new(
Proto => "tcp",
PeerAddr => "$host",
PeerPort => "51234",
) or cancel("cannot connect to port at $host");

print <<EndOfHtml;
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
<HEAD>
<TITLE>TeamSpeak Status</TITLE>
</HEAD>
<BODY TEXT="#FFB937" BGCOLOR="#000000" LINK="#AE7200" ALINK="#FFFFFF"
VLINK="#AE7200" frameborder="0" border=0 framespacing="0" topmargin="0" leftmargin="0">
<FONT SIZE="-2" FACE="Verdana" COLOR="#FFFFFF">
ONLINE USERS:<BR><BR></font>
<FONT SIZE="-2" FACE="Verdana" COLOR="#AE7200">
EndOfHtml

$line = <$remote>;
print $remote "pl $port\n";
$line = <$remote>;
&get_line;

sub get_line{

$line = <$remote>;
$line =~ s/\s*$//;
($p_id, $c_id, $ps, $bs, $pr, $br, $pl, $ping, $logintime, $idletime, $cprivs, $pprivs, $pflags, $ip, $nick, $loginname) = split(/\s/, $line);

if($line eq "OK"){
&cancel;
}
else{
&print_line;
}
}

sub print_line{
print "$nick<BR>";
&get_line;
}

sub cancel{
print "<BR><B><A HREF=\"teamspeak://$host:$port\">Join TeamSpeak</B></A>";
print "</BODY></HTML>";
exit;
}
exit;
## END SCRIPT ########################################

I've got a demo of it up and running at:
http://mob.ods.org:88/

Hope this can help some people :)
Hitman.

Michael
13-07-2004, 21:35
Can anyone write a simple HowTo to install this script? (Am besten in Deutsch :D )

Hitman69
16-07-2004, 05:29
Can anyone write a simple HowTo to install this script? (Am besten in Deutsch :D )

Ok I wrote a small Installation page for the TeamSpeak perl status script

http://trn.ods.org:88/ts_install.htm

AOD*Cruiser
21-07-2004, 22:53
looks good any chance it will be done for php nuke

krenjon
21-07-2004, 23:32
i think in php nuke you got the option to insert a own block right? so if ya webspace supports pearl, just make a new block and insert the code...