English   German
  #1  
Old 31-05-2003, 20:00
palp palp is offline
-= TeamSpeak User =-
 
Join Date: May 2003
Location: Miramar, FL
Posts: 4
palp is on a distinguished road
Some modifications to the webpost2 code.

I'm running webpost and teamspeak on the same server, so I wanted to have my data more up-to-date than a 5 minute interval. So, I set to work to do just this.

You can't change how often Teamspeak sends out the webpost data. However, the detail data - channels and users - is handled with TCPQuery and can be controlled. I set mine up so that the data there refreshes each time the details page is reloaded. I'm also working on using that information to update the normal data as well (i.e. number of active users) so that it doesn't appear out-of-sync.

In doing this, I also came across an issue - the "servertimeout" value in the config file also dictates timeouts for things like players and channels. So, a player can show up as logged in for as long as 15 minutes after they've left the server. I fixed this as well, by having it check timestamps each time it updates the player and channel lists. If a player or channel was last updated before the update began, then they're no longer logged in, and are removed from the listing.

Overall, the modifications are fairly minor.

I recommend backing up your db_inc.php before you do this in case something goes wrong, especially if you are not familiar with PHP (as in, you have no idea what you're doing )

In db_inc.php, line 83, replace the getserverdetail() function with this one:
PHP Code:
  function getserverdetail($var1) {
    require(
"config_inc.php");
    
$detaildata fetch_line("SELECT * FROM $dbtable WHERE server_id='$var1'");
    if (
$detaildata[11]) {
        
insertchannelinfo($detaildata[10], $detaildata[21], $detaildata[11]);
        
insertuserinfo($detaildata[10], $detaildata[21], $detaildata[11]);
    }
    
    include(
"tpl_serverdetail.php");
  } 
That's all that is required to make the TCPQuery data update every refresh.

If you want to fix the issue with stale players/channels, do the following (the line numbers here assume you have made the modification above):

The insertchannelinfo function begins on line 293. Below the line:
PHP Code:
global $server_timestamp
add:
PHP Code:
$now $server_timestamp
Then, insert a line just before the last closing brace of that function, on what will now be line 348:
PHP Code:
    query("delete from $dbtable3 where server_timestamp < '$now'"); 
Next, you have to do the same thing to the insertuserinfo function, which begins on what is now line 351. Just as before, below the line:
PHP Code:
global $server_timestamp
add:
PHP Code:
$now $server_timestamp
And before the last closing brace, which is now line 420, add this(note that this code is slightly different than that for the channel info, make sure you use the right one!):
PHP Code:
    query("delete from $dbtable2 where server_timestamp < '$now'"); 
And that should do it. Any questions, feel free to ask.

Last edited by palp; 02-06-2003 at 00:14.
Reply With Quote
  #2  
Old 01-06-2003, 23:21
9999 9999 is offline
-= TeamSpeak User =-
 
Join Date: May 2003
Location: gambia
Posts: 4
9999 is on a distinguished road
nice! i needed that Thanks
Reply With Quote
  #3  
Old 12-08-2003, 00:46
Kabukiman Kabukiman is offline
-= TeamSpeak User =-
 
Join Date: Sep 2002
Location: Germany
Posts: 16
Kabukiman is on a distinguished road
Send a message via ICQ to Kabukiman
GREAT TIPS!

BUT...

the current Version of WebPost (it's 4.0.2) doesn't have a "getserverdetail"-Function!

The other 2 Tweaks work very well (deleting non-existant channels and already logged out users), but still my Webpost shows inactive Users more than once at least 5 Minutes long!

How can you tweak the refresh-setting from 5 Minutes to "everytime the user hit's refresh"?
Reply With Quote
  #4  
Old 23-08-2003, 13:33
palp palp is offline
-= TeamSpeak User =-
 
Join Date: May 2003
Location: Miramar, FL
Posts: 4
palp is on a distinguished road
I haven't done much with teamspeak in a little while, but I've been asked to setup a server for someone so I'll probably look into this while I'm at it. I'll let you know.
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 09:33.


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