English   German
  #1  
Old 09-11-2002, 21:17
MagicMad MagicMad is offline
-= TeamSpeak User =-
 
Join Date: Nov 2002
Location: germany
Posts: 3
MagicMad is on a distinguished road
Lightbulb Userliste als html mit *nix/bsd

well, since my TS Server somehow doesnt post anything to my webpost2 script here a small solution for a Userlist at least.

The following shell script saved as tsstatus.cgi in your webserver“s cgi-bin folder should do the trick: (if u have netcat installed, but who hasnt ?!?)

Quote:
#!/bin/sh

#
# Teamspeak 2 - CGI Username Query
#
# (c) Martin Hauck 2002
#

PLY=`{ echo "sel 8767"; echo "pl 8767"; echo "quit"; } | /usr/local/bin/netcat localhost 51234`
COUNT=3

echo "Content-Type: text/html; charset=iso-8859-1"
echo "Cache-control: no-store" # HTTP/1.1 (or no-cache?)
echo "Pragma: no-cache" # HTTP/1.0
echo "Expires: `date -Ru`" # Expires now!
echo "Refresh: 30"
echo

echo "<html><head>"
echo "<LINK REL=STYLESHEET TYPE=\"text/css\" HREF=\"main.css\">"
echo "<title>Teamspeak Users</title></head>"
echo "<body bgcolor=\"#ffffff\" text=\"BLACK\" background=\"Background.jpg\">"

echo "<div align=\"center\">"
echo "<table border="1">"

if [ "$(echo $PLY | cut -d" " -f$COUNT)" = "OK" ]
then

echo "</table>"
echo "<br><br><small>no one connected..</small>"
echo "</body></html>"
exit 0

else

COUNT=`expr "$COUNT" + 1`

while [ "$(echo $(echo $PLY | cut -d"." -f$COUNT) | cut -d" " -f2)" != "OK" ]
do
echo "<tr><td>$(echo $(echo $PLY | cut -d"." -f$COUNT) | cut -d" " -f2)</td></tr>"
COUNT=`expr "$COUNT" + 3`
done

fi

echo "</table>"
echo "</div>"
echo "<br><small>userlisting v0.9<br>(c)Mad 2002</small>"
echo "</body></html>"
exit 0
CONFIGURE:
Just use your serveradress and queryport and maybe the server udpport used for the pl command.

So it has nothing to do with the webpost feature of the server; in fact it does directly query the server everytime its hit, so you have always the correct data shown up.

See it in Action here.
I display the cgi in an IFRAME under the left menue.
Reply With Quote
  #2  
Old 10-11-2002, 15:21
jvhaarst jvhaarst is offline
-= TeamSpeak User =-
 
Join Date: Aug 2002
Location: Wageningen,NL
Posts: 13
jvhaarst is on a distinguished road
The pl 8767 isn't needed after a sel 8767...

For the rest :
I'm impressed by the easy solution. I was using difficult telnet parsing, this is a lot easier.
I think I'll rewrite my script to use netcat.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 15:54.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Add to Bookmarks   |   Printview   |   Contact Us   |   Legal Notices