View Full Version : Perl Webpost Script
Hitman69
10-07-2004, 18: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.
hescominsoon
14-09-2004, 17:16
is thee a way to have it insert the username anonymous and the server's password into the client?
hescominsoon
14-09-2004, 18:09
I would like to thank hitman for taking the time to modify this..this version allows you to log onto passowrd protected servers as well. It also breaks down the dislplay by channel.
here is the code:
--------------------------------------------------------------------------
#! C:/Perl/bin/Perl.exe
use CGI::Carp qw(fatalsToBrowser);
print "Content-Type: text/html\n\n";
use IO::Socket;
$indata = $ENV{'QUERY_STRING'};
$indata =~ s/\n//g;
$server_port = "<your port>";
$host = "<your server>";
$port = "<your port>";
$username = "<username>";
$passwd = "<your password>";
$ch_id = 0;
my @channels = ();
$remote = IO::Socket::INET->new(
Proto => "tcp",
PeerAddr => "$host",
PeerPort => "$port",
) or print "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>
EndOfHtml
$line = <$remote>;
print $remote "login $username $passwd\n";
$line = <$remote>;
print $remote "cl $server_port\n";
$line = <$remote>;
#print $line;
&get_channels;
sub get_channels{
$line = <$remote>;
$line =~ s/\s*$//;
($id1, $name, $flags, $topic) = split(/"/, $line);
#($id, $codec, $parent, $order, $maxusers) = split(/\s/, $id1);
if($line eq "OK"){
print $remote "pl $server_port\n";
&get_line;
exit;
}
else{
push(@channels, "$name");
&get_channels;
}
}
sub get_line{
$line = <$remote>;
$line =~ s/\s*$//;
($n_id, $bs, $bs1, $nick, $bs2, $loginname) = split(/"/, $line);
($p_id, $c_id, $ps, $bs, $pr, $br, $pl, $ping, $logintime, $idletime, $cprivs, $pprivs, $pflags, $ip, ) = split(/\s/, $n_id);
if($line eq "OK"){
&cancel;
}
else{
&print_line;
}
}
sub print_line{
$ch_id = $c_id - 1;
if($c_id eq "c_id"){
print "<font face=\"verdana\" size=-1><B>TS Server Status Port</B> $indata<BR>";
&get_line;
}
else{
print "<B><font face=\"verdana\" size=-2>$nick</B> ($channels[$ch_id])</font><BR>";
&get_line;
}
}
sub cancel{
$cound = push(@channels);
print "<B><font face=\"verdana\" size=-2><A HREF=\"teamspeak://trn.ods.org:$indata\">Join TeamSpeak</B></A></font>";
exit;
}
exit;
-------------------------------------------------------------------------
Knuddesoft
10-10-2004, 12:29
I have tried this script, but I don't se the members, this is the SERVER (http://teamspeak.thaskullman.nl/cgi-bin/test.pl) is should check
Knuddesoft
12-10-2004, 10:36
I have found another script in this forum that is working
The: $ts_port variable were not defined :eek:
Hitman69
29-11-2004, 17:34
Sorry it took so long for this reply !
I wrote some instructions for the script that can be downloaded here:
http://trn.ods.org:88/ts_install.htm
As for accessing the ts server with a user and password, you can try the script above but I suggest that you use the url method to log into your server. Its possible to use your websites user info to log them in automaticly, but that would take a little coding :)
Regards, Hitman.
Bah.. keep getting an error.
[an error occurred while processing this directive]
I get a 500 error when visiting the site.
Any ideas?
Hitman69
04-12-2004, 19:16
Kinda hard to say what the problem is with so little info, but it looks like its not processing the virtual include if thats the way your calling the script.
with a little more info I could maybe help you with it.
I've got the script up and running here: http://mob.ods.org:88/
Regards Hitman.
Hitman69
21-03-2006, 14:16
This is the final release of this script, I've tested it for over a year now with no problems.
http://software.itawk.com
Enjoy, Hitman.
Lost Elric
15-04-2006, 18:53
--------------------------------------------------------------------------
#! C:/Perl/bin/Perl.exe
use CGI::Carp qw(fatalsToBrowser);
print "Content-Type: text/html\n\n";
use IO::Socket;
$indata = $ENV{'QUERY_STRING'};
$indata =~ s/\n//g;
$server_port = "<your port>";
$host = "<your server>";
$port = "<your port>";
$username = "<username>";
$passwd = "<your password>";
$ch_id = 0;
my @channels = ();
$remote = IO::Socket::INET->new(
Proto => "tcp",
PeerAddr => "$host",
PeerPort => "$port",
) or print "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>
EndOfHtml
$line = <$remote>;
print $remote "login $username $passwd\n";
$line = <$remote>;
print $remote "cl $server_port\n";
$line = <$remote>;
#print $line;
&get_channels;
sub get_channels{
$line = <$remote>;
$line =~ s/\s*$//;
($id1, $name, $flags, $topic) = split(/"/, $line);
#($id, $codec, $parent, $order, $maxusers) = split(/\s/, $id1);
if($line eq "OK"){
print $remote "pl $server_port\n";
&get_line;
exit;
}
else{
push(@channels, "$name");
&get_channels;
}
}
sub get_line{
$line = <$remote>;
$line =~ s/\s*$//;
($n_id, $bs, $bs1, $nick, $bs2, $loginname) = split(/"/, $line);
($p_id, $c_id, $ps, $bs, $pr, $br, $pl, $ping, $logintime, $idletime, $cprivs, $pprivs, $pflags, $ip, ) = split(/\s/, $n_id);
if($line eq "OK"){
&cancel;
}
else{
&print_line;
}
}
sub print_line{
$ch_id = $c_id - 1;
if($c_id eq "c_id"){
print "<font face=\"verdana\" size=-1><B>TS Server Status Port</B> $indata<BR>";
&get_line;
}
else{
print "<B><font face=\"verdana\" size=-2>$nick</B> ($channels[$ch_id])</font><BR>";
&get_line;
}
}
sub cancel{
$cound = push(@channels);
print "<B><font face=\"verdana\" size=-2><A HREF=\"teamspeak://trn.ods.org:$indata\">Join TeamSpeak</B></A></font>";
exit;
}
exit;
-------------------------------------------------------------------------
Could i get some directions on where i need to put the information for my TS server to get it to work? I know that sounds dumb of me but when i look at this i get all confused. And an early thanks to the people who help out. I mean if someone could start it out for me i think i will be fine after words so i'll post the server name and IP address for those who can help out.
Server: Syndicates of Evil
IP: 71.224.105.28:8767
Hitman69
28-04-2006, 23:20
Could i get some directions on where i need to put the information for my TS server to get it to work? I know that sounds dumb of me but when i look at this i get all confused. And an early thanks to the people who help out. I mean if someone could start it out for me i think i will be fine after words so i'll post the server name and IP address for those who can help out.
Server: Syndicates of Evil
IP: 71.224.105.28:8767
Don't bother working on that script, its the first one I wrote. go here instead and download the latest version of the script complete with instructions.
http://software.itawk.com
Regards Hitman.
Hitman69
11-05-2006, 15:20
New Teamspeak Status script using java script to display in html.
download it here: http://software.itawk.com
Dirtspaz
24-11-2006, 13:13
If your looking for a nice TS block take a look here.
http://www.fubarfish.com/index.php
Our very own Fubarfish Ghost has been putting together scripts for some time now & has others you can see here.
http://nukecops.com/modules.php?name=Search
By the way.....I found this thread because of a search I was doing for one of the last people to register on our site "Knuddesoft"
Not for bad reasons, just to find out a little about them & see how much they get around. Anyhow.................. One last thing,
Hitman.....are you a member of the {MOB} guys where some of us play in your CoD2 server
with "Old Man Mike" & "HEMLOCK" ?
vBulletin® v3.7.0, Copyright ©2000-2008, Jelsoft Enterprises Ltd.