Advertisement
Guest User

Untitled

a guest
Aug 11th, 2017
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.19 KB | None | 0 0
  1. <?php
  2. //wotlk realms
  3. $realm['db'][1] = "cruelwow_character";
  4. $realm['db'][2] = "cruelwow_character2";
  5. $realm[1]['name'] = "Campfire";
  6. $realm[2]['name'] = "Evolution";
  7. $total = "500"; //Amount of players for every realm
  8. //cataclysm realm
  9. $cata_host = "208.43.75.58:3308";
  10. $cata_user = "root";
  11. $cata_pass = "ilovemymom123";
  12. $realm['db'][3] = "cruelwow_character4";
  13. $realm[3]['name'] = "Eclipse (Cataclysm Realm)";
  14.  
  15. //stop configs code further dont touch!
  16. $realm['realm'][1] = mysql_connect($mysql_host, $mysql_user, $mysql_pass) or die("Realm 1 is experiencing technical difficulties");
  17. $realm['realm'][2] = mysql_connect($mysql_host, $mysql_user, $mysql_pass) or die("Realm 2 is experiencing technical difficulties");
  18. $realm['realm'][3] = mysql_connect($cata_host, $cata_user, $cata_pass) or die("Realm 3 is experiencing technical difficulties");
  19.  
  20. $realms = new realms($realm['db'][1], $realm['realm'][1], $realm['db'][2], $realm['realm'][2], $realm['db'][3], $realm['realm'][3]);
  21. class realms{
  22.  
  23. var $db1;
  24. var $id1;
  25. var $db2;
  26. var $id2;
  27. var $db3;
  28. var $id3;
  29.  
  30.  
  31. function __construct($db1, $link1, $db2, $link2, $db3, $link3) {
  32.  
  33.  
  34. $this->db1 = $db1;
  35. $this->id1 = $link1;
  36. $this->db2 = $db2;
  37. $this->id2 = $link2;
  38. $this->db3 = $db3;
  39. $this->id3 = $link3;
  40.  
  41.  
  42. }
  43.  
  44. function status() {
  45.  
  46. global $total, $realm;
  47.  
  48. $realm1 = mysql_query("SELECT COUNT(*) AS total FROM ".$this->db1.".characters WHERE online='1'", $this->id1);
  49. $realm1_q = mysql_fetch_assoc($realm1);
  50. $online[1] = $realm1_q['total'];
  51.  
  52.  
  53. $realm2 = mysql_query("SELECT COUNT(*) AS total FROM ".$this->db2.".characters WHERE online='1'", $this->id2);
  54. $realm2_q = mysql_fetch_assoc($realm2);
  55. $online[2] = $realm2_q['total'];
  56.  
  57. $realm3 = mysql_query("SELECT COUNT(*) AS total FROM ".$this->db3.".characters WHERE online='1'", $this->id3);
  58. $realm3_q = mysql_fetch_assoc($realm2);
  59. $online[3] = $realm3_q['total'];
  60.  
  61. /*$output = 'Realm 1: '..'<br>Realm 2: '.$online[2].'<br>Realm 3: '.$online[2].'';
  62. echo $output;*/
  63. if(!$realm2)
  64. {
  65. $online[2] = "Server 2 is having issues";
  66. }elseif(!$realm1){
  67. $online[1] = "Server 1 is having Issues";
  68. }else{
  69. $count1 = $online[1] / 1500;
  70. $count2 = $count1 * 100;
  71.  
  72. $percent[1] = $count2;
  73.  
  74. $count1_2 = $online[2] / 1000;
  75. $count2_2 = $count1_2 * 100;
  76.  
  77. $percent[2] = $count2_2;
  78. //Realm 3
  79.  
  80. $count1_3 = $online[3] / 1000;
  81. $count2_3 = $count1_3 * 100;
  82.  
  83. $percent[3] = $count2_3;
  84. //total
  85.  
  86. $online[4] = $online[1] + $online[2] + $online[3];
  87. $count1_4 = $online[4] / (2500);
  88. $count2_34 = $count1_4 * 100;
  89.  
  90. $percent[4] = $count2_34;}
  91.  
  92. $output = '<center>
  93. <div id="realm_spacer"></div>
  94.  
  95. <div class="realm_info">Players Online</div>
  96. <div class="realmbar"><div class="realm_fill" style="width:'.$percent[4].'%;"></div></div>
  97. <div class="realm_info">'.$online[4] .' / '. (1500 + 1000 + 1000) . '</div></div>
  98. <div id="realm_spacer"></div>
  99. <div id="realm_spacer"></div>
  100. <div id="realm_spacer"></div>
  101. <div id="realm_spacer"></div>
  102. </center>';
  103.  
  104. echo $output;
  105.  
  106.  
  107.  
  108. }
  109. }
  110. $realms->status();
  111. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement