To view the players on your shard who are online, without using the vault mangler, select the vault database you created and use this query:

The default vault is vaultdb_test, it's name can be changed by editing the settings in your /etc/whatever.ini file. Changing the name on an existing shard will have the result of creating a new vault database.

select IString64_1,String64_1 from Nodes where Int32_1=1 and NodeType=23

IString64_1 is the avatar name. String62_1 is the current age name. Int32_1 is 1 for a player online, and 0 for offline. NodeType 23 is for a player. If anyone has a list of node types I'd like to see it!! Also of interest is OwnerIdx - this is the effective KI number for that user.

So, this is kinda useful if you want to look up your buddies KI and they are online:

select IString64_1,OwnerIdx,String64_1 from Nodes where Int32_1=1 and NodeType=23 order by IString64_1 

And this one is kinda useful if they are offline:

select IString64_1,OwnerIdx from Nodes where Int32_1=0 and NodeType=23 order by IString64_1

The following is a basic PHP script that makes use of the above. Hack it about to make it suit your needs. You'll need to edit some lines to specify your own database / account etc. Also a style sheet, if you use one. These are lines 5 and 9 through 12. Line 12 is the default db name. If you've changed your db names...well, I'm sure you know what I'm on about...

<!-- Program Name:  online.php Description: Check who is online in UU.-->
<html>
<head>
<title>Shard player status</title>
<link rel="stylesheet" href="def.css" type="text/css">
</head>
<body>
<?php
 $user="yourdatabaseusername";
 $host="yourserveripaddressorhostname";
 $password="password";
 $database="vaultdb_test";
 $query="select IString64_1,String64_1 from Nodes where Int32_1=1 and NodeType=23";
   mysql_connect($host,$user,$password);
   mysql_select_db($database);
   $query = stripSlashes($query) ;
   $result = mysql_query($query);
   echo "There are ";
   echo (mysql_num_rows($result));
   if ($result == 0)
      echo("<b>Error " . mysql_errno() . ": " . mysql_error() . "</b>");

 $query="select IString64_1,String64_1 from Nodes where NodeType=23";
   $query = stripSlashes($query) ;
   $result = mysql_query($query);
   echo " out of ";
   echo (mysql_num_rows($result));
   echo  " players online.<hr>";
   if ($result == 0)
      echo("<b>Error " . mysql_errno() . ": " . mysql_error() . "</b>");

 $query="select IString64_1,String64_1 from Nodes where Int32_1=1 and NodeType=23";
   $query = stripSlashes($query);
   $result = mysql_query($query);
   echo "<h3>Players online and location:</h3>
          <hr>";

   if ($result == 0)
      echo("<b>Error " . mysql_errno() . ": " . mysql_error() . "</b>");

   elseif (@mysql_num_rows($result) == 0)
      echo("<b>No data returned.</b><br>");
   else
   {
     echo "<table border='0'>
           <thead>
            <tr><th>Playername</th><th>Location</th></tr>";
     echo "</thead>
           <tbody>";
             for ($i = 0; $i < mysql_num_rows($result); $i++) 
             {
                echo "<tr>";
                $row = mysql_fetch_row($result);
                for ($j = 0; $j < mysql_num_fields($result); $j++) 
                {
                  echo("<td>" . $row[$j] . "</td>");
                }
                echo "</tr>";
             }
             echo "</tbody>
                  </table>";
   }
   echo "<hr><br>There are ";
   echo (mysql_num_rows($result));
   echo " players active on this shard.<br><hr>";
    

 $query="select IString64_1 from Nodes where Int32_1=0 and NodeType=23";

   $query = stripSlashes($query) ;
   $result = mysql_query($query);
   echo "<h3>Players offline:</h3>
          <hr>";
   if ($result == 0)
      echo("<b>Error " . mysql_errno() . ": " . mysql_error() . "</b>");

   elseif (@mysql_num_rows($result) == 0)
      echo("<b>No data returned.</b><br>");
   else
   {
     echo "<table border='0'>
           <thead>
            <tr><th>Playername</th></tr>";
     echo "</thead>
           <tbody>";
             for ($i = 0; $i < mysql_num_rows($result); $i++) 
             {
                echo "<tr>";
                $row = mysql_fetch_row($result);
                for ($j = 0; $j < mysql_num_fields($result); $j++) 
                {
                  echo("<td>" . $row[$j] . "</td>");
                }
                echo "</tr>";
             }
             echo "</tbody>
                  </table>";
   }
   echo "<hr><br>There are ";
   echo (mysql_num_rows($result));
   echo " inactive players on this shard.";
?>
 
</body>
</html>

Oh - and I will most likely get around to making a more efficient version in due course - this one was hacked out quickly (hence the multiple queries). At some point I plan on querying the db only once and then just having PHP do the leg work to see which is faster. At present the impact of this script on the MySQL db seems negligable.

ShowWhoIsOnline (last edited 2008-12-27 16:35:30 by localhost)