- Timestamp:
- Aug 7, 2009, 10:03:50 PM (15 years ago)
- Location:
- trunk/inc
- Files:
-
- 1 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/inc/config.sample.php
r597 r609 19 19 'UDBRevision' => '204', 20 20 'ScriptDev2Revision' => '137', 21 'ClientVersion' => '3. 0.9',22 ' MaxOnlinePlayers' => 100,21 'ClientVersion' => '3.1.3', 22 'DatabaseRealmd' => 'realmd', 23 23 'RequiredOnlinePlayers' => 70, 24 'DatabaseMangos' => 'mangos',25 'DatabaseCharacters' => 'characters',26 'DatabaseRealmd' => 'realmd',27 'DatabaseScriptDev2' => 'scriptdev2',28 24 'GMCommandsLog' => 'gm_commands.log', 29 25 'CharacterDataOffset' => array … … 34 30 'HonorPoints' => 1648, 35 31 'ArenaPoints' => 1649, 32 ), 33 'RealmList' => array( 34 1 => array( 35 'Name' => 'Realm 1' 36 'DatabaseCharacters' => 'realm1_characters', 37 'DatabaseMangos' => 'realm1_mangos', 38 'DatabaseScriptDev2' => 'realm1_scriptdev2', 39 'MaxOnlinePlayers' => 100, 40 'XPRate' => 1, 41 'Type' => 'Normalní', 42 'Description' => 'Hlavní realm', 43 ), 36 44 ), 37 45 ), … … 50 58 'ShowSQLError' => false, 51 59 'ShowSQLQuery' => false, 60 'ShowPHPError' => false, 52 61 ), 53 62 'CheckRegistration' => array -
trunk/inc/html.php
r595 r609 195 195 public function ShowNews($kategorie) 196 196 { 197 198 197 global $Config; 198 199 199 echo('<table class="NewsCategoryTable">'. 200 200 '<tr>'. … … 214 214 $where = 'WHERE `category` = "'.$kategorie.'"'; 215 215 } 216 216 217 217 $this->db->select_db($Config['Database']['Database']); 218 218 $limit = 5; … … 297 297 '<tr>'. 298 298 '<td colspan="2">'. 299 '<strong>Server : </strong>'.$server->ServerImg($server->ServerOnline($Config['Web']['WoWServerAddr'], 8085)).'<b> (<a href="?page=online">'.$server->MangosOnline().' hráčů</a>) | Patch '.$Config['Mangos']['ClientVersion'].' | <a href="'.$Config['Web']['BaseURL'].'/pages/realmlist.wtf">Realmlist</a> | Více info <a href="?page=server">zde</a></b>'.299 '<strong>Server : </strong>'.$server->ServerImg($server->ServerOnline($Config['Web']['WoWServerAddr'], 3724)).'<b> (<a href="?page=online">'.$server->ServerMangosOnline().' hráčů</a>) | Patch '.$Config['Mangos']['ClientVersion'].' | <a href="'.$Config['Web']['BaseURL'].'/pages/realmlist.wtf">Realmlist</a> | Více info <a href="?page=server">zde</a></b>'. 300 300 '</td></tr></table><br />'); 301 301 } -
trunk/inc/player.php
r583 r609 7 7 private $db; 8 8 9 function __construct 9 function __construct($db) 10 10 { 11 11 $this->db = &$db; … … 15 15 { 16 16 if($err == 0) echo('<img src="imgs/inc/on.gif"> <font color="#234303" size="4">'.$text.'</font><br />'); 17 else echo('<img src="imgs/inc/off.gif"> <font color="#990000" size="4\">'.$text.'</font><br />');17 else echo('<img src="imgs/inc/off.gif"> <font color="#990000" size="4\">'.$text.'</font><br />'); 18 18 } 19 19 … … 49 49 if($sql->num_rows == 1) 50 50 { 51 $row = $sql->fetch_a rray();51 $row = $sql->fetch_assoc(); 52 52 $_SESSION['UserId'] = $row['id']; 53 53 $_SESSION['UserName'] = $username; … … 73 73 if(!array_key_exists('Time', $_SESSION)) $_SESSION['Time'] = time(); 74 74 if(!array_key_exists('UserId', $_SESSION)) $_SESSION['UserId'] = 0; 75 if($_SESSION['Time'] < (time() - 60 * $this->SessionTimeout)) 76 { 77 $this->Logout(); 78 } 75 if($_SESSION['Time'] < (time() - 60 * $this->SessionTimeout)) $this->Logout(); 79 76 $_SESSION['Time'] = time(); 80 77 return($_SESSION['UserId'] != 0); … … 83 80 public function LoginForm() 84 81 { 85 echo('<form method="post" action="?page=acc"> 86 <table>87 <tr>88 82 echo('<form method="post" action="?page=acc">'. 83 '<table>'. 84 '<tr>'. 85 '<td><b>Jméno : </b></td><td><input type="text" name="user" class="textinput"></td> 89 86 </tr> 90 87 <tr> … … 97 94 </form> 98 95 <div align="left"> 99 <a href="?page=register">Registrace</a><br /> <a href="?page=lostpass">Obnova hesla</a>100 </div>');96 <a href="?page=register">Registrace</a><br />'. //<a href="?page=lostpass">Obnova hesla</a> 97 '</div>'); 101 98 } 102 99 … … 105 102 global $Config; 106 103 107 $this->db->select_db($Config['Mangos']['DatabaseCharacters']); 108 $DbResult = $this->db->query( 109 'SELECT CAST(SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, " ", '.($Config['Mangos']['CharacterDataOffset']['Level'] + 1).'), " ", -1)'. 110 ' AS UNSIGNED) AS `level` FROM `characters` WHERE `guid` = "'.$guid.'" LIMIT 1;'); 104 $this->db->select_db($Config['Mangos']['RealmList'][$_COOKIE['RealmIndex']]['DatabaseCharacters']); 105 $DbResult = $this->db->query('SELECT CAST(SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, " ", '.($Config['Mangos']['CharacterDataOffset']['Level'] + 1).'), " ", -1) AS UNSIGNED) AS `level` FROM `characters` WHERE `guid` = "'.$guid.'" LIMIT 1;'); 111 106 $row = $DbResult->fetch_assoc(); 112 107 return($row['level']); … … 146 141 if(!$this->IsOnline($guid)) 147 142 { 148 $this->db->select_db($Config['Mangos'][' DatabaseCharacters']);143 $this->db->select_db($Config['Mangos']['RealmList'][$_COOKIE['RealmIndex']]['DatabaseCharacters']); 149 144 $row = $this->db->query('SELECT `data` FROM `characters` WHERE `guid` = "'.$guid.'" LIMIT 1')->fetch_assoc(); 150 145 $data = explode(' ', $row['data']); … … 161 156 global $Config; 162 157 163 $this->db->select_db($Config['Mangos'][' DatabaseCharacters']);158 $this->db->select_db($Config['Mangos']['RealmList'][$_COOKIE['RealmIndex']]['DatabaseCharacters']); 164 159 if($this->CharInAcc($guid, 0)) 165 160 { … … 189 184 global $Config; 190 185 191 $this->db->select_db($Config['Mangos'][' DatabaseCharacters']);186 $this->db->select_db($Config['Mangos']['RealmList'][$_COOKIE['RealmIndex']]['DatabaseCharacters']); 192 187 // .go xyz -90.54 41.35 -31.71 193 188 // .go xyz -91.01 100.46 -31.71 … … 230 225 global $Config; 231 226 232 $this->db->select_db($Config['Mangos'][' DatabaseCharacters']);227 $this->db->select_db($Config['Mangos']['RealmList'][$_COOKIE['RealmIndex']]['DatabaseCharacters']); 233 228 $row = $this->db->query('SELECT `online` FROM `characters` WHERE `guid` = "'.$guid.'" LIMIT 1;')->fetch_assoc(); 234 229 if($row['online'] == 1) return(true); 235 else return(false);230 else return(false); 236 231 } 237 232 … … 246 241 $acc = $_SESSION['UserId']; 247 242 } 248 $this->db->select_db($Config['Mangos'][' DatabaseCharacters']);243 $this->db->select_db($Config['Mangos']['RealmList'][$_COOKIE['RealmIndex']]['DatabaseCharacters']); 249 244 if($this->db->query('SELECT `guid` FROM `characters` WHERE `characters`.`guid`="'.$char.'" AND `account`="'.$acc.'" LIMIT 1;')->num_rows == 1) 250 245 { … … 265 260 global $Config; 266 261 267 $this->db->select_db($Config['Mangos'][' DatabaseCharacters']);262 $this->db->select_db($Config['Mangos']['RealmList'][$_COOKIE['RealmIndex']]['DatabaseCharacters']); 268 263 $row = $this->db->query('SELECT `guid` FROM `characters` WHERE `name` LIKE "'.$name.'" LIMIT 1;')->fetch_assoc(); 269 264 if($row['guid'] != '') … … 280 275 global $Config; 281 276 282 $this->db->select_db($Config['Mangos'][' DatabaseCharacters']);277 $this->db->select_db($Config['Mangos']['RealmList'][$_COOKIE['RealmIndex']]['DatabaseCharacters']); 283 278 $row = $this->db->query('SELECT `name` FROM `characters` WHERE `guid` = "'.$guid.'" LIMIT 1;')->fetch_assoc(); 284 279 if($row['name'] != '') … … 359 354 <th>Nahráno</th> 360 355 </tr>'); 361 $this->db->select_db($Config['Mangos'][' DatabaseCharacters']);356 $this->db->select_db($Config['Mangos']['RealmList'][$_COOKIE['RealmIndex']]['DatabaseCharacters']); 362 357 echo($this->db->error); 363 358 $sql = $this->db->query('SELECT `guid`,`name`,`race`,`totaltime`,`class`, mid(lpad( hex( CAST(substring_index(substring_index(data, " ", '.($Config['Mangos']['CharacterDataOffset']['Gender'] + 1).'), " ",-1) AS unsigned) ), 8, 0), 4, 1) AS gender FROM `characters` WHERE `account`='.$accid.' ORDER BY `totaltime` DESC LIMIT 0, 10'); -
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.