Changeset 609 for trunk/inc/server.php
- Timestamp:
- Aug 7, 2009, 10:03:50 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/inc/server.php
r596 r609 1 1 <?php 2 3 function NullErrorHandler() 4 { 5 } 2 6 3 7 class Server … … 45 49 } 46 50 47 public function MangosOnline( )51 public function MangosOnline($RealmId) 48 52 { 49 53 global $Config; 50 54 51 $this->db->select_db($Config['Mangos'][' DatabaseCharacters']);55 $this->db->select_db($Config['Mangos']['RealmList'][$RealmId]['DatabaseCharacters']); 52 56 $DbResult = $this->db->query('SELECT COUNT(*) FROM `characters` WHERE `online` = 1'); 53 57 $DbRow = $DbResult->fetch_row(); … … 55 59 } 56 60 57 public function ServerOnline($ip, $port) 58 { 59 if($fp1 = @fsockopen($ip, $port, $ERROR_NO, $ERROR_STR, (float)0.5)) 61 public function ServerMangosOnline() 62 { 63 global $Config; 64 65 $TotalCount = 0; 66 foreach($Config['Mangos']['RealmList'] as $Index => $Realm) 60 67 { 61 fclose($fp1); 62 return(true); 63 } else 68 $TotalCount += $this->MangosOnline($Index); 69 } 70 return($TotalCount); 71 } 72 73 public function ServerOnline($Address, $Port, $Timeout = 0.5) 74 { 75 set_error_handler('NullErrorHandler'); 76 if($Socket = @fsockopen($Address, $Port, $ERROR_NO, $ERROR_STR, (float)$Timeout)) 64 77 { 65 return(false); 66 } 67 } 78 fclose($Socket); 79 $Result = true; 80 } else $Result = false; 81 restore_error_handler(); 82 return($Result); } 68 83 69 84 public function ServerImg($status) … … 75 90 public function ServerUptime() 76 91 { 77 92 global $Config; 78 93 79 94 $this->db->select_db($Config['Mangos']['DatabaseRealmd']); … … 84 99 } 85 100 86 public function CharacterCount( )87 { 88 global $Config; 89 90 $this->db->select_db($Config['Mangos'][' DatabaseCharacters']);101 public function CharacterCount($RealmId) 102 { 103 global $Config; 104 105 $this->db->select_db($Config['Mangos']['RealmList'][$RealmId]['DatabaseCharacters']); 91 106 $row = $this->db->query('SELECT COUNT(*) FROM characters')->fetch_row(); 92 107 return($row[0]); 93 108 } 94 109 110 public function ServerCharacterCount() 111 { 112 global $Config; 113 114 $TotalCount = 0; 115 foreach($Config['Mangos']['RealmList'] as $Index => $Realm) 116 { 117 $TotalCount += $this->CharacterCount($Index); 118 } 119 return($TotalCount); 120 } 121 95 122 public function AccountCount() 96 123 { 97 124 global $Config; 98 125 99 126 $this->db->select_db($Config['Mangos']['DatabaseRealmd']); … … 104 131 public function GuidToCharName($guid) 105 132 { 106 107 108 $this->db->select_db($Config['Mangos'][' DatabaseCharacters']);133 global $Config; 134 135 $this->db->select_db($Config['Mangos']['RealmList'][$_COOKIE['RealmIndex']]['DatabaseCharacters']); 109 136 $row = $this->db->query('SELECT `name` FROM `characters` WHERE `guid` = "'.$guid.'" LIMIT 1')->fetch_array(); 110 137 return($row['name']); … … 198 225 $map_id = Array 199 226 ( 200 227 0 => array(0,"Azeroths"), 201 228 1 => array(1,"Kalimdor"), 202 229 13 => array(13,"Test Zone"), … … 269 296 ); 270 297 if(isset($map_id[$id])) return($map_id[$id][1]); 271 298 else return("Neznámá"); 272 299 } 273 300 … … 276 303 $zone_id = Array 277 304 ( 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 305 1497 => Array("Undercity",1497), 306 1537 => Array("Ironforge",1537), 307 1519 => Array("Stormwind city",1519), 308 3 => Array("Badlands",3), 309 11 => Array("Wetlands",11), 310 33 => Array("Stranglethorn Vale",33), 311 44 => Array("Redridge Mountains",44), 312 38 => Array("Loch Modan",38), 313 10 => Array("Duskwood",10), 314 41 => Array("Deadwind Pass",41), 315 12 => Array("Elwynn Forest",12), 316 46 => Array("Burning Steppes",46), 317 51 => Array("Searing Gorge",51), 318 1 => Array("Dun Morogh",1), 319 47 => Array("The Hinterlands",47), 320 40 => Array("Westfall",40), 321 267 => Array("Hillsbrad Foothills",267), 322 139 => Array("Eastern Plaguelands",139), 323 28 => Array("Western Plaguelands",28), 324 130 => Array("Silverpine Forest",130), 325 85 => Array("Tirisfal Glades",85), 326 4 => Array("Blasted Lands",4), 327 8 => Array("Swamp of Sorrows",8), 328 45 => Array("Arathi Highlands",45), 329 36 => Array("Alterac Mountains",36), 330 1657 => Array("Darnassus",1657), 331 1638 => Array("Thunder_bluff",1638), 332 1637 => Array("Orgrimmar",1637), 333 493 => Array("Moonglade",493), 334 1377 => Array("Silithus",1377), 335 618 => Array("Winterspring",618), 336 490 => Array("Un Goro Crater",490), 337 361 => Array("Felwood",361), 338 16 => Array("Azshara",16), 339 440 => Array("Tanaris",440), 340 15 => Array("Dustwallow Marsh",15), 341 215 => Array("Mulgore",215), 342 357 => Array("Feralas",357), 343 405 => Array("Desolace",405), 344 400 => Array("Thousand Needles",400), 345 14 => Array("Durotar",14), 346 331 => Array("Ashenvale",331), 347 148 => Array("Darkshore",148), 348 141 => Array("Teldrassil",141), 349 406 => Array("Stonetalon Mountains",406), 350 17 => Array("She Barrens",17), 351 3703 => Array("Shattrath city",3703), 352 3487 => Array("Silvermoon city",3487), 353 3523 => Array("Netherstorm",3523), 354 3519 => Array("Terokkar Forest",3519), 355 3518 => Array("Nagrand",3518), 356 3525 => Array("Bloodmyst Isle",3525), 357 3522 => Array("Blades Edge Mountains",3522), 358 3520 => Array("Shadowmoon Valley",3520), 359 3557 => Array("The Exodar",3557), 360 3521 => Array("Zangarmarsh",3521), 361 3483 => Array("Hellfire Peninsula",3483), 362 3524 => Array("Azuremyst Isle",3524), 363 3433 => Array("Ghostlands",3433), 364 3430 => Array("Eversong Woods",3430) 338 365 ); 339 366 if(isset($zone_id[$id])) return($zone_id[$id][0]);
Note:
See TracChangeset
for help on using the changeset viewer.