Lidt øvet
Antal indlæg: 44
Tilmeldt: 24/02/2007 19:55
|
hej jeg håber på at nole vid lit om PHP-Nuke har download en PHP-Nuke Teamspeak blokke men jeg kan ikke få den til at lør så tinget jeg på og der var en i clan som kun hjelpe mig ???
det hvad der står i lær mig filen
Copy the files in html to your nuke root dir
edit the TSInfo.php and block-TeamSpeak_nuke.php
just add the ip and port of your teamspeak server
og her er ipen til min Teamspeak server 207.210.93.68 og port er 8719
og serverQueryPort = 51234
her er de to php koder man skal bruge Kode <?php
/************************************************************************/
/* TeamSpeak Block For PHP-NUKE: Web Portal System */
/* =============================================== */
/* */
/* Copyright (c) 2004 by **CloseUp**|Ds| */
/* http://darkknights.dk */
/* I have only made this script with Cut & Paste from many other scripts*/
/************************************************************************/
if (eregi("block-TeamSpeak_nuke.php",$_SERVER['PHP_SELF'])) {
Header("Location: index.php");
die();
}
// retrieve server info
require("TSInfo.php");
$tss2info->getInfo();
$tss2info->userName="Guest";
$serverAddress = "207.210.93.68"; // TeamSpeak IP, don't use localhost here
$serverUDPPort = "8719"; // default 8767
// Don't edit below unless you know what you are messing with
$serverAddress2 = "$serverAddress:$serverUDPPort";
// Get Nuke UserName
global $user, $cookie, $user_prefix;
cookiedecode($user);
$username = $cookie[1];
$sql = "SELECT user_id FROM $user_prefix"._users." WHERE username='$username'";
// display channel list
$content .= "<table aalign=\"center\" width=\"100%\">\n";
$counter = 0;
foreach($tss2info->channelList as $channelInfo) {
$channelname = $channelInfo[channelname];
// determine codec (verbose)
$codec = $tss2info->getVerboseCodec($channelInfo[codec]);
// default?
if($channelInfo[isdefault] == "1") $isDefault = "yes"; else $isDefault = "no";
if ($channelInfo[channelid] != "id") {
$content .= ("<tr><td><img src=\"images/bullet_channel.gif\" align=absmiddle alt=MAX ".$channelInfo[maxplayers]." Players><I><a href=\"teamspeak://".$serverAddress.":".$serverUDPPort."/nickname=".$username."?loginname=?password=?channel=".$channelname."?channelpassword=\">".$channelname."</a></I></td></tr>\n");
$counter_player = 0;
foreach($tss2info->playerList as $playerInfo) {
if ($playerInfo[channelid] == $channelInfo[channelid]) {
$content .=("<tr><td> <img src=\"images/bullet_ts.gif\" alt=$playerInfo[playername] align=absmiddle> ".$playerInfo[playername]."</td></tr>\n");
$counter_player++;
}
}
if($counter_player == 0) $content .= ("<tr><td></td></tr>\n");
}
$counter++;
}// end foreach
if ($counter == 0) $content .= ("<tr><td colspan=\"7\" align=\"CENTER\">Offline</td></tr>\n");
$content .= ("</table>\n</div>\n");
//Copyright Please don't remove with out my approval
$content .= ("<center><a href=\"http://www.darkknights.dk\" target=\"_blank\">© DarkKnights</a></center>");
?>
Kode <?php
class tss2info {
// ts2info.php
// (c) 2003 by Christian Müller
// non-commercial use approved, commercial users please contact me at
// i give no guarantees whatsoever about the correct functioning of this script
// use at your own risk
// date: 20/06/03, 23:28
// **** settings - to be edited before first use ****
var $serverURL = "xxx.xxx.xxx.xxx<--"; // will be used for the connect link, don't use localhost here
var $serverAddress = "207.210.93.68"; // can be ip address or url
var $serverQueryPort = 51234; // default 51234, must be accessible and usable. check server.ini
var $serverUDPPort = 8719; // default 8767
// **** end of settings ****
//internal
var $socket;
// external
var $serverStatus = "offline";
var $playerList = array();
var $channelList = array();
// opens a connection to the teamspeak server
function getSocket($host, $port, $errno, $errstr, $timeout) {
unset($socket);
$attempts = 1;
while($attempts <= 1 and !$socket) {
$attempts++;
@$socket = fsockopen($host, $port, $errno, $errstr, $timeout);
$this->errno = $errno;
$this->errstr = $errstr;
if($socket and fread($socket, 4) == "[TS]") {
fgets($socket, 128);
return $socket;
}
}// end while
return false;
}// end function getSocket(...)
// sends a query to the teamspeak server
function sendQuery($socket, $query) {
fputs($socket, $query."\n");
}// end function sendQuery(...)
// answer OK?
function getOK($socket) {
$result = fread($socket, 2);
fgets($socket, 128);
return($result == "OK");
}// end function getOK(...)
// closes the connection to the teamspeak server
function closeSocket($socket) {
fputs($socket, "quit");
fclose($socket);
}// end function closeSocket(...)
// retrieves the next argument in a tabulator-separated string (PHP scanf function bug workaround)
function getNext($evalString) {
$pos = strpos($evalString, "\t");
if(is_integer($pos)) {
return substr($evalString, 0, $pos);
} else {
return $evalString;
}// end if
}// end function getNext($evalString);
// removes the first argument in a tabulator-separated string (PHP scanf function bug workaround)
function chopNext($evalString) {
$pos = strpos($evalString, "\t");
if(is_integer($pos)) {
return substr($evalString, $pos + 1);
} else {
return "";
}// end if
}// end function chopNext($evalString)
// strips the quotes around a string
function stripQuotes($evalString) {
if(strpos($evalString, '"') == 0) $evalString = substr($evalString, 1, strlen($evalString) - 1);
if(strrpos($evalString, '"') == strlen($evalString) - 1) $evalString = substr($evalString, 0, strlen($evalString) - 1);
return $evalString;
}// end function stripQuotes($evalString)
// returns the codec name
function getVerboseCodec($codec) {
if($codec == 0) {
$codec = "CELP 5.1 Kbit";
} elseif($codec == 1) {
$codec = "CELP 6.3 Kbit";
} elseif($codec == 2) {
$codec = "GSM 14.8 Kbit";
} elseif($codec == 3) {
$codec = "GSM 16.4 Kbit";
} elseif($codec == 4) {
$codec = "CELP Windows 5.2 Kbit";
} elseif($codec == 5) {
$codec = "Speex 3.4 Kbit";
} elseif($codec == 6) {
$codec = "Speex 5.2 Kbit";
} elseif($codec == 7) {
$codec = "Speex 7.2 Kbit";
} elseif($codec == 8) {
$codec = "Speex 9.3 Kbit";
} elseif($codec == 9) {
$codec = "Speex 12.3 Kbit";
} elseif($codec == 10) {
$codec = "Speex 16.3 Kbit";
} elseif($codec == 11) {
$codec = "Speex 19.5 Kbit";
} elseif($codec == 12) {
$codec = "Speex 25.9 Kbit";
} else {
$codec = "unknown (".$codec.")";
}// end if
return $codec;
}// end function getVerboseCodec($codec);
function getInfo() {
// ---=== main program ===---
// establish connection to teamspeak server
$this->socket = $this->getSocket($this->serverAddress, $this->serverQueryPort, $errno, $errstr, 0.3);
if($this->socket == false) {
return;
echo ("No Server");
} else {
$this->serverStatus = "online";
// select the one and only running server on port 8767
$this->sendQuery($this->socket, "sel ".$this->serverUDPPort);
// retrieve answer "OK"
if(!$this->getOK($this->socket)) {
echo "Server didn't answer \"OK\" after last command. Aborting.";
return;
}// end if
// retrieve player list
$this->sendQuery($this->socket,"pl");
// read player info
$this->playerList = array();
do {
$playerinfo = fscanf($this->socket, "%s %d %d %d %d %d %d %d %d %d %d %d %d %s %s");
list($playerid, $channelid, $receivedpackets, $receivedbytes, $sentpackets, $sentbytes, $d, $d, $totaltime, $idletime, $d, $d, $d, $s, $playername) = $playerinfo;
if($playerid != "OK") {
$this->playerList[$playerid] = array("playerid" => $playerid,
"channelid" => $channelid,
"receivedpackets" => $receivedpackets,
"receivedbytes" => $receivedbytes,
"sentpackets" => $sentpackets,
"sentbytes" => $sentbytes,
"totaltime" => $totaltime,
"idletime" => $idletime,
"playername" => $this->stripQuotes($playername));
}// end if
} while($playerid != "OK");
// retrieve channel list
$this->sendQuery($this->socket,"cl");
// read channel info
$this->channelList = array();
do {
$channelinfo = "";
do {
$input = fread($this->socket, 1);
if($input != "\n" && $input != "\r") $channelinfo .= $input;
} while($input != "\n");
$channelid = $this->getNext($channelinfo);
$channelinfo = $this->chopNext($channelinfo);
$codec = $this->getNext($channelinfo);
$channelinfo = $this->chopNext($channelinfo);
$parent = $this->getNext($channelinfo);
$channelinfo = $this->chopNext($channelinfo);
$d = $this->getNext($channelinfo);
$channelinfo = $this->chopNext($channelinfo);
$maxplayers = $this->getNext($channelinfo);
$channelinfo = $this->chopNext($channelinfo);
$channelname = $this->getNext($channelinfo);
$channelinfo = $this->chopNext($channelinfo);
$d = $this->getNext($channelinfo);
$channelinfo = $this->chopNext($channelinfo);
$d = $this->getNext($channelinfo);
$channelinfo = $this->chopNext($channelinfo);
$topic = $this->getNext($channelinfo);
if($channelid != "OK") {
if($isdefault == "Default") $isdefault = 1; else $isdefault = 0;
// determine number of players in channel
$playercount = 0;
foreach($this->playerList as $playerInfo) {
if($playerInfo[channelid] == $channelid) $playercount++;
}// end foreach
$this->channelList[$channelid] = array("channelid" => $channelid,
"codec" => $codec,
"parent" => $parent,
"maxplayers" => $maxplayers,
"channelname" => $this->stripQuotes($channelname),
"isdefault" => $isdefault,
"topic" => $this->stripQuotes($topic),
"currentplayers" => $playercount);
}// end if
} while($channelid != "OK");
// close connection to teamspeak server
$this->closeSocket($this->socket);
}// end getInfo()
}// class tss2info
}
$tss2info = new tss2info;
?>
håber at i kan hjelp mig tak for hjelpen ;) |