>>  Site Map >>  Forums >>  Blocks

Forum module - topics in forum:



Blocks - Having problems with a block? Code doesn't work, get help here.



Server Status Block!

Hi! Im trying build a Lineage II server status block.Is working just only out of the block.If im format it with the block builder is showing only the code inside.
Can someone help me with this please?

This one is formated with Block Builder and is not working!

Code: :

<?php
#### Generated by Block Creator by Disipal Site (www.disipal.net) ###
if (eregi("block-Block_Creator.php",$PHP_SELF)) {
    Header("Location: index.php");
    die();
}
$content  = "include(\"data.php\");";
$content  .= "//try to open a connection to the game and login server";
$content  .= "$game = @fsockopen(\"$server\", $portg, $errno, $errstr, $timeout);";
$content  .= "$login = @fsockopen(\"$server\", $portl, $errno, $errstr, $timeout);";
$content  .= "";
$content  .= "//let us know if the servers are up or not";
$content  .= "echo $game ? \"<img src=\\\"gameonline.jpg\\\">\" : \"<img src=\\\"gameoffline.jpg\\\">\";";
$content  .= "echo $login ? \"<img src=\\\"loginonline.jpg\\\">\" : \"<img src=\\\"loginoffline.jpg\\\">\";";
$content  .= "";
$content  .= "//connect to MySQL or return an error";
$content  .= "$conn = mysql_connect(\"$dbhost\", \"$dbuser\", \"$dbpass\") or die('Could not connect: ' . mysql_error());";
$content  .= "";
$content  .= "//select database or return an error";
$content  .= "$dbselect = mysql_select_db(\"$dbname\") or die ('Could not select database');";
$content  .= "";
$content  .= "//select all records from the characters table where that character is currently online";
$content  .= "$chars = mysql_query(\"SELECT online FROM characters where online='1'\") or die ('Query failed: ' . mysql_error());";
$content  .= "";
$content  .= "//count how many online characters there are";
$content  .= "$rows = mysql_num_rows($chars);";
$content  .= "";
$content  .= "//convert the number of online characters to a string";
$content  .= "$count =(string)$rows;";
$content  .= "";
$content  .= "//convert each digit in the string to a graphic";
$content  .= "for ($i=0; $i < strlen($count); $i++) { echo('<img src=\"' . $count{$i} . '.jpg\">'); }";
$content  .= "";
$content  .= "//close MySQL connection";
$content  .= "mysql_close(); ";
?>


And this one is clean and is working out of the block only!

Code: :

<?php
if ( !defined('BLOCK_FILE') ) {
    Header("Location: ../index.php");
    die();
}
include("data.php");
$game = @fsockopen("$server", $portg, $errno, $errstr, $timeout);
$login = @fsockopen("$server", $portl, $errno, $errstr, $timeout);
echo $game ? "<img src=\"gameonline.jpg\">" : "<img src=\"gameoffline.jpg\">";
echo $login ? "<img src=\"loginonline.jpg\">" : "<img src=\"loginoffline.jpg\">";
echo '<img src="online.jpg" width="50" height="30">';
$conn = mysql_connect("$dbhost", "$dbuser", "$dbpass")
or die('Could not connect: ' . mysql_error());
$dbselect = mysql_select_db("$dbname") or die ('Could not select database');
$chars = mysql_query("SELECT online FROM characters where online='1'") or die ('Query failed: ' . mysql_error());
$rows = mysql_num_rows($chars);
$count =(string)$rows;
for ($i=0; $i < strlen($count); $i++) { echo('<img src="' . $count{$i} . '.jpg">'); }
mysql_close();
?>


Thx for your time and help! http://www.mega-alexander.com






You can not insert php code in the block builder.

It is ment yo convert html to a phpnuke block. Nothing more.






Hi!Thx for replay.So is not way here to insert this code to block?Please help me.Thx




Attention! You are currently viewing sitemap page!
We strongly suggest to look at original content

Search from web

Valid HTML 4.01 Valid CSS