Changeset 633 for trunk/inc/realm.php


Ignore:
Timestamp:
Sep 12, 2009, 10:50:39 PM (15 years ago)
Author:
george
Message:
  • Opraveno: Zobrazování seznamu světů při jejich nedostupnosti.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/inc/realm.php

    r630 r633  
    1010    $this->Id = $Id;
    1111    $this->Database = new Database($this->Config['Mangos']['RealmList'][$Id]['DatabaseHost'], $this->Config['Mangos']['RealmList'][$Id]['DatabaseUser'], $this->Config['Mangos']['RealmList'][$Id]['DatabasePassword'], $this->Config['Mangos']['RealmList'][$Id]['DatabaseCharacters']);
    12     if(mysqli_connect_error())
     12    if($this->Database->connect_error)
    1313    {
    14       die('Přihlášení k databázi realmu '.$this->Id.' selhalo'); //: '.mysqli_connect_error());
     14      //die('Přihlášení k databázi realmu '.$this->Id.' selhalo: '.$this->Database->connect_error);
    1515    }
    1616    $this->Database->charset($this->Config['Database']['Charset']);
     
    1919  function OnlineCharactersCount()
    2020  {
    21     $this->Database->select_db($this->Config['Mangos']['RealmList'][$this->Id]['DatabaseCharacters']);   
    22     $DbResult = $this->Database->query('SELECT COUNT(*) FROM `characters` WHERE `online` = 1');
    23     $DbRow = $DbResult->fetch_row();
    24     return($DbRow[0]);
     21    if($this->Database->connect_error) return(0);
     22    else {
     23      $this->Database->select_db($this->Config['Mangos']['RealmList'][$this->Id]['DatabaseCharacters']);   
     24      $DbResult = $this->Database->query('SELECT COUNT(*) FROM `characters` WHERE `online` = 1');
     25      $DbRow = $DbResult->fetch_row();
     26      return($DbRow[0]);
     27    }
    2528  }
    2629
     
    4245  public function CharacterCount()
    4346  {
    44     $this->Database->select_db($this->Config['Mangos']['RealmList'][$this->Id]['DatabaseCharacters']);   
    45     $DbResult = $this->Database->query('SELECT COUNT(*) FROM `characters`');
    46     $DbRow = $DbResult->fetch_row();
    47     return($DbRow[0]);
     47    if($this->Database->connect_error) return('');
     48    else {
     49      $this->Database->select_db($this->Config['Mangos']['RealmList'][$this->Id]['DatabaseCharacters']);   
     50      $DbResult = $this->Database->query('SELECT COUNT(*) FROM `characters`');
     51      $DbRow = $DbResult->fetch_row();
     52      return($DbRow[0]);
     53    }
    4854  }
    4955 
    5056  public function GuidToCharName($guid)
    5157  {
    52     $this->Database->select_db($this->Config['Mangos']['RealmList'][$this->Id]['DatabaseCharacters']);
    53     $row = $this->Database->query('SELECT `name` FROM `characters` WHERE `guid` = "'.$guid.'" LIMIT 1')->fetch_array();
    54     return($row['name']);
     58    if($this->Database->connect_error) return(0);
     59    else {
     60      $this->Database->select_db($this->Config['Mangos']['RealmList'][$this->Id]['DatabaseCharacters']);
     61      $row = $this->Database->query('SELECT `name` FROM `characters` WHERE `guid` = "'.$guid.'" LIMIT 1')->fetch_array();
     62      return($row['name']);
     63    }
    5564  }
    5665 
Note: See TracChangeset for help on using the changeset viewer.