I nead the files tocan you give me the file
ts3/inc/config.php
and
ts3/inc/ts3admin.class.php
I nead the files tocan you give me the file
ts3/inc/config.php
and
ts3/inc/ts3admin.class.php
can you give me the file
ts3/inc/config.php
and
ts3/inc/ts3admin.class.php
I nead the files to
can u give me the config.php ?i dont know whats wrong with this one, anyone can explain ? this script always say "you are not vip"
PHP:<?php defined('BASEPATH') OR exit('No direct script access allowed'); require('../ts3/inc/config.php'); require('../ts3/inc/ts3admin.class.php'); ini_set("register_globals","On"); function getIP() { foreach (array('HTTP_CLIENT_IP', 'HTTP_X_FORWARDED_FOR', 'HTTP_X_FORWARDED', 'HTTP_X_CLUSTER_CLIENT_IP', 'HTTP_FORWARDED_FOR', 'HTTP_FORWARDED', 'REMOTE_ADDR') as $key) { if (array_key_exists($key, $_SERVER) === true) { foreach (array_map('trim', explode(',', $_SERVER[$key])) as $ip) { if (filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE) !== false) { return $ip; } } } } } $tsAdmin = new ts3admin($ts3['ip'], $ts3['queryport']); if($tsAdmin->getElement('success', $tsAdmin->connect())) { $tsAdmin->login($ts3['user'], $ts3['pass']); $tsAdmin->selectServer($ts3['port']); $tsAdmin->setName($ts3['displayname']); $clients = $tsAdmin->clientList("-ip -uid -groups"); foreach($clients['data'] as $client) { if($client['connection_client_ip'] == getIP()) { $userid = $client['client_database_id']; $username = $client['client_nickname']; $servergroups = $client['client_servergroups']; } } if(!empty($userid)) { echo "Please join our Teamspeak"; } else { global $servergroups; if(strpos($servergroups, 24607) ) { //The 10 is the servergroup $isMember = true; } } global $isMember; if ($isMember) { echo " you are vip";//do whatever you wanna do if the user is in the group } else { echo "you are not vip";//do whatever you wanna do if the user is not in the group } }else { echo "Cant connect ts"; } ?>
Oh im so sory i didn't saw itDo you see the post above you @Umar ???
require('ts3admin/src/ts3admin.class.php');
function getIP()
{
foreach (array('HTTP_CLIENT_IP', 'HTTP_X_FORWARDED_FOR', 'HTTP_X_FORWARDED', 'HTTP_X_CLUSTER_CLIENT_IP', 'HTTP_FORWARDED_FOR', 'HTTP_FORWARDED', 'REMOTE_ADDR') as $key)
{
if (array_key_exists($key, $_SERVER) === true)
{
foreach (array_map('trim', explode(',', $_SERVER[$key])) as $ip)
{
if (filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE) !== false)
{
return $ip;
}
}
}
}
}
$tsAdmin = new ts3admin($ts3['ip'], $ts3['queryport']);
$tsAdmin->login($ts3['user'], $ts3['pass']);
$tsAdmin->selectServer($ts3['port']);
$clients = $tsAdmin->clientList("-ip -groups");
foreach($clients['data'] as $client) {
if($client['connection_client_ip'] == getIP()) {
$username = $client['client_nickname'];
$servergroups = $client['client_servergroups'];
}
}
if(!empty($username)) {
echo "Please join our Teamspeak";
} else {
if(strpos($servergroups, 9)) { //The 10 is the servergroup
$isMember = true;
}
}
if ($isMember) {
echo " you are vip"; //do whatever you wanna do if the user is in the group
} else {
echo "you are not vip"; //do whatever you wanna do if the user is not in the group
}
yes i told you "i dont know whats wrong with this one, anyone can explain ? this script always say "you are not vip"" thats why i posted my code here so we can find the problemi dont know whats wrong with this one, anyone can explain ? this script always say "you are not vip"
PHP:<?php defined('BASEPATH') OR exit('No direct script access allowed'); require('../ts3/inc/config.php'); require('../ts3/inc/ts3admin.class.php'); ini_set("register_globals","On"); function getIP() { foreach (array('HTTP_CLIENT_IP', 'HTTP_X_FORWARDED_FOR', 'HTTP_X_FORWARDED', 'HTTP_X_CLUSTER_CLIENT_IP', 'HTTP_FORWARDED_FOR', 'HTTP_FORWARDED', 'REMOTE_ADDR') as $key) { if (array_key_exists($key, $_SERVER) === true) { foreach (array_map('trim', explode(',', $_SERVER[$key])) as $ip) { if (filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE) !== false) { return $ip; } } } } } $tsAdmin = new ts3admin($ts3['ip'], $ts3['queryport']); if($tsAdmin->getElement('success', $tsAdmin->connect())) { $tsAdmin->login($ts3['user'], $ts3['pass']); $tsAdmin->selectServer($ts3['port']); $tsAdmin->setName($ts3['displayname']); $clients = $tsAdmin->clientList("-ip -uid -groups"); foreach($clients['data'] as $client) { if($client['connection_client_ip'] == getIP()) { $userid = $client['client_database_id']; $username = $client['client_nickname']; $servergroups = $client['client_servergroups']; } } if(!empty($userid)) { echo "Please join our Teamspeak"; } else { global $servergroups; if(strpos($servergroups, 24607) ) { //The 10 is the servergroup $isMember = true; } } global $isMember; if ($isMember) { echo " you are vip";//do whatever you wanna do if the user is in the group } else { echo "you are not vip";//do whatever you wanna do if the user is not in the group } }else { echo "Cant connect ts"; } ?>
<?php
require('ts3admin.class.php');
//################### Config #####################
$cfg['tsIP'] = "127.0.0.1";
$cfg['tsQueryport'] = "10011";
$cfg['tsPort'] = "9000";
$cfg['tsLogin'] = "serveradmin";
$cfg['tsPassword'] = "Xvu7qqDY";
$cfg['tsName'] = "R4P3 Bot";
//##################################################
function getIP()
{
foreach (array('HTTP_CLIENT_IP', 'HTTP_X_FORWARDED_FOR', 'HTTP_X_FORWARDED', 'HTTP_X_CLUSTER_CLIENT_IP', 'HTTP_FORWARDED_FOR', 'HTTP_FORWARDED', 'REMOTE_ADDR') as $key)
{
if (array_key_exists($key, $_SERVER) === true)
{
foreach (array_map('trim', explode(',', $_SERVER[$key])) as $ip)
{
if (filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE) !== false)
{
return $ip;
}
}
}
}
}
$tsAdmin = new ts3admin($cfg['tsIP'], $cfg['tsQueryport']);
if($tsAdmin->getElement('success', $tsAdmin->connect())) {
$tsAdmin->login($cfg['tsLogin'], $cfg['tsPassword']);
$tsAdmin->selectServer($cfg['tsPort']);
$tsAdmin->setName($cfg['tsName']);
$clients = $tsAdmin->clientList("-ip -groups");
foreach($clients['data'] as $client) {
if($client['connection_client_ip'] == getIP()) {
$username = $client['client_nickname'];
$servergroups = explode(",", $client['client_servergroups']);
}
}
$isMember = false;
if(empty($username)) {
echo "Please join our Teamspeak<br />";
} else {
foreach($servergroups as $servergroup){
if($servergroup == 19){ //The 10 is the servergroup
$isMember = true;
}
}
}
if(!empty($username)){
if ($isMember) {
echo "He is a member";//do whatever you wanna do if the user is in the group
} else {
echo "You are no member";//do whatever you wanna do if the user is not in the group
}
}
}
?>
works perfectly <3So I found my issue and I decided to create a working version. Place the ts3admin.class.php file into the same folder than this script and it should work. At least is did work on my test server.
PHP:<?php require('ts3admin.class.php'); //################### Config ##################### $cfg['tsIP'] = "127.0.0.1"; $cfg['tsQueryport'] = "10011"; $cfg['tsPort'] = "9000"; $cfg['tsLogin'] = "serveradmin"; $cfg['tsPassword'] = "Xvu7qqDY"; $cfg['tsName'] = "R4P3 Bot"; //################################################## function getIP() { foreach (array('HTTP_CLIENT_IP', 'HTTP_X_FORWARDED_FOR', 'HTTP_X_FORWARDED', 'HTTP_X_CLUSTER_CLIENT_IP', 'HTTP_FORWARDED_FOR', 'HTTP_FORWARDED', 'REMOTE_ADDR') as $key) { if (array_key_exists($key, $_SERVER) === true) { foreach (array_map('trim', explode(',', $_SERVER[$key])) as $ip) { if (filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE) !== false) { return $ip; } } } } } $tsAdmin = new ts3admin($cfg['tsIP'], $cfg['tsQueryport']); if($tsAdmin->getElement('success', $tsAdmin->connect())) { $tsAdmin->login($cfg['tsLogin'], $cfg['tsPassword']); $tsAdmin->selectServer($cfg['tsPort']); $tsAdmin->setName($cfg['tsName']); $clients = $tsAdmin->clientList("-ip -groups"); foreach($clients['data'] as $client) { if($client['connection_client_ip'] == getIP()) { $username = $client['client_nickname']; $servergroups = explode(",", $client['client_servergroups']); } } $isMember = false; if(empty($username)) { echo "Please join our Teamspeak<br />"; } else { foreach($servergroups as $servergroup){ if($servergroup == 19){ //The 10 is the servergroup $isMember = true; } } } if(!empty($username)){ if ($isMember) { echo "He is a member";//do whatever you wanna do if the user is in the group } else { echo "You are no member";//do whatever you wanna do if the user is not in the group } } } ?>