Php Nuke - Create Block

free web hosting
Free Web Hosting, No Ads > CONTRIBUTE > Computers > Programming Languages > PHP Programming

Php Nuke - Create Block

motili
Hi all!
Im want create server status block with these codes
CODE

<?php
if (eregi("block-Onlineplayers.php", $PHP_SELF)) {
Header("Location: index.php");
die();
}
//set server, port and timeout information
$server = "same adress";
$portg = "7777";
$portl = "2106";
$timeout = "1";

//try to open a connection to the game and login server
$game = @fsockopen("$server", $portg, $errno, $errstr, $timeout);
$login = @fsockopen("$server", $portl, $errno, $errstr, $timeout);

//let us know if the servers are up or not
echo $game ? "<img src=\"gameonline.jpg\">" : "<img src=\"gameoffline.jpg\">";
echo $login ? "<img src=\"loginonline.jpg\">" : "<img src=\"loginoffline.jpg\">";

//set host, username and password for MySQL
$dbhost = "some adress";
$dbuser = "some user";
$dbpass = "some password";

//connect to MySQL or return an error
$conn = mysql_connect("$dbhost", "$dbuser", "$dbpass")
or die('Could not connect: ' . mysql_error());

//set database name
$dbname = "some database";

//select database or return an error
$dbselect = mysql_select_db("$dbname") or die ('Could not select database');

//select all records from the characters table where that character is currently online
$chars = mysql_query("SELECT online FROM characters where online='1'") or die ('Query failed: ' . mysql_error());

//count how many online characters there are
$rows = mysql_num_rows($chars);

//convert the number of online characters to a string
$count =(string)$rows;

//convert each digit in the string to a graphic
for ($i=0; $i < strlen($count); $i++) { echo('<img src="' . $count{$i} . '.jpg">'); }

//close MySQL connection
mysql_close();

?>


Im already create the block-Onlineplayers.php and the block with administrator just the content is showing out the block and inside the block is show this:

"There isn't content right now for this block."

Please help me someone.Thx



Ok im look in the other blocks and made this just block is not working.Where is the problem?
CODE

<?php
if (eregi("block-Onlineplayers.php", $PHP_SELF)) {
Header("Location: index.php");
die();
}
$content = "//set server, port and timeout information ";
$content = "$server =\ "some ip";\ ";
$content = "$portg =\ "7777";\ ";
$content = "$portl =\ "2106";\ ";
$content = "$timeout =\ "1";\ ";
$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 = "//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 .= "echo $login ? "<img src=\"online.jpg\">" : "<img src=\"offline.jpg\">"; ";
$content = "//set host, username and password for MySQL ";
$content = "$dbhost =\ "some ip";\ ";
$content = "$dbuser =\ "some user";\ ";
$content = "$dbpass =\ "some password"; ";
$content = "//connect to MySQL or return an error ";
$content = "$conn =\ mysql_connect("$dbhost", "$dbuser", "$dbpass") ";
$content = "or die('Could not connect: ' . mysql_error()); ";
$content = "//set database name ";
$content = "$dbname =\ "some database"; ";
$content = "//select database or return an error ";
$content = "$dbselect =\ mysql_select_db("$dbname") or die ('Could not select database'); ";
$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 = "//count how many online characters there are ";
$content = "$rows =\ mysql_num_rows($chars); ";
$content = "//convert the number of online characters to a string ";
$content = "$count =\(string)$rows; ";
$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 = "//close MySQL connection ";
$content = "mysql_close(); ";
?>


Notice from rvalkass:

Code should be inside Code tags. Also, please try to post in the most relevant section of the forums - you'll get a quicker response. Moving to the PHP section.

 

 

 


Reply

motili
No One Can Help Me?Please....

Reply

motili
OMG im very lucky.No one want help me?
Im format the code a bit.Here is the new code just is show only the code inside the block!
CODE
<?php
/****************************************************************************/
/*  Generated by Block Creator - By Disipal Designs (www.disipal.net)       */
/*  PHP-Nuke Tools v4.00                                                    */
/****************************************************************************/
if (eregi("block-Block_Creator.php",$PHP_SELF)) {
    Header("Location: index.php");
    die();
}
$content  .=  "include(\"data.php\");";
$content  .= "$game = @fsockopen(\"$server\", $portg, $errno, $errstr, $timeout);";
$content  .= "$login = @fsockopen(\"$server\", $portl, $errno, $errstr, $timeout);";
$content  .= "echo $game ? \"<img src=\\\"gameonline.jpg\\\">\" : \"<img src=\\\"gameoffline.jpg\\\">\";";
$content  .= "echo $login ? \"<img src=\\\"loginonline.jpg\\\">\" : \"<img src=\\\"loginoffline.jpg\\\">\";";
$content  .= "echo '<img src=\"online.jpg\" width=\"50\" height=\"30\">';";
$content  .= "$conn = mysql_connect(\"$dbhost\", \"$dbuser\", \"$dbpass\")";
$content  .= "or die('Could not connect: ' . mysql_error());";
$content  .= "$dbselect = mysql_select_db(\"$dbname\") or die ('Could not select database');";
$content  .= "$chars = mysql_query(\"SELECT online FROM characters where online='1'\") or die ('Query failed: ' . mysql_error());";
$content  .= "$rows = mysql_num_rows($chars);";
$content  .= "$count =(string)$rows;";
$content  .= "for ($i=0; $i < strlen($count); $i++) { echo('<img src=\"' . $count{$i} . '.jpg\">'); }";
$content  .= "mysql_close(); ";
?>

 

 

 


