Jump to content
  • 0

Server status and Online player for wordpress web theme


Question

Posted (edited)

Hi, as mention on the topic title. Can anyone teach me how to add (codes, etc..) to my wordpress web theme to show my current server online status and player onlines. I saw some RO server have this feature while using wordpress theme. Here are some example :-

 

RO server A (using wordpress theme)

 

Capture1.png

 

RO server B 

 

Capture2.png

Edited by Orange00

7 answers to this question

Recommended Posts

  • 0
Posted

  1. You need to do an sql query from your web to your server. Try this one.


<?php

$ServerIP = "1.1.1.1";

$DBName = "RagnarokDB";

$DBTable = "login";

$DBUser = "SQLUsername";

$DBPass = "SQLPassword";

$query = 'SELECT COUNT(`char_id`) FROM `char` WHERE `online` = 1';

$connection = mysql_connect($servername, $username, $password);

$db_selected = mysql_select_db($dbname, $connection);

if(!mysql_query( $query ,$connection))

{

echo "Failed to do SQL query. Please check your settings.";

} else {

echo "Online Players: ". $query;

}

?>

  • 0
Posted (edited)

 

i guess they just wrote their custom SQL statement to retrieve the info at the top of the header .

 

references : http://www.w3schools.com/php/php_mysql_select.asp

 

Possible SQL Query

SELECT COUNT(`char_id`) FROM `char` WHERE `online` = 1

 

Thanks for the reply Emistry. But then, wordpress was based on HTML code, the code as mentioned in the above link reference is based on php. I think it wont work if i add those code & statement.

Well, i manage to add the status online using a simple coding. However now looking foward to add Player Online.. Got any idea?

 

Capture.png

Nvm. Got it done by a help from my friend .. server status and player online done  :)

 

Capture123.png

 

Hope there is more active member in this community to help around in the future..

Edited by Ace D Potgas
  • 0
Posted

 

 

i guess they just wrote their custom SQL statement to retrieve the info at the top of the header .

 

references : http://www.w3schools.com/php/php_mysql_select.asp

 

Possible SQL Query

SELECT COUNT(`char_id`) FROM `char` WHERE `online` = 1

 

Thanks for the reply Emistry. But then, wordpress was based on HTML code, the code as mentioned in the above link reference is based on php. I think it wont work if i add those code & statement.

Well, i manage to add the status online using a simple coding. However now looking foward to add Player Online.. Got any idea?

 

Capture.png

Nvm. Got it done by a help from my friend .. server status and player online done  :)

 

Capture123.png

 

Hope there is more active member in this community to help around in the future..

 

 

Hi Ace, can u share for code please ?

  • 0
Posted

 

 

 

i guess they just wrote their custom SQL statement to retrieve the info at the top of the header .

 

references : http://www.w3schools.com/php/php_mysql_select.asp

 

Possible SQL Query

SELECT COUNT(`char_id`) FROM `char` WHERE `online` = 1

 

Thanks for the reply Emistry. But then, wordpress was based on HTML code, the code as mentioned in the above link reference is based on php. I think it wont work if i add those code & statement.

Well, i manage to add the status online using a simple coding. However now looking foward to add Player Online.. Got any idea?

 

Capture.png

Nvm. Got it done by a help from my friend .. server status and player online done  :)

 

Capture123.png

 

Hope there is more active member in this community to help around in the future..

 

 

Hi Ace, can u share for code please ?

 

 

The code is already up above your post bud.  /no1 

 

SELECT COUNT(`char_id`) FROM `char` WHERE `online` = 1
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...