PDA

View Full Version : Libacts2 HTTP-Server login failed


crazyandy
25-08-2008, 01:25
Hello all,

I have a problem were when I call somthing like this:

$host = Absurd_TeamSpeak2::connect('tcp://'.$address.':'.$tcp.'');
$http = Absurd_TeamSpeak2::httpConnect('tcp://'.$address.':'.$http.'');
try {
$information = $host->getServerByUdp($port)->getNodeInfo();
$server_id = $information[server_id];
$http->login($ssa, $ssapass);
$http->select($server_id);
$informationb = $http->readServerSettings();
$informationc = $host->getNodeInfo();

echo $information[server_name];
echo $information[server_udpport];
echo $informationb[serverpassword];
echo $informationc[total_server_version];
//etc...

It gives me the following error:

HTTP-Server login failed

The above error code only appears sometimes, but by trying several times it eventually works, but then stops again for a while.

This issue also happends when I try to retreve the server permissions aswell.

I heard this is an issue with the class, but is there any way to stop this from happening or is there another way to retreve information from the server?

I was thinking of doing some sort of loop that would keep trying untill it worked, but would timeout after 4 or 5 goes.
I havent got a loop working because it keeps throwing an exception.
I have tryed to catch the exception and make it loop again, but wont work.

If anyone has any ideas to solve this problem, I would love to hear them plz.

Thanks,
Andy

Germeshausen.de
25-08-2008, 09:00
It's not an issue by the class, it's an issue by the server. This is one reason, maybe the one and only reason, the rehash-command has been fixed. This allows you to change settings (serversettings, permissions etc.) directly in the database (sqlite and myssql) and activate the changes by using the rehash command. We had these issues with our older versions of the TeamSpeak Adminpanel PRO untill we changed the handling with some help by Ralf Ludwig, who fixed the broken rehash-command.
Note: Be carefull, wrong settings or wrong commands may crash your teamspeak server or even its database. This way to operate the teamspeak server is not recommend and officially not supported (like the mysql-support).

crazyandy
25-08-2008, 13:52
If this is an issue by the server and it happends when changing data, then why am I getting this error when I am only just retreving data.
With the code below I am just getting the data and then printing it out.

Does it still do this when retreving data from the server?

Thanks,
Andy

Germeshausen.de
25-08-2008, 16:05
Yes, also while retrieving data from the server. The safe way is to read the permissions and the settings from the database directly.

crazyandy
25-08-2008, 18:45
Thanks for the reply Germeshausen.de,

How would I go about reading the data from the database directly using php and then issue a rehash?
I want to try and keep the sqlite database that comes standard with TS, but cause I am hosting multiple server on different physical servers and they are all managed from the one control panel on the master server.

If there are any code snipits that I could look over, would be great.

Thanks
Andy

Germeshausen.de
27-08-2008, 11:23
You need the rehash command only if you changed something. The server is going to reload the settings when he receives the rehash command.

You can handle the sqlite database with php, perl, python, java or another language who supports sqlite. If you have the teamspeak on a remote server, you can also access the database by remote. You can create a small seperate tcp query daemon, which runs on the remote maschine and allows you to access the database by remote. It may also be possible to use the bulldog dameon and extend it for database access.
If you are not scared to use mysql, you can directly access the database. This may be the easiest way, but it could be instable, due mysql is supported but still experimental.
Only if you change something in the database, the rehash command is needed for the server for reading the new settings. Otherwhise the server will not change anything untill restarting it.

We have a bit other solution, but it works similar. Because of some contracts we are not allowed to publish any detailed informations.
The TeamSpeak Adminpanel PRO (TAP) can handle the teamspeak server by remote without the teamspeak webinterface issues because the included CyTS-Class has been extended and modified. The TAP can also be modified and customized very easily. Adding new functions and modules, changing the language files, changing the templates (smarty template engine) can easily be done.
If you are interested in testing the software and you wan't to test to customize the TAP, just let me know. Maybe it's usefull for you and you might want to use our product and fit it to your needs.

crazyandy
27-08-2008, 12:16
Yes I have looked at your program TAP on your website and it looks interesting.
How hard is it to setup and do you have a demo I can look at?

Also if I was going to just continue to finish my own, would you recomend to use the CyTS-Class, rather than Libacts2?

My goal of the project was not to access that database directly, as I knew this could be done, never knew about the rehash though and I needs to work remotely too.

Andy

Germeshausen.de
27-08-2008, 23:39
The TeamSpeak Adminpanel PRO runs on most Webserverplattform which support php4 or higher and a actually version of the ioncube loader to run encrypted files. You can download the TAP 2.1.5 from our website and request a trial license by mail.

What's new in comparison with CyTS:

* Now fully object-oriented: handle Hosts, Servers, Channels and Clients as Objects
* Session persistency: Put a host or server object into a session and it will automatically reconnect and relogin in every script that uses the session
* The servers are mapped into a tree that can easily be (recursively) iterated
* Special functions like: kick, ban, remove can be applied to whole channels, servers or even hosts
* Error handling with Exceptions
* Many performance increases


Requirements:
PHP >= 5.1
As far as i know, the class used in the tap contains allmost the same functions with some modifications and some extensions. Steven knows the exact details. But if really needed the libacts2 may be used parallel or in addition to the cyts class.

As i told before the command has been broken for a long while, so changing the database entries directly had been for nothing, because the server need to be restartet after every change to activate the modifications.
After we discovered the problems with the http interface we tried to find a solution and the only way we found had been to access and modify the database directly and get the rehash command fixed to get the changes live.

crazyandy
28-08-2008, 00:04
So TAP does it use the Cyts class or do you access the database directly.
If it does use Cyts for getting data from the server, does it still get the same problem?

I know the rehash command was fixed in one of the releases, but I realy want to try and get it to work without direct database access.

Andy

crazyandy
02-09-2008, 14:32
Hello

When I loop the following code it still throws the error, even if I make it sleep for a few seconds each time.


<?php
$host = Absurd_TeamSpeak2::connect('tcp://'.$address.':'.$tcp.'');
$http = Absurd_TeamSpeak2::httpConnect('tcp://'.$address.':'.$http.'');
$try=0;
while($try < 7)
{
$try++;

try {
$information = $host->getServerByUdp($port)->getNodeInfo();
$server_id = $information[server_id];
$http->login($ssa, $ssapass);
$http->select($server_id);
$informationb = $http->readServerSettings();
$informationc = $host->getNodeInfo();
?>
<!-- Print out the data -->
Server Name : <?= $information[server_name]; ?>
Server Password : <?= $informationb[serverpassword]; ?>
<!-- etc... -->

<?php
$try=7;
}
catch (Absurd_TeamSpeak2_Exception $f)
{
if($try >= 7) {
echo"Can't display data when server is not running.<br>Start the server to see server data. ".$f->getMessage();
} else {
sleep(3);
echo $try;
}
}
}
?>


Surly by looping it a few times and even delaying it for a few seconds each time, it would at least work one of the times.
But it doesnt.

Any Ideas?

Thanks,
Andy