Reply



Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

(Maximum characters: 10,000)
You have characters left.
Confirm Code:

Recent Queries:-
  1. php-nuke create blocks - 146.63 hr back. (1)
Similar Topics

Keywords : php, nuke, create, block

  1. Php Nuke And Google Adsense
    (3)
  2. Font Effects In Nuke
    php nuke8 (0)
    hi,..i want to ask ,about how to chane the font effect0color size.. etc) in nuke php 8..i dunno
    what's wrong with it..i displayed the html scripter in copnfig file..but it seems still acceting
    the problem.. anyone can help i will be really appreciate it......
  3. Help Me About Post Nuke
    (5)
    hii....please help me about postnuke.... I try to edit the site, so I opened their official site,
    but I still didn't know where Directory I must change the page???? please everybody...help
    me!!!!....
  4. Phpnuke, E107 Or Post Nuke?
    (13)
    I would say that php nuke and e107 are the best.....
  5. Is The First Time I Use Php Nuke Pls Someone Help
    php nuke instalation help (2)
    Basically this is my problem,...... QUOTE Warning: main(language/lang-.php): failed to open
    stream: No such file or directory in /home/www/latinunit.com/php/mainfile.php on line 228 Warning:
    main(language/lang-.php): failed to open stream: No such file or directory in
    /home/www/latinunit.com/php/mainfile.php on line 228 Warning: main(): Failed opening
    'language/lang-.php' for inclusion (include_path='.:/usr/local/lib/php') in
    /home/www/latinunit.com/php/mainfile.php on line 228 Warning: get_lang(admin/language/lang-.php):
    failed to open stream: ....
  6. Php-nuke
    (20)
    Does anyone know where to get PHP-Nuke scripts? I want to know where there is for free cause I wanna
    try it and see if they are better than the scripts I got. If anyone knows where I can get them, I
    would like to know.....
  7. Php Nuke
    (2)
    I have recently been experimenting with php nuke the pre installed script. I noticed places where
    you can download different themes and skins but i havent found anywhere do download mods for it.
    Does anyone know of a site? I tried searching but no luck. I have also tried the postnuke site
    management as well and it is very closely related to php nuke. Post nuke is quite different in some
    ways though. The modules and blocks are in simple form and easy to setup. This seems like a program
    used for simple sites not with all the features and extras that php nuke has to offer.....
  8. Best Content management system?
    PHP Nuke, Post Nuke, mambo....???? (21)
    Hi! What is the best content management system in your opinion? I have looked around and it is
    very confusing... Since I am planning on an education site, I want to go for the best open-source
    system that is easy to handle and has plenty of features... Can you please suggest? Thank you
    Googlue!....
  9. Nuke help
    (10)
    I'm really in a fix. I've installed phpnuke and created the database for it, but I still
    can't get it to work. I used phpNuke installer7.2, and everytime I tried to test it it says the
    database doesn't exist though it does. Can you help me sort this our guys? /sad.gif"
    style="vertical-align:middle" emoid=":(" border="0" alt="sad.gif" />....
  10. Php-nuke
    (10)
    Wow! I've never really understood what it was until my friend made a nuke site. Now with
    this free hosting I autoinstalled it. Its soo great, i dont know how anyone would make sites with
    out it heh......

    1. Looking for php, nuke, create, block

*RANDOM STUFF*





*SIMILAR VIDEOS*
Searching Video's for php, nuke, create, block

*MORE FROM TRAP17.COM*
advertisement



Php Nuke - Create Block



 

 

 

 

ADD REPLY / Got an Opinion! a humble request :-) RAPID SEARCH! Free Hosting [X]
Express your Opinions, Thoughts or Contribute more info. to help others.
Ask your Doubts & Queries to get answers, So that "Together We can help others!"
Register FREE for AD-FREE forum, Create your own topics, Ask Questions, track topics, setup subscriptions & notifications and Get a Free Website w/ Email and FTP.
500MB Space *No Ads*, CPanel, FTP, PHP, MySQL, EMails - 100% FREE