| 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(); "; ?> |
| 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(); ?> |