Changeset 609 for trunk/inc/player.php


Ignore:
Timestamp:
Aug 7, 2009, 10:03:50 PM (15 years ago)
Author:
george
Message:
  • Upraveno: Stránky přizpůsobeny pro podporu více světů. Doplněna stránka seznamu světů.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/inc/player.php

    r583 r609  
    77  private $db;
    88 
    9   function __construct ($db)
     9  function __construct($db)
    1010  {
    1111    $this->db = &$db;
     
    1515  {
    1616    if($err == 0) echo('<img src="imgs/inc/on.gif">&nbsp;<font color="#234303" size="4">'.$text.'</font><br />');
    17     else echo('<img src="imgs/inc/off.gif">&nbsp;<font color="#990000" size="4\">'.$text.'</font><br />');
     17      else echo('<img src="imgs/inc/off.gif">&nbsp;<font color="#990000" size="4\">'.$text.'</font><br />');
    1818  }
    1919
     
    4949    if($sql->num_rows == 1)
    5050    {
    51       $row = $sql->fetch_array();
     51      $row = $sql->fetch_assoc();
    5252      $_SESSION['UserId'] = $row['id'];
    5353      $_SESSION['UserName'] = $username;
     
    7373    if(!array_key_exists('Time', $_SESSION)) $_SESSION['Time'] = time();
    7474    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();
    7976    $_SESSION['Time'] = time();
    8077    return($_SESSION['UserId'] != 0);
     
    8380  public function LoginForm()
    8481  {
    85     echo('<form method="post" action="?page=acc">
    86      <table>
    87                 <tr>
    88                   <td><b>Jméno : </b></td><td><input type="text" name="user" class="textinput"></td>
     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>
    8986                </tr>
    9087                <tr>
     
    9794            </form>
    9895            <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>');
    10198   }
    10299
     
    105102    global $Config;
    106103
    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;');
    111106    $row = $DbResult->fetch_assoc();
    112107    return($row['level']);
     
    146141      if(!$this->IsOnline($guid))
    147142      {
    148         $this->db->select_db($Config['Mangos']['DatabaseCharacters']);
     143        $this->db->select_db($Config['Mangos']['RealmList'][$_COOKIE['RealmIndex']]['DatabaseCharacters']);
    149144        $row = $this->db->query('SELECT `data` FROM `characters` WHERE `guid` = "'.$guid.'" LIMIT 1')->fetch_assoc();
    150145        $data = explode(' ', $row['data']);
     
    161156    global $Config;
    162157
    163     $this->db->select_db($Config['Mangos']['DatabaseCharacters']);
     158    $this->db->select_db($Config['Mangos']['RealmList'][$_COOKIE['RealmIndex']]['DatabaseCharacters']);
    164159    if($this->CharInAcc($guid, 0))
    165160    {
     
    189184    global $Config;
    190185
    191     $this->db->select_db($Config['Mangos']['DatabaseCharacters']);
     186    $this->db->select_db($Config['Mangos']['RealmList'][$_COOKIE['RealmIndex']]['DatabaseCharacters']);
    192187    // .go xyz -90.54 41.35 -31.71
    193188    // .go xyz -91.01 100.46 -31.71
     
    230225    global $Config;
    231226
    232     $this->db->select_db($Config['Mangos']['DatabaseCharacters']);
     227    $this->db->select_db($Config['Mangos']['RealmList'][$_COOKIE['RealmIndex']]['DatabaseCharacters']);
    233228    $row = $this->db->query('SELECT `online` FROM `characters` WHERE `guid` = "'.$guid.'" LIMIT 1;')->fetch_assoc();
    234229    if($row['online'] == 1) return(true);
    235     else return(false);
     230      else return(false);
    236231  }
    237232
     
    246241        $acc = $_SESSION['UserId'];
    247242      }
    248       $this->db->select_db($Config['Mangos']['DatabaseCharacters']);
     243      $this->db->select_db($Config['Mangos']['RealmList'][$_COOKIE['RealmIndex']]['DatabaseCharacters']);
    249244      if($this->db->query('SELECT `guid` FROM `characters` WHERE `characters`.`guid`="'.$char.'" AND `account`="'.$acc.'" LIMIT 1;')->num_rows == 1)
    250245      {
     
    265260    global $Config;
    266261
    267     $this->db->select_db($Config['Mangos']['DatabaseCharacters']);
     262    $this->db->select_db($Config['Mangos']['RealmList'][$_COOKIE['RealmIndex']]['DatabaseCharacters']);
    268263    $row = $this->db->query('SELECT `guid` FROM `characters` WHERE `name` LIKE "'.$name.'" LIMIT 1;')->fetch_assoc();
    269264    if($row['guid'] != '')
     
    280275    global $Config;
    281276
    282     $this->db->select_db($Config['Mangos']['DatabaseCharacters']);
     277    $this->db->select_db($Config['Mangos']['RealmList'][$_COOKIE['RealmIndex']]['DatabaseCharacters']);
    283278    $row = $this->db->query('SELECT `name` FROM `characters` WHERE `guid` = "'.$guid.'" LIMIT 1;')->fetch_assoc();
    284279    if($row['name'] != '')
     
    359354            <th>Nahráno</th>
    360355          </tr>');
    361     $this->db->select_db($Config['Mangos']['DatabaseCharacters']);
     356    $this->db->select_db($Config['Mangos']['RealmList'][$_COOKIE['RealmIndex']]['DatabaseCharacters']);
    362357    echo($this->db->error);
    363358    $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');
Note: See TracChangeset for help on using the changeset viewer.