Changeset 427 for beta/inc


Ignore:
Timestamp:
Feb 10, 2009, 4:45:05 PM (16 years ago)
Author:
amun
Message:

Funkce pracující s MySQL napojeny na globalni config db.php

Location:
beta/inc
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • beta/inc/player.php

    r405 r427  
    11<?php
     2
    23class Player {
    34  var $SessionTimeout = 30;
     
    2223      // -- err
    2324      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);
    2627        $find = $this -> db -> query("SELECT `id` FROM `account` WHERE `username` = '".$acc_name."';");
    2728        if ($find -> num_rows == 0)
     
    4546      public function Login ($username,$pass)
    4647      {
    47         $this -> db -> select_db("realm1_realmd");
     48          include("inc/db.php");
     49        $this -> db -> select_db($db_realmd);
    4850        $sha_pass = sha1(strtoupper($username).":".strtoupper($pass));
    4951        $sql = $this -> db -> query("SELECT `id` FROM `account` WHERE `account`.`username`='".$username."' AND `account`.`sha_pass_hash`='".$sha_pass."'");
     
    107109      public function GetPlayerLvl ($guid)
    108110      {
     111          include("inc/db.php");
    109112        // $this -> NumCheck($guid);
    110         $this -> db -> select_db("realm1_characters");
     113        $this -> db -> select_db($db_characters);
    111114        $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();
    112115        return $row["level"];
     
    115118      public function GetGmLvl ()
    116119      {
     120           include("inc/db.php");
    117121        // $this -> NumCheck($guid);
    118         $this -> db -> select_db("realm1_realmd");
     122        $this -> db -> select_db($db_realmd);
    119123        $row = $this -> db -> query("SELECT `gmlevel` FROM `account` WHERE `id` = '".$_SESSION["UserId"]."' LIMIT 1;") -> fetch_array();
    120124        return $row["gmlevel"];
     
    205209          if (!$this -> IsOnline($guid))
    206210          {
    207             $this -> db -> select_db("realm1_characters");
     211                   include("inc/db.php");
     212            $this -> db -> select_db($db_characters);
    208213            $row = $this -> db -> query("SELECT `data` FROM `characters` WHERE `guid` = '".$guid."' LIMIT 1;") -> fetch_array();
    209214            $data = explode(" ",$row["data"]);
     
    225230          if (!$this -> IsOnline($guid))
    226231          {
    227             $this -> db -> select_db("realm1_characters");
     232                   include("inc/db.php");
     233            $this -> db -> select_db($db_characters);
    228234            $row = $this -> db -> query("SELECT * FROM `character_homebind` WHERE `guid` = '".$guid."' LIMIT 1;") -> fetch_array();
    229235            $home_char_map         = $row["map"];
     
    272278          if (!$this -> IsOnline($guid))
    273279          {
    274             $this -> db -> select_db("realm1_characters");
     280                   include("inc/db.php");
     281            $this -> db -> select_db($db_characters);
    275282              $this -> db -> query("UPDATE `characters` SET
    276283              `map` = '35' ,
     
    295302      public function IsOnline ($guid)
    296303      {
    297         $this -> db -> select_db("realm1_characters");
     304           include("inc/db.php");
     305        $this -> db -> select_db($db_characters);
    298306        $row = $this -> db -> query("SELECT `online` FROM `characters` WHERE `guid` = '".$guid."' LIMIT 1;") -> fetch_array();
    299307        if ($row["online"] == 1)
     
    307315        if ($this -> Check())
    308316        {
     317                 include("inc/db.php");
    309318          if ($acc == 0)
    310319          {$acc = $_SESSION["UserId"];}
    311           $this -> db -> select_db("realm1_characters");
     320          $this -> db -> select_db($db_characters);
    312321          if ($this -> db -> query("SELECT `guid` FROM `characters` WHERE `characters`.`guid`='".$char."' AND `characters`.`account`='".$acc."' LIMIT 1;") -> num_rows == 1)
    313322          {return true;}
     
    324333      public function CharNameToGuid ($name)
    325334      {
    326         $this -> db -> select_db("realm1_characters");
     335           include("inc/db.php");
     336        $this -> db -> select_db($db_characters);
    327337        $row = $this -> db -> query("SELECT `guid` FROM `characters` WHERE `name` LIKE '".$name."' LIMIT 1;") -> fetch_array();
    328338        if ($row["guid"] != "")
     
    339349      public function GuidToCharName ($guid)
    340350      {
    341         $this -> db -> select_db("realm1_characters");
     351           include("inc/db.php");
     352        $this -> db -> select_db($db_characters);
    342353        $row = $this -> db -> query("SELECT `name` FROM `characters` WHERE `guid` = '".$guid."' LIMIT 1;") -> fetch_array();
    343354        if ($row["name"] != "")
     
    354365      public function AccNameToGuid ($name)
    355366      {
    356         $this -> db -> select_db("realm1_realmd");
     367           include("inc/db.php");
     368        $this -> db -> select_db($db_realmd);
    357369        $row = $this -> db -> query("SELECT `id` FROM `account` WHERE `username` LIKE '".$name."' LIMIT 1;") -> fetch_array();
    358370        return $row["id"];
     
    369381      public function MoveChar($acc1_name,$acc1_pass,$acc2_name,$char_name)
    370382      {
    371         $this -> db -> select_db("realm1_realmd");
     383           include("inc/db.php");
     384        $this -> db -> select_db($db_realmd);
    372385        $sha_pass = sha1(strtoupper($acc1_name).":".strtoupper($acc1_pass));
    373386        $sql = $this -> db -> query("SELECT `id` FROM `account` WHERE `account`.`username`='".$acc1_name."' AND `account`.`sha_pass_hash`='".$sha_pass."'");
     
    409422      public function CharsOnAcc ($accid)
    410423      {
     424           include("inc/db.php");
    411425        echo "
    412426        <table>
     
    419433          </tr>
    420434        ";
    421         $this -> db -> select_db("realm1_characters");
     435        $this -> db -> select_db($db_characters);
    422436        $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;");
    423437        while ($row = $sql -> fetch_array())
     
    440454      public function SignatureOn ($guid)
    441455      {
    442       $this -> db -> select_db("wow_web");
     456      $this -> db -> select_db($db_webu);
    443457      }
    444458      // lol
  • beta/inc/server.php

    r405 r427  
    4848      public function MangosOnline()
    4949      {
    50         $this -> db -> select_db("realm1_characters");
     50           include("inc/db.php");
     51        $this -> db -> select_db($db_characters);
    5152        $pocet = $this -> db -> query("SELECT `guid` FROM `characters` WHERE `online` = '1'") -> num_rows;
    5253        return $pocet;
     
    7879      public function ServerUptime ()
    7980      {
    80         $this -> db -> select_db("realm1_mangos");
     81           include("inc/db.php");
     82        $this -> db -> select_db($db_mangos);
    8183        $row = $this -> db -> query('SELECT `starttime`, `uptime` FROM `uptime` ORDER BY `starttime` DESC LIMIT 1') ->fetch_array();
    8284        $uptime = round($row["uptime"] / 3600);
     
    8688      public function CharacterCount()
    8789      {
    88         $this -> db -> select_db("realm1_characters");
     90           include("inc/db.php");
     91        $this -> db -> select_db($db_characters);
    8992        $row = $this -> db -> query("SELECT COUNT(*) FROM characters") -> fetch_array();
    9093        return($row[0]);
     
    9396      public function AccountCount()
    9497      {
    95         $this -> db -> select_db("realm1_realmd");
     98           include("inc/db.php");
     99        $this -> db -> select_db($db_realmd);
    96100        $row = $this -> db -> query("SELECT COUNT(*) FROM account") -> fetch_array();
    97101        return($row[0]);
     
    100104      public function GuidToCharName ($guid)
    101105      {
    102         $this -> db -> select_db("realm1_characters");
     106           include("inc/db.php");
     107        $this -> db -> select_db($db_characters);
    103108        $row = $this -> db -> query("SELECT `name` FROM `characters` WHERE `guid` = '".$guid."' LIMIT 1;") -> fetch_array();
    104109        return $row["name"];
Note: See TracChangeset for help on using the changeset viewer.