Go Back   Novahq.net Forum > phphq.Net > phphq.Net Forums

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 01-16-2005, 12:44 PM
varg
Unregistered

Posts: n/a

babstats server online

I'm trying to put a status note in my forums saying if our main server is running. Using babstats.
Here's what I've got so far, it's working, but it echoes all the servers. I'd like it to echo just the server with a certain ID - I guess that has to be specified in the $query, but I'm not sure how to do just that.

[code:1:26d24b6abe]
<?
$dbh=mysql_connect ('localhost', 'username', 'password') or die(mysql_error());
mysql_select_db(dbname,$dbh) or die(mysql_error());


$query = mysql_query("SELECT * FROM `bab_servers` ORDER BY name") or die(mysql_error());
$thetime = time();
while($row = mysql_fetch_array($query)) {
if($thetime > ($row[last_update] + 120)) {
echo "Server is offline";
} else {
echo "Server is online";
} }
?>

[/code:1:26d24b6abe]
this is how it looks now. as you can see, it shows the offline servers aswell. While I only want it to show the last, online server, which is ID=5 in the database.
I'm no php expert, so help is most appreciated

//EDIT:
problem fixed, you can now delete this post if you want to.
in case someone wants to know
[code:1:26d24b6abe]
$dbh=mysql_connect ('localhost', 'username', 'password') or die(mysql_error());
mysql_select_db(dbname,$dbh) or die(mysql_error());
$id = "5";
$query = mysql_query("SELECT * FROM `bab_servers` WHERE id=$id") or die(mysql_error());
$thetime = time();
while($row = mysql_fetch_array($query)) {
if($thetime > ($row[last_update] + 120)) {
echo "<a href=\"http://www.mapmakersheaven.com/server.php\">server is<font size=\"2\" color=\"#871C01\"><strong> offline </strong></font></a>";
} else {
echo "<a href=\"http://www.mapmakersheaven.com/server.php\">server is<font size=\"2\" color=\"#006600\"><strong> online </strong></font></a>";
} }[/code:1:26d24b6abe]
Reply With Quote
  #2  
Old 01-19-2005, 07:14 AM
varg
Unregistered

Posts: n/a

I've been working some more on extracting info from the babstats database, learned a lot on my way, and I have to say that I'm quite proud lol.
http://mapmakersheaven.com/server/
Still working on it, but it is fully functional

Ennough bragging, here's my question:
I want to get the names of the people in the server...
The only way I can think of would be to get it from df-favs (I have a df favs bug running on my main page, which will display the players when you hover your mouse over the gamename) Would anyone happen to know how i should go about to do just that??
Reply With Quote
  #3  
Old 01-19-2005, 11:20 PM
Scott is offline Scott
Scott's Avatar
AKA. Panther

Join Date: Sep 2001
Location: Minneapolis, MN
Posts: 10,919

The player names are listed in the database in bab.stats. They are just encoded (if i remember correct) look in the files where it lists players in the server.. look for something similar to base64_encode() base64_decode().. if memory serves right you have to do something on the lines of:

run your query for the encoded names in the mysql coloum, explode them by whatever they are seperated with, and do something like:

$names=explode(" ",$result[names]); //if they are seperated by a space..

Then do a for():

for($i=0; $i=>count($names); $i++) {
$name=base64_decode($name[$i]);
Echo($name);
}

That would be similar to what your looking for or at least get you on the right track. I don't have bab.stats installed and haven't for awhile so I can't be sure, but I know there encoded with a base64_encode() in the db.
__________________

04' Dodge SRT-4, Mopar Stage 3, 406whp/436wtq
Reply With Quote
  #4  
Old 01-20-2005, 07:49 AM
varg
Unregistered

Posts: n/a

Thanks its great news if the info is allready in the bab db. And why shouldn't it, it displays the name of the best players, so it has to know when they played...

I took a quick look for "base64" in some of the files now, couldn't find it. But I'll take a closer look at some more files when I get home tonight.
I guess I should have mentioned that I am using babstats v3 .
(http://www.mapmakersheaven.com/bab/)

//Edit just as I closed my editor I checked status.php where it lists
[code:1:f57ae5f8f2] $game = base64_decode($game);
$servername = base64_decode($servername);
$mapname = base64_decode($mapname);
$idcode = base64_decode($idcode);[/code:1:f57ae5f8f2]
I'm gonna mess with this later as I said, but I'm definitly going to need some help at one point or another
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
normandy server back online gasemans107th Gaming Talk 9 06-05-2006 05:15 AM
babstats server status block -SpArKs- Delta Force 2 07-29-2005 04:38 AM
|FG| LW server online!!! Monkey Br.=FoT= News 0 03-12-2004 12:59 PM
BHD clans Using PHPnuke/Babstats server status block xacuta.ck Delta Force 0 01-14-2004 12:30 PM
Our Server Online Frootie ÐÐT Gaming Talk 4 12-12-2002 11:47 AM


All times are GMT -5. The time now is 10:04 AM.




Powered by vBulletin®