- Timestamp:
- Feb 10, 2009, 4:45:05 PM (16 years ago)
- Location:
- beta/inc
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
beta/inc/player.php
r405 r427 1 1 <?php 2 2 3 class Player { 3 4 var $SessionTimeout = 30; … … 22 23 // -- err 23 24 public function Register ($acc_name , $pass , $email , $tbc) 24 { 25 $this -> db -> select_db( "realm1_realmd");25 { include("inc/db.php"); 26 $this -> db -> select_db($db_realmd); 26 27 $find = $this -> db -> query("SELECT `id` FROM `account` WHERE `username` = '".$acc_name."';"); 27 28 if ($find -> num_rows == 0) … … 45 46 public function Login ($username,$pass) 46 47 { 47 $this -> db -> select_db("realm1_realmd"); 48 include("inc/db.php"); 49 $this -> db -> select_db($db_realmd); 48 50 $sha_pass = sha1(strtoupper($username).":".strtoupper($pass)); 49 51 $sql = $this -> db -> query("SELECT `id` FROM `account` WHERE `account`.`username`='".$username."' AND `account`.`sha_pass_hash`='".$sha_pass."'"); … … 107 109 public function GetPlayerLvl ($guid) 108 110 { 111 include("inc/db.php"); 109 112 // $this -> NumCheck($guid); 110 $this -> db -> select_db( "realm1_characters");113 $this -> db -> select_db($db_characters); 111 114 $row = $this -> db -> query("SELECT CAST(SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', 35), ' ', -1) AS UNSIGNED) AS `level` FROM `characters` WHERE `guid` = '".$guid."' LIMIT 1;") -> fetch_array(); 112 115 return $row["level"]; … … 115 118 public function GetGmLvl () 116 119 { 120 include("inc/db.php"); 117 121 // $this -> NumCheck($guid); 118 $this -> db -> select_db( "realm1_realmd");122 $this -> db -> select_db($db_realmd); 119 123 $row = $this -> db -> query("SELECT `gmlevel` FROM `account` WHERE `id` = '".$_SESSION["UserId"]."' LIMIT 1;") -> fetch_array(); 120 124 return $row["gmlevel"]; … … 205 209 if (!$this -> IsOnline($guid)) 206 210 { 207 $this -> db -> select_db("realm1_characters"); 211 include("inc/db.php"); 212 $this -> db -> select_db($db_characters); 208 213 $row = $this -> db -> query("SELECT `data` FROM `characters` WHERE `guid` = '".$guid."' LIMIT 1;") -> fetch_array(); 209 214 $data = explode(" ",$row["data"]); … … 225 230 if (!$this -> IsOnline($guid)) 226 231 { 227 $this -> db -> select_db("realm1_characters"); 232 include("inc/db.php"); 233 $this -> db -> select_db($db_characters); 228 234 $row = $this -> db -> query("SELECT * FROM `character_homebind` WHERE `guid` = '".$guid."' LIMIT 1;") -> fetch_array(); 229 235 $home_char_map = $row["map"]; … … 272 278 if (!$this -> IsOnline($guid)) 273 279 { 274 $this -> db -> select_db("realm1_characters"); 280 include("inc/db.php"); 281 $this -> db -> select_db($db_characters); 275 282 $this -> db -> query("UPDATE `characters` SET 276 283 `map` = '35' , … … 295 302 public function IsOnline ($guid) 296 303 { 297 $this -> db -> select_db("realm1_characters"); 304 include("inc/db.php"); 305 $this -> db -> select_db($db_characters); 298 306 $row = $this -> db -> query("SELECT `online` FROM `characters` WHERE `guid` = '".$guid."' LIMIT 1;") -> fetch_array(); 299 307 if ($row["online"] == 1) … … 307 315 if ($this -> Check()) 308 316 { 317 include("inc/db.php"); 309 318 if ($acc == 0) 310 319 {$acc = $_SESSION["UserId"];} 311 $this -> db -> select_db( "realm1_characters");320 $this -> db -> select_db($db_characters); 312 321 if ($this -> db -> query("SELECT `guid` FROM `characters` WHERE `characters`.`guid`='".$char."' AND `characters`.`account`='".$acc."' LIMIT 1;") -> num_rows == 1) 313 322 {return true;} … … 324 333 public function CharNameToGuid ($name) 325 334 { 326 $this -> db -> select_db("realm1_characters"); 335 include("inc/db.php"); 336 $this -> db -> select_db($db_characters); 327 337 $row = $this -> db -> query("SELECT `guid` FROM `characters` WHERE `name` LIKE '".$name."' LIMIT 1;") -> fetch_array(); 328 338 if ($row["guid"] != "") … … 339 349 public function GuidToCharName ($guid) 340 350 { 341 $this -> db -> select_db("realm1_characters"); 351 include("inc/db.php"); 352 $this -> db -> select_db($db_characters); 342 353 $row = $this -> db -> query("SELECT `name` FROM `characters` WHERE `guid` = '".$guid."' LIMIT 1;") -> fetch_array(); 343 354 if ($row["name"] != "") … … 354 365 public function AccNameToGuid ($name) 355 366 { 356 $this -> db -> select_db("realm1_realmd"); 367 include("inc/db.php"); 368 $this -> db -> select_db($db_realmd); 357 369 $row = $this -> db -> query("SELECT `id` FROM `account` WHERE `username` LIKE '".$name."' LIMIT 1;") -> fetch_array(); 358 370 return $row["id"]; … … 369 381 public function MoveChar($acc1_name,$acc1_pass,$acc2_name,$char_name) 370 382 { 371 $this -> db -> select_db("realm1_realmd"); 383 include("inc/db.php"); 384 $this -> db -> select_db($db_realmd); 372 385 $sha_pass = sha1(strtoupper($acc1_name).":".strtoupper($acc1_pass)); 373 386 $sql = $this -> db -> query("SELECT `id` FROM `account` WHERE `account`.`username`='".$acc1_name."' AND `account`.`sha_pass_hash`='".$sha_pass."'"); … … 409 422 public function CharsOnAcc ($accid) 410 423 { 424 include("inc/db.php"); 411 425 echo " 412 426 <table> … … 419 433 </tr> 420 434 "; 421 $this -> db -> select_db( "realm1_characters");435 $this -> db -> select_db($db_characters); 422 436 $sql = $this -> db -> query("SELECT `guid`,`name`,`race`,`totaltime`,`class`,mid(lpad( hex( CAST(substring_index(substring_index(data,' ',37),' ',-1) as unsigned) ),8,'0'),4,1) AS gender FROM `characters` WHERE `characters`.`account`='".$accid."' ORDER BY `totaltime` DESC LIMIT 0,10;"); 423 437 while ($row = $sql -> fetch_array()) … … 440 454 public function SignatureOn ($guid) 441 455 { 442 $this -> db -> select_db( "wow_web");456 $this -> db -> select_db($db_webu); 443 457 } 444 458 // lol -
beta/inc/server.php
r405 r427 48 48 public function MangosOnline() 49 49 { 50 $this -> db -> select_db("realm1_characters"); 50 include("inc/db.php"); 51 $this -> db -> select_db($db_characters); 51 52 $pocet = $this -> db -> query("SELECT `guid` FROM `characters` WHERE `online` = '1'") -> num_rows; 52 53 return $pocet; … … 78 79 public function ServerUptime () 79 80 { 80 $this -> db -> select_db("realm1_mangos"); 81 include("inc/db.php"); 82 $this -> db -> select_db($db_mangos); 81 83 $row = $this -> db -> query('SELECT `starttime`, `uptime` FROM `uptime` ORDER BY `starttime` DESC LIMIT 1') ->fetch_array(); 82 84 $uptime = round($row["uptime"] / 3600); … … 86 88 public function CharacterCount() 87 89 { 88 $this -> db -> select_db("realm1_characters"); 90 include("inc/db.php"); 91 $this -> db -> select_db($db_characters); 89 92 $row = $this -> db -> query("SELECT COUNT(*) FROM characters") -> fetch_array(); 90 93 return($row[0]); … … 93 96 public function AccountCount() 94 97 { 95 $this -> db -> select_db("realm1_realmd"); 98 include("inc/db.php"); 99 $this -> db -> select_db($db_realmd); 96 100 $row = $this -> db -> query("SELECT COUNT(*) FROM account") -> fetch_array(); 97 101 return($row[0]); … … 100 104 public function GuidToCharName ($guid) 101 105 { 102 $this -> db -> select_db("realm1_characters"); 106 include("inc/db.php"); 107 $this -> db -> select_db($db_characters); 103 108 $row = $this -> db -> query("SELECT `name` FROM `characters` WHERE `guid` = '".$guid."' LIMIT 1;") -> fetch_array(); 104 109 return $row["name"];
Note:
See TracChangeset
for help on using the changeset viewer.