I have a block that was used in PHP Nuke I believe, and I am wanting to get this to work on my portal that I am in the midst of getting complete. not sure if anyone here plays BHD or is familiar with it, It is a shooter game made by Novalogic. BabStats does the coding for the aftermarket (if you will) stats, they call it chronos.
I have the chronos installed on my site at
http://www.trdsquad.com/chronosI have a block added to my blocks with the following inserted.
include ("Stats/block-Server-Status.php");
in my portal Directory on my server I have a folder called Stats inside this folder I have a file called block-Server-Status.php .
This file contains the following
<?
####################################################################################
# Block module for PHP-Nuke 7.0 #
# Chronos Babstats online status with scrolling members names and map images #
# #
# Versione: 1.0 #
# Sniperwolf~UA~ www.united-assassins.co.uk please edit if you need but mention me #
# #
####################################################################################
$dbhost = "localhost"; // Database host
$dbname = "xxxxxxxxx"; // Database name
$dbusername = "xxxxxxxxxxx"; // Database user name
$dbuserpw = "xxxxxxx"; // Database password
$dbtable = "chronos_players"; // Change to the DB That holds the players
$content1 = "";
$time = time();
$offline = $time - 120;
$db = mysql_connect($dbhost, $dbusername, $dbuserpw) or die(mysql_error());
$dbi =mysql_select_db($dbname,$db) or die(mysql_error());
$sql = mysql_query("SELECT * FROM `chronos_servers` WHERE `time` > '$offline' ORDER BY name",$db);
$servernum = mysql_num_rows($sql);
if ($servernum >= 1) {
while($result = mysql_fetch_array($sql, $dbi)) {
$players = "";
$player_color = "";
$codemap = $result["map_name"];
$result["server_name"] = htmlspecialchars(base64_decode($result["server_name"]));
$result["map_name"] = htmlspecialchars(base64_decode($result["map_name"]));
$result[server_name] = ereg_replace('~[0-9]', '', $result[server_name]);
$result[map_name] = ereg_replace('~[0-9]', '', $result[map_name]);
if ($result["game_type"] == "Deathmatch") $game_type = "Deathmatch";
if ($result["game_type"] == "Team Deathmatch") $game_type = "Team Deathmatch";
if ($result["game_type"] == "Team King of the Hill") $game_type = "Team King of the Hill";
if ($result["game_type"] == "Search and Destroy") $game_type = "Search and Destroy";
if ($result["game_type"] == "Attack and Defend") $game_type = "Attack and Defend";
if ($result["game_type"] == "Capture the Flag") $game_type = "Capture the Flag";
if ($result["game_type"] == "Flagball") $game_type = "Flagball";
$player_names = explode("\n", $result["player_names"]);
$player_teams = explode("\n", $result["player_teams"]);
$playercount = 16;
for($i=0; $i < count($player_names); $i++) {
$player_name = htmlspecialchars(base64_decode($player_names[$i]));
$player_team = $player_teams[$i];
if ($player_team == "Blue") $player_color = "#1796CB";
if ($player_team == "Red") $player_color = "#E3553C";
if ($player_team == "Yellow") $player_color = "yellow";
if ($player_team == "Violet") $player_color = "violet";
if ($player_team == "Green") $player_color = "#44DD44";
if ($player_team == "None") $player_color = "#44DD44";
if ($player_name == "SYSOP =422=") {
$result[num_players]--;
} else {
$players .= "[<font color='".$player_color."'><b>".$player_name."</b></font>] ";
$playercount++;
}
}
if(!$bg) {
$bg = $bgcolor2;
} elseif ($bg == $bgcolor2) {
$bg = $bgcolor2;
} elseif ($bg == $bgcolor2) {
$bg = $bgcolor2;
}
$serverid = $result["id"];
$content1 .= "<center><a href='http://trdsquad.com/chronos/index.php?action=servers&id=$serverid'
class='special1'></a>" ;
$content1 .= "<img src='http://trdsquad.com/chronos/templates/online.gif' alt='Online.gif' title='Online'
border='0'><br>";
$content1 .= "<b>".$result["server_name"]."</b><br>";
$sql2 = mysql_query("select * from `chronos_maps` where name='$codemap'", $db); // Change 'Stats_maps' to Your DB Table
$result2 = mysql_fetch_array($sql2, $dbi);
if ($result2["image"] && $servernum < 3) {
$content1 .= "<a href='http://www.trdsquad.com/chronos/index.php?action=servers&id=$serverid' target='_blank'
class='special1'><img src='http://trdsquad.com/chronos/$result2[image]' alt='$result[map_name]'
title='$result[map_name]' width='125' height='94' border='0'></a><br>";
$content1 .= $result[map_name]."<br>";
}
else {
$content1 .= $result[map_name]."<br>";
}
$content1 .= "$game_type<br>";
$content1 .= $result[num_players]." of ".$result[max_players]."</a><br>";
if ($result["player_names"] && $playercount > 1) { // { && $servernum == 1
$content1 .= "<MARQUEE behavior='scroll' align='center' direction='left' width='180' height='12' scrollamount='2'
scrolldelay='1' onmouseover='this.stop()' onmouseout='this.start()'>"
."<b>Players Online:</b> $players"
."</MARQUEE>";
}
$content1 .= "</td></tr>";
}
}
if (!$content1) {
$content = "<br><center><a href='http://trdsquad.com/chronos'><img src='http://trdsquad.com/chronos/templates/offline.gif' alt='offline.gif' title='Offline' border='0'></a></center><br>";
} else {
$content = "<br>$content1<br>";
}
?>
of course where the section that has
$dbhost = "localhost"; // Database host
$dbname = "xxxxxxxxx"; // Database name
$dbusername = "xxxxxxxxxxx"; // Database user name
$dbuserpw = "xxxxxxx"; // Database password
in it I removed the x's and put in the proper information for my database.
when i send this through I get a box for the block as I should, however there is nothing in the box.
Attached is a Screenshot of what it looks like now, I know there are PHP Nuke sites that get this to work and I have adjusted it to get it to work all that I can see that would need it. The above coding is how it has been altered by me. I will attach the original PHP file for some genius here to look and see what else I might be able to do to get this to work. Or if someone else out there has a working block that works for this I would love to see how they did theirs.
Thanks in advance for any and all help...
[attachment deleted by admin]