Jump to content
  • 0

Server status and Online player for wordpress web theme


Ace D Potgas

Question


  • Group:  Members
  • Topic Count:  19
  • Topics Per Day:  0.00
  • Content Count:  31
  • Reputation:   1
  • Joined:  08/04/12
  • Last Seen:  

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
Link to comment
Share on other sites

7 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  54
  • Topics Per Day:  0.01
  • Content Count:  513
  • Reputation:   83
  • Joined:  08/11/12
  • Last Seen:  

  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;

}

?>

Link to comment
Share on other sites

  • 0

  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10013
  • Reputation:   2348
  • Joined:  10/28/11
  • Last Seen:  

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
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  19
  • Topics Per Day:  0.00
  • Content Count:  31
  • Reputation:   1
  • Joined:  08/04/12
  • Last Seen:  

 

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
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  0
  • Topics Per Day:  0
  • Content Count:  1
  • Reputation:   0
  • Joined:  12/28/15
  • Last Seen:  

 

 

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 ?

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  2
  • Topics Per Day:  0.00
  • Content Count:  29
  • Reputation:   7
  • Joined:  05/12/12
  • Last Seen:  

 

 

 

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
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  49
  • Topics Per Day:  0.01
  • Content Count:  1535
  • Reputation:   237
  • Joined:  08/03/12
  • Last Seen:  

just use <?php tags or call php function

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  0
  • Topics Per Day:  0
  • Content Count:  1
  • Reputation:   0
  • Joined:  12/15/15
  • Last Seen:  

thank you

Link to comment
Share on other sites

×
×
  • Create New...