Changeset 576


Ignore:
Timestamp:
Apr 29, 2009, 8:02:38 PM (15 years ago)
Author:
george
Message:
  • Opraveno: Kód a styl stránky registrace účtů.
  • Opraveno: Třídat player byla pročištěna a opravena pro kompatibilitu s konfiguračním souborem config.php a nastavením názvů databází.
Location:
trunk
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/inc/config.sample.php

    r556 r576  
    2727    'DatabaseScriptDev2' => 'scriptdev2',
    2828    'GMCommandsLog' => 'gm_commands.log',
     29    'MaxAccountCount' => 13000,
    2930  ),
    3031  'Web' => array
  • trunk/inc/html.php

    r555 r576  
    66  private $db;
    77
    8   public function __construct($values,$db)
     8  public function __construct($values, $db)
    99  {
    1010    $this->db = &$db;
     
    104104    $anti_ref = array
    105105    (
    106       "server" => 5,
    107       "events" => 2,
    108       "aukce" => 2,
    109       "gmlog" => 300,
    110       "online" => 2,
     106      'server' => 5,
     107      'events' => 2,
     108      'aukce' => 2,
     109      'gmlog' => 300,
     110      'online' => 2,
    111111    );
    112     $site_show = "./".$dir_pages."/".$get.".php";
     112    $site_show = $dir_pages.'/'.$get.'.php';
    113113    if(isset($anti_ref[$get]))
    114114    {
     
    120120      {
    121121        $this->RefreshMsg($this -> Antirefresh($anti_ref[$get], $get), $get);
    122         return("./".$dir_pages."/free.php");
    123       }
    124     } else
    125     {
    126       if($site_show != "" AND is_readable($site_show)) return($site_show);
    127         else return("./".$dir_pages."/".$def.".php");
     122        return($dir_pages.'/free.php');
     123      }
     124    } else
     125    {
     126      if($site_show != '' AND is_readable($site_show)) return($site_show);
     127        else return($dir_pages.'/'.$def.'.php');
    128128    }
    129129  }
     
    132132  {
    133133    $hash = md5($page);
    134     if(isset($_SESSION["rf".$hash."rsh"]))
    135     {
    136       $refresh = $_SESSION["rf".$hash."rsh"] + $value;
     134    if(isset($_SESSION['rf'.$hash.'rsh']))
     135    {
     136      $refresh = $_SESSION['rf'.$hash.'rsh'] + $value;
    137137      if(time() < $refresh)
    138138      {
     
    141141      }
    142142    }
    143     $_SESSION["rf".$hash."rsh"] = time();
     143    $_SESSION['rf'.$hash.'rsh'] = time();
    144144  }
    145145
     
    150150      if($dif > 60)
    151151      {
    152         $dif = round($dif / 60)." min";
     152        $dif = round($dif / 60).' min';
    153153        $refresh = 30;
    154154      } else
    155155      {
    156         $dif = $dif." s";
     156        $dif = $dif.' s';
    157157        $refresh = 2;
    158158      }
    159       echo("<center><h3>Refresh omezení</h3></center>
     159      echo('<center><h3>Refresh omezení</h3></center>
    160160          Stránka nepovoluje tak krátký čas pro refresh (znovunačtení).<br />
    161           Další načtení stránky <b>?page=".$get."</b> bude možné za <b>".$dif."</b>.<br />
     161          Další načtení stránky <b>?page='.$get.'</b> bude možné za <b>'.$dif.'</b>.<br />
    162162          Pokud tento čas vyčkáte budete přesměrován automaticky !
    163          <meta http-equiv=\"refresh\" content=\"".$refresh.";url=\">");
     163         <meta http-equiv="refresh" content="'.$refresh.';url=">');
    164164    }
    165165  }
     
    167167  public function PrgStart()
    168168  {
    169     echo("<table align=\"center\" width=\"346\" height=\"417\" border=\"0\" style=\"background-image: url(imgs/web/prg.gif);\">
    170           <tr height=\"80\">
    171             <td width=\"20\"></td>
    172             <td align=\"center\">
     169    echo('<table align="center" width="346" height="417" border="0" style="background-image: url(imgs/web/prg.gif);">
     170          <tr height="80">
     171            <td width="20"></td>
     172            <td align="center">
    173173            <h3>Správa účtu</h3>
    174174            </td>
    175             <td width=\"20\"></td>
     175            <td width="20"></td>
    176176          </tr>
    177177          <tr>
    178             <td width=\"20\"></td>
    179             <td align=\"center\" valign=\"top\">"); 
     178            <td width="20"></td>
     179            <td align="center" valign="top">'); 
    180180  }
    181181
    182182  public function PrgStop()
    183183  {
    184     echo("</td>
    185         <td width=\"20\"></td>
     184    echo('</td>
     185        <td width="20"></td>
    186186      </tr>
    187       <tr height=\"30\">
    188         <td width=\"20\"></td>
     187      <tr height="30">
     188        <td width="20"></td>
    189189        <td></td>
    190         <td width=\"20\"></td>
     190        <td width="20"></td>
    191191      </tr>
    192       </table>");
     192      </table>');
    193193  }
    194194
    195195  public function ShowNews($kategorie)
    196196  {
    197           include("inc/db.php");
     197          include('inc/db.php');
    198198                global $db_webu;
    199199               
     
    286286  function QuickNew()
    287287  {
    288     global $server;
    289 
    290     if(isset($_COOKIE["hof-quick"]) AND $_COOKIE["hof-quick"] == "no")
     288    global $server, $Config;
     289
     290    if(isset($_COOKIE['hof-quick']) AND $_COOKIE['hof-quick'] == 'no')
    291291    {
    292292    } else
     
    299299        '<tr>'.
    300300        '<td colspan="2">'.
    301         '<strong>Server : </strong>'.$server->ServerImg($server->ServerOnline('wow.zdechov.net', 8085)).'<b> (<a href="?page=online">'.$server->MangosOnline().' hráčů</a>) | Patch 3.0.9 | <a href="http://wow.zdechov.net/pages/realmlist.wtf">Realmlist</a> | Více info <a href="?page=server">zde</a></b>'.
     301        '<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>'.
    302302        '</td></tr></table><br />');
    303303    }
  • trunk/inc/player.php

    r510 r576  
    11<?php
    22
    3 class Player {
     3class Player
     4{
    45  var $SessionTimeout = 30;
     6 
    57  private $db;
    6       // -- done
    7       function __construct ($db)
    8       {
    9         $this -> db = &$db;
    10       }
    11       // -- done
    12       private function Msg($text,$err)
    13       {
    14         if ($err == 0)
    15         {
    16           echo "<img src=\"imgs/inc/on.gif\">&nbsp;<font color=\"#234303\" size=\"4\">".$text."</font><br />";
    17         }
    18         else
    19         {
    20           echo "<img src=\"imgs/inc/off.gif\">&nbsp;<font color=\"#990000\" size=\"4\">".$text."</font><br />";
    21         }
    22       }
    23       // -- err
    24       public function Register ($acc_name , $pass , $email , $tbc)
    25       { include("inc/db.php");
    26         $this -> db -> select_db($db_realmd);
    27         $find = $this -> db -> query("SELECT `id` FROM `account` WHERE `username` = '".$acc_name."';");
    28         if ($find -> num_rows == 0)
    29         {
    30           $sha_pass = sha1(strtoupper($acc_name).":".strtoupper($pass));
    31           $sql = $this -> db -> query("
    32           INSERT INTO `account` ( `id` , `username` , `sha_pass_hash` , `gmlevel` , `sessionkey` , `v` , `s` , `email` , `joindate` , `last_ip` , `failed_logins` , `locked` , `last_login` , `online` , `tbc` , `mutetime` , `locale` )
    33           VALUES (NULL , '".$acc_name."', '".$sha_pass."', '0', NULL , NULL , NULL , '".$email."',CURRENT_TIMESTAMP , '".$_SERVER['REMOTE_ADDR']."', '0', '0', '0000-00-00 00:00:00', '0', '".$tbc."', '0', '0');
    34           ");
    35           $this -> Msg ("Účet založen úspěšně",0);
    36           echo "<meta http-equiv=\"refresh\" content=\"0;?page=acc\">";
    37         }
    38         else
    39         {
    40           $this -> Msg ("Zadané jmnéno účtu již existuje",1);
    41           $this -> Recall(3);
    42         }
    43      
    44       }
    45       // -- done
    46       public function Login ($username,$pass)
    47       {
    48           include("inc/db.php");
    49         $this -> db -> select_db($db_realmd);
    50         $sha_pass = sha1(strtoupper($username).":".strtoupper($pass));
    51         $sql = $this -> db -> query("SELECT `id` FROM `account` WHERE `account`.`username`='".$username."' AND `account`.`sha_pass_hash`='".$sha_pass."'");
    52         if ($sql -> num_rows == 1)
    53         {
    54           $row = $sql -> fetch_array();
    55           $_SESSION["UserId"] = $row["id"];
    56           $_SESSION["UserName"] = $username;
    57           $this -> Msg ("Přihlášení úspěšné",0);
    58           $this -> Recall(1);
    59         }
    60         else
    61         {
    62           $this -> Msg ("Přihlášení neúspěšné",1);
    63           $this -> Recall(3);
    64         }
    65       }
    66       // -- done
    67       public function Logout ()
    68       {
    69         $_SESSION["UserId"] = 0;
    70         $_SESSION["UserName"] = "";
    71         $this -> Msg ("Odhlášení úspěšné",0);
    72         $this -> Recall(1);
    73       }
    74       // -- done
    75       public function Check ()
    76       {
    77         if(!array_key_exists("Time", $_SESSION)) $_SESSION['Time'] = time();
    78         if(!array_key_exists("UserId", $_SESSION)) $_SESSION['UserId'] = 0;
    79         if($_SESSION["Time"] < (time() - 60 * $this -> SessionTimeout))
    80         {
    81           $this -> Logout();
    82         }
    83         $_SESSION["Time"] = time();
    84         return($_SESSION["UserId"] != 0);
    85       }
    86       // -- done
    87       public function LoginForm()
    88       {
    89           echo "
    90             <form method=\"post\" action=\"?page=acc\">
    91               <table>
     8 
     9  function __construct ($db)
     10  {
     11    $this->db = &$db;
     12  }
     13
     14  private function Msg($text, $err)
     15  {
     16    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 />');
     18  }
     19
     20  public function Register($acc_name, $pass, $email, $tbc)
     21  {
     22    global $Config;
     23
     24    $this->db->select_db($Config['Mangos']['DatabaseRealmd']);
     25
     26    $find = $this->db->query('SELECT `id` FROM `account` WHERE `username` = "'.$acc_name.'"');
     27    if($find->num_rows == 0)
     28    {
     29      $sha_pass = sha1(strtoupper($acc_name).':'.strtoupper($pass));
     30      $sql = $this->db->query('INSERT INTO `account` ( `id` , `username` , `sha_pass_hash` , `gmlevel` , `sessionkey` , `v` , `s` , `email` , `joindate` , `last_ip` , `failed_logins` , `locked` , `last_login` , `online` , `tbc` , `mutetime` , `locale` ) '.
     31        ' VALUES (NULL , "'.$acc_name.'", "'.$sha_pass.'", 0, NULL , NULL , NULL , "'.$email.'", CURRENT_TIMESTAMP , "'.$_SERVER['REMOTE_ADDR'].'", 0, 0, "0000-00-00 00:00:00", 0, "'.$tbc.'", 0, 0)');
     32      $this->Msg('Účet založen úspěšně', 0);
     33      echo('<meta http-equiv="refresh" content="0;?page=acc">');
     34    } else
     35    {
     36      $this->Msg('Zadané jmnéno účtu již existuje', 1);
     37      $this->Recall(3);
     38    }     
     39  }
     40
     41  public function Login($username, $pass)
     42  {
     43    global $Config;
     44
     45    $this->db->select_db($Config['Mangos']['DatabaseRealmd']);
     46   
     47    $sha_pass = sha1(strtoupper($username).':'.strtoupper($pass));
     48    $sql = $this->db->query('SELECT `id` FROM `account` WHERE `username`="'.$username.'" AND `sha_pass_hash`="'.$sha_pass.'"');
     49    if($sql->num_rows == 1)
     50    {
     51      $row = $sql->fetch_array();
     52      $_SESSION['UserId'] = $row['id'];
     53      $_SESSION['UserName'] = $username;
     54      $this->Msg('Přihlášení úspěšné', 0);
     55      $this->Recall(1);
     56    } else
     57    {
     58      $this->Msg('Přihlášení neúspěšné', 1);
     59      $this->Recall(3);
     60    }
     61  }
     62
     63  public function Logout()
     64  {
     65    $_SESSION['UserId'] = 0;
     66    $_SESSION['UserName'] = '';
     67    $this->Msg('Odhlášení úspěšné', 0);
     68    $this->Recall(1);
     69  }
     70
     71  public function Check()
     72  {
     73    if(!array_key_exists('Time', $_SESSION)) $_SESSION['Time'] = time();
     74    if(!array_key_exists('UserId', $_SESSION)) $_SESSION['UserId'] = 0;
     75    if($_SESSION['Time'] < (time() - 60 * $this->SessionTimeout))
     76    {
     77      $this->Logout();
     78    }
     79    $_SESSION['Time'] = time();
     80    return($_SESSION['UserId'] != 0);
     81  }
     82
     83  public function LoginForm()
     84  {
     85    echo('<form method="post" action="?page=acc">
     86     <table>
    9287                <tr>
    93                   <td><b>Jméno : </b></td><td><input type=\"text\" name=\"user\"></td>
     88                  <td><b>Jméno : </b></td><td><input type="text" name="user"></td>
    9489                </tr>
    9590                <tr>
    96                   <td><b>Heslo : </b></td><td><input type=\"password\" name=\"pass\" autocomplete=\"off\"></td>
     91                  <td><b>Heslo : </b></td><td><input type="password" name="pass" autocomplete="off"></td>
    9792                </tr>
    9893                <tr>
    99                   <td colspan=\"2\" align=\"right\"><input type=\"submit\" value=\"Příhlásit\" name=\"login\"></td>
     94                  <td colspan="2" align="right"><input type="submit" value="Příhlásit" name="login"></td>
    10095                </tr>
    10196              </table>
    10297            </form>
    103             <div align=\"left\">
    104             <a href=\"?page=register\">Registrace</a><br /><a href=\"?page=lostpass\">Obnova hesla</a>
    105             </div>
    106           ";
     98            <div align="left">
     99            <a href="?page=register">Registrace</a><br /><a href="?page=lostpass">Obnova hesla</a>
     100            </div>');
     101   }
     102
     103  public function GetPlayerLvl($guid)
     104  {
     105    global $Config;
     106
     107    $this->db->select_db($Config['Mangos']['DatabaseCharacters']);
     108      $DbResult = $this->db->query(
     109      'SELECT CAST(SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, " ", 34), " ", -1)'.
     110      ' AS UNSIGNED) AS `level` FROM `characters` WHERE `guid` = "'.$guid.'" LIMIT 1;');
     111    $row = $DbResult->fetch_assoc();
     112    return($row['level']);
     113  }
     114
     115  public function GetGmLvl()
     116  {
     117    // $this -> NumCheck($guid);
     118    $this->db->select_db($db_realmd);
     119    $row = $this->db->query('SELECT `gmlevel` FROM `account` WHERE `id` = "'.$_SESSION['UserId'].'" LIMIT 1;')->fetch_array();
     120    return($row['gmlevel']);
     121  }
     122
     123  public function GetPlayerClass($Id)
     124  {
     125    $Class = array(1 => 'warrior', 2 => 'paladin', 3 => 'hunter', 4 => 'rogue', 5 => 'priest', 6 => 'death knight', 7 => 'shaman', 8 => 'mage', 9 => 'warlock', 11 => 'druid');
     126    $Result = $Class[$Id];
     127    if($Result == '') $Result = 'unknown';
     128    return($Result);
     129  }
     130   
     131  public function GetPlayerRace($Id)
     132  {
     133    $Race = array(1 => 'human', 2 => 'orc', 4 => 'dwarf', 4 => 'nightelf', 5 => 'undead', 6 => 'tauren', 7 => 'gnome', 8 => 'troll', 9 => 'goblin', 10 => 'bloodelf', 11 => 'draenei');
     134    $Result = $Race[$Id];
     135    if($Result == '') $Result = 'unknown';
     136    return($Result);
     137  }
     138
     139  public function ResetXP($guid)
     140  {
     141    global $Config;
     142
     143    if($this->CharInAcc($guid, 0))
     144    {
     145      if(!$this->IsOnline($guid))
     146      {
     147        $this->db->select_db($Config['Mangos']['DatabaseCharacters']);
     148        $row = $this->db->query('SELECT `data` FROM `characters` WHERE `guid` = "'.$guid.'" LIMIT 1')->fetch_assoc();
     149        $data = explode(' ', $row['data']);
     150        $data[926] = 0;
     151        $data = implode(' ', $data);
     152        $this->db->query('UPDATE `characters` SET `data` = "'.$data.'" WHERE `guid` ="'.$guid.'" LIMIT 1');
     153        $this->Msg('Postavě resetováno XP.', 0);
     154      } else $this->Msg('Postava musí být offline.', 1);
     155    } else $this->Msg('Tato postava není vaše.', 1);
     156  }
     157
     158  public function ResetPosition($guid)
     159  {
     160    global $Config;
     161
     162    $this->db->select_db($Config['Mangos']['DatabaseCharacters']);
     163    if($this->CharInAcc($guid, 0))
     164    {
     165      if(!$this->IsOnline($guid))
     166      {
     167        $row = $this->db->query('SELECT * FROM `character_homebind` WHERE `guid` = "'.$guid.'" LIMIT 1;')->fetch_array();
     168        $home_char_map = $row['map'];
     169        $home_char_position_x = $row['position_x'];
     170        $home_char_position_y = $row['position_y'];
     171        $home_char_position_z = $row['position_z'];
     172        if(isset($home_char_map) and isset($home_char_position_x) and isset($home_char_position_y) and isset($home_char_position_z))
     173        {
     174          $this->db->query('UPDATE `characters` SET '.
     175            '`map` = "'.$home_char_map.'" , '.
     176            '`position_x` ="'.$home_char_position_x.'" , '.
     177            '`position_y` = "'.$home_char_position_y.'" , '.
     178            '`position_z` = "'.$home_char_position_z.'" '.
     179            ' WHERE `guid` ='.$guid.' LIMIT 1;');
     180          $this->Msg('Postava teleportována.', 0);
     181        }
     182      } else $this->Msg('Postava musí být offline.', 1);
     183    } else $this->Msg('Tato postava není vaše.', 1);
     184  }
     185
     186  public function PlayerJail($guid)
     187  {
     188    global $Config;
     189
     190    $this->db->select_db($Config['Mangos']['DatabaseCharacters']);
     191    // .go xyz -90.54 41.35 -31.71
     192    // .go xyz -91.01 100.46 -31.71
     193    // .go xyz -119.16 71.82 -31.71
     194    $defined_positions = array
     195    (
     196      'x1' => '-90.54',
     197      'y1' => '41.35',
     198      'z1' => '-31.71',
     199      'o1' => '1.4623',
     200         
     201      'x2' => '-91.01',
     202      'y2' => '100.46',
     203      'z2' => '-31.71',
     204      'o3' => '4.6282',
     205         
     206      'x3' => '-119.16',
     207      'y3' => '71.82',
     208      'z3' => '-31.71',
     209      'o3' => '6.2116',
     210    );
     211    $rand_place = rand(1, 3);
     212    if(!$this->IsOnline($guid))
     213    {
     214      $this->db->query('UPDATE `characters` SET `map` = 35 ,'.
     215        '`orientation` = "'.$defined_positions['o'.$rand_place].'" ,'.
     216        '`position_x` ="'.$defined_positions['x'.$rand_place].'" ,'.
     217        '`position_y` = "'.$defined_positions['y'.$rand_place].'" ,'.
     218        '`position_z` = "'.$defined_positions['z'.$rand_place].'"'.
     219        ' WHERE `guid` ="'.$guid.'" LIMIT 1;');
     220      $this->db->query('INSERT INTO `character_aura` (`guid`, `caster_guid`, `spell`, `effect_index`, `amount`, `maxduration`, `remaintime`, `remaincharges`) VALUES '.
     221        '('.$guid.', '.$guid.', 23775, 0, 1, -1, -1, -1), '.
     222        '('.$guid.', '.$guid.', 36558, 0, 1, -1, -1, -1);');               
     223      $this->Msg('Postava ve vězení.', 0);         
     224    } else $this->Msg('Postava musí být offline.', 1);
     225  }
     226
     227  public function IsOnline($guid)
     228  {
     229    global $Config;
     230
     231    $this->db->select_db($Config['Mangos']['DatabaseCharacters']);
     232    $row = $this->db->query('SELECT `online` FROM `characters` WHERE `guid` = "'.$guid.'" LIMIT 1;')->fetch_assoc();
     233    if($row['online'] == 1) return(true);
     234    else return(false);
     235  }
     236
     237  public function CharInAcc($char, $acc)
     238  {
     239    global $Config;
     240   
     241    if($this->Check())
     242    {
     243      if($acc == 0)
     244      {
     245        $acc = $_SESSION['UserId'];
    107246      }
    108       // --
    109       public function GetPlayerLvl ($guid)
    110       {
    111           include("inc/db.php");
    112         // $this -> NumCheck($guid);
    113         $this -> db -> select_db($db_characters);
    114         $row = $this -> db -> query("SELECT CAST(SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', 34), ' ', -1) AS UNSIGNED) AS `level` FROM `characters` WHERE `guid` = '".$guid."' LIMIT 1;") -> fetch_array();
    115         return $row["level"];
     247      $this->db->select_db($Config['Mangos']['DatabaseCharacters']);
     248      if($this->db->query('SELECT `guid` FROM `characters` WHERE `characters`.`guid`="'.$char.'" AND `account`="'.$acc.'" LIMIT 1;')->num_rows == 1)
     249      {
     250        return(true);
     251      } else
     252      {
     253        return false;
    116254      }
    117       // -- done
    118       public function GetGmLvl ()
    119       {
    120            include("inc/db.php");
    121         // $this -> NumCheck($guid);
    122         $this -> db -> select_db($db_realmd);
    123         $row = $this -> db -> query("SELECT `gmlevel` FROM `account` WHERE `id` = '".$_SESSION["UserId"]."' LIMIT 1;") -> fetch_array();
    124         return $row["gmlevel"];
     255    } else
     256    {
     257      $this->Msg('Nejste přihlášen', 1);
     258      die;
     259    }
     260  }
     261
     262  public function CharNameToGuid($name)
     263  {
     264    global $Config;
     265
     266    $this->db->select_db($Config['Mangos']['DatabaseCharacters']);
     267    $row = $this->db->query('SELECT `guid` FROM `characters` WHERE `name` LIKE "'.$name.'" LIMIT 1;')->fetch_assoc();
     268    if($row['guid'] != '')
     269    {
     270      return($row['guid']);
     271    } else
     272    {
     273      return('Nenalezen');
     274    }
     275  }
     276
     277  public function GuidToCharName($guid)
     278  {
     279    global $Config;
     280
     281    $this->db->select_db($Config['Mangos']['DatabaseCharacters']);
     282    $row = $this->db->query('SELECT `name` FROM `characters` WHERE `guid` = "'.$guid.'" LIMIT 1;')->fetch_assoc();
     283    if($row['name'] != '')
     284    {
     285      return($row['name']);
     286    } else
     287    {
     288      return('Nenalezen');
     289    }     
     290  }
     291
     292  public function AccNameToGuid($name)
     293  {
     294    global $Config;
     295
     296    $this->db->select_db($Config['Mangos']['DatabaseRealmd']);
     297    $row = $this->db->query('SELECT `id` FROM `account` WHERE `username` LIKE "'.$name.'" LIMIT 1;')->fetch_assoc();
     298    //return($row['id']);
     299    if($row['id'] != '')
     300    {
     301      return($row['id']);
     302    } else
     303    {
     304      return('Nenalezen');
     305    }
     306  }
     307
     308  public function MoveChar($acc1_name, $acc1_pass, $acc2_name, $char_name)
     309  {
     310    global $Config;
     311
     312    $this->db->select_db($Config['Mangos']['DatabaseRealmd']);
     313    $sha_pass = sha1(strtoupper($acc1_name).':'.strtoupper($acc1_pass));
     314    $sql = $this->db->query('SELECT `id` FROM `account` WHERE `username`="'.$acc1_name.'" AND `sha_pass_hash`="'.$sha_pass.'"');
     315    if($sql->num_rows == 1)
     316    {
     317      $acc1_guid = $this->AccNameToGuid($acc1_name);
     318      $acc2_guid = $this->AccNameToGuid($acc2_name);
     319      $char_guid = $this->CharNameToGuid($char_name);
     320      if($this->CharInAcc($char_guid, $acc1_guid))
     321      {
     322        $this->db->query('UPDATE `characters` SET `account` = "'.$acc2_guid.'" WHERE `guid` ="'.$char_guid.'" LIMIT 1');
     323        $this->Msg('Postava přemístěna.', 0);
     324      } else
     325      {
     326        $this->Msg('Tato postava není vaše.', 1);
    125327      }
    126       // -- done
    127       public function GetPlayerClass($id)
    128       {
    129         switch ($id)
    130         {
    131         case 1:
    132            return("warrior");
    133            break;
    134         case 2:
    135            return("paladin");
    136            break;
    137         case 3:
    138            return("hunter");
    139            break;
    140         case 4:
    141            return("rogue");
    142            break;
    143         case 5:
    144            return("priest");
    145            break;
    146         case 7:
    147            return("shaman");
    148            break;
    149         case 8:
    150            return("mage");
    151            break;
    152         case 9:
    153            return("warlock");
    154            break;
    155         case 11:
    156            return("druid");
    157            break;
    158         default:
    159             return("unknown");
    160         }
     328    }
     329  }
     330
     331  public function Recall($time)
     332  {
     333    global $Config;
     334     
     335    if(isset($_SERVER['HTTP_REFERER']))
     336    {
     337      $link = parse_url($_SERVER['HTTP_REFERER']);
     338      if(($link['host'] == $Config['Web']['WoWServerAddr']) or ($link['host'] == 'localhost'))
     339      {
     340        echo('<meta http-equiv="refresh" content="'.$time.';?'.$link['query'].'">');
     341      } else
     342      {
     343        echo('<meta http-equiv="refresh" content="'.$time.';">');
    161344      }
    162       // -- done
    163       public function GetPlayerRace($id)
    164       {
    165         switch ($id)
    166         {
    167         case 1:
    168            return("human");
    169            break;
    170         case 2:
    171            return("orc");
    172            break;
    173         case 3:
    174            return("dwarf");
    175            break;
    176         case 4:
    177            return("nightelf");
    178            break;
    179         case 5:
    180            return("undead");
    181            break;
    182         case 6:
    183            return("tauren");
    184            break;
    185         case 7:
    186            return("gnome");
    187            break;
    188         case 8:
    189            return("troll");
    190            break;
    191         case 9:
    192            return("goblin");
    193            break;
    194         case 10:
    195            return("bloodelf");
    196            break;
    197         case 11:
    198            return("draenei");
    199            break;
    200         default:
    201             return("unknown");
    202         }
    203       }
    204       // -- done
    205       public function ResetXP ($guid)
    206       {
    207         if ($this -> CharInAcc($guid,0))
    208         {
    209           if (!$this -> IsOnline($guid))
    210           {
    211                    include("inc/db.php");
    212             $this -> db -> select_db($db_characters);
    213             $row = $this -> db -> query("SELECT `data` FROM `characters` WHERE `guid` = '".$guid."' LIMIT 1;") -> fetch_array();
    214             $data = explode(" ",$row["data"]);
    215             $data[926] = 0;
    216             $this -> db -> query("UPDATE `characters` SET  `data` = '".implode(" ",$data)."' WHERE `guid` ='".$guid."' LIMIT 1");
    217             $this -> Msg ("Postavě resetováno XP.",0);
    218           }
    219           else
    220           {$this -> Msg ("Postava musí být offline.",1);}
    221         }
    222         else
    223         {$this -> Msg ("Tato postava není vaše.",1);}
    224       }
    225       // -- done
    226       public function ResetPosition ($guid)
    227       {
    228         if ($this -> CharInAcc($guid,0))
    229         {
    230           if (!$this -> IsOnline($guid))
    231           {
    232                    include("inc/db.php");
    233             $this -> db -> select_db($db_characters);
    234             $row = $this -> db -> query("SELECT * FROM `character_homebind` WHERE `guid` = '".$guid."' LIMIT 1;") -> fetch_array();
    235             $home_char_map         = $row["map"];
    236             $home_char_position_x  = $row["position_x"];
    237             $home_char_position_y  = $row["position_y"];
    238             $home_char_position_z  = $row["position_z"];
    239             if (isset($home_char_map) AND isset ($home_char_position_x) AND isset ($home_char_position_y) AND isset ($home_char_position_z))
    240             {
    241               $this -> db -> query("UPDATE `characters` SET
    242               `map` = '".$home_char_map."' ,
    243               `position_x` ='".$home_char_position_x."' ,
    244               `position_y` = '".$home_char_position_y."' ,
    245               `position_z` = '".$home_char_position_z."'
    246                WHERE `guid` ='".$guid."' LIMIT 1;");
    247                $this -> Msg ("Postava teleportována.",0);
    248             }
    249           }
    250           else
    251           {$this -> Msg ("Postava musí být offline.",1);}
    252         }
    253         else
    254         {$this -> Msg ("Tato postava není vaše.",1);}
    255       }
    256       public function PlayerJail ($guid)
    257       {
    258           // .go xyz -90.54 41.35 -31.71
    259           // .go xyz -91.01 100.46 -31.71
    260           // .go xyz -119.16 71.82 -31.71
    261           $defined_positions = array (
    262           "x1" => "-90.54",
    263           "y1" => "41.35",
    264           "z1" => "-31.71",
    265           "o1" => "1.4623",
    266          
    267           "x2" => "-91.01",
    268           "y2" => "100.46",
    269           "z2" => "-31.71",
    270           "o3" => "4.6282",
    271          
    272           "x3" => "-119.16",
    273           "y3" => "71.82",
    274           "z3" => "-31.71",
    275           "o3" => "6.2116",
    276           );
    277           $rand_place = rand (1,3);
    278           if (!$this -> IsOnline($guid))
    279           {
    280                    include("inc/db.php");
    281             $this -> db -> select_db($db_characters);
    282               $this -> db -> query("UPDATE `characters` SET
    283               `map` = '35' ,
    284               `orientation` = '".$defined_positions["o".$rand_place]."' ,
    285               `position_x` ='".$defined_positions["x".$rand_place]."' ,
    286               `position_y` = '".$defined_positions["y".$rand_place]."' ,
    287               `position_z` = '".$defined_positions["z".$rand_place]."'
    288                WHERE `guid` ='".$guid."' LIMIT 1;");
    289               $this -> db -> query("INSERT INTO `character_aura` (`guid`, `caster_guid`, `spell`, `effect_index`, `amount`, `maxduration`, `remaintime`, `remaincharges`) VALUES
    290               (".$guid.", ".$guid.", 23775, 0, 1, -1, -1, -1),
    291               (".$guid.", ".$guid.", 36558, 0, 1, -1, -1, -1);");
    292                
    293                $this -> Msg ("Postava ve vězení.",0);
    294            
    295           }
    296           else
    297           {$this -> Msg ("Postava musí být offline.",1);}
    298      
    299 
    300       }
    301       // -- done
    302       public function IsOnline ($guid)
    303       {
    304            include("inc/db.php");
    305         $this -> db -> select_db($db_characters);
    306         $row = $this -> db -> query("SELECT `online` FROM `characters` WHERE `guid` = '".$guid."' LIMIT 1;") -> fetch_array();
    307         if ($row["online"] == 1)
    308         {return true;}
    309         else
    310         {return false;}
    311       }
    312       // --
    313       public function CharInAcc ($char,$acc)
    314       {
    315         if ($this -> Check())
    316         {
    317                  include("inc/db.php");
    318           if ($acc == 0)
    319           {$acc = $_SESSION["UserId"];}
    320           $this -> db -> select_db($db_characters);
    321           if ($this -> db -> query("SELECT `guid` FROM `characters` WHERE `characters`.`guid`='".$char."' AND `characters`.`account`='".$acc."' LIMIT 1;") -> num_rows == 1)
    322           {return true;}
    323           else
    324           {return false;}
    325         }
    326         else
    327         {
    328           $this -> Msg ("Nejste přihlášen",1);
    329           die;
    330         }
    331       }
    332       // --
    333       public function CharNameToGuid ($name)
    334       {
    335            include("inc/db.php");
    336         $this -> db -> select_db($db_characters);
    337         $row = $this -> db -> query("SELECT `guid` FROM `characters` WHERE `name` LIKE '".$name."' LIMIT 1;") -> fetch_array();
    338         if ($row["guid"] != "")
    339         {
    340           return $row["guid"];
    341         }
    342         else
    343         {
    344           return "Nenalezen";
    345         }
    346        
    347       }
    348       // --
    349       public function GuidToCharName ($guid)
    350       {
    351            include("inc/db.php");
    352         $this -> db -> select_db($db_characters);
    353         $row = $this -> db -> query("SELECT `name` FROM `characters` WHERE `guid` = '".$guid."' LIMIT 1;") -> fetch_array();
    354         if ($row["name"] != "")
    355         {
    356           return $row["name"];
    357         }
    358         else
    359         {
    360           return "Nenalezen";
    361         }
    362        
    363       }
    364       // --
    365       public function AccNameToGuid ($name)
    366       {
    367            include("inc/db.php");
    368         $this -> db -> select_db($db_realmd);
    369         $row = $this -> db -> query("SELECT `id` FROM `account` WHERE `username` LIKE '".$name."' LIMIT 1;") -> fetch_array();
    370         return $row["id"];
    371         if ($row["id"] != "")
    372         {
    373           return $row["id"];
    374         }
    375         else
    376         {
    377           return "Nenalezen";
    378         }
    379       }
    380       // --
    381       public function MoveChar($acc1_name,$acc1_pass,$acc2_name,$char_name)
    382       {
    383            include("inc/db.php");
    384         $this -> db -> select_db($db_realmd);
    385         $sha_pass = sha1(strtoupper($acc1_name).":".strtoupper($acc1_pass));
    386         $sql = $this -> db -> query("SELECT `id` FROM `account` WHERE `account`.`username`='".$acc1_name."' AND `account`.`sha_pass_hash`='".$sha_pass."'");
    387         if ($sql -> num_rows == 1)
    388         {
    389           $acc1_guid = $this -> AccNameToGuid($acc1_name);
    390           $acc2_guid = $this -> AccNameToGuid($acc2_name);
    391           $char_guid = $this -> CharNameToGuid($char_name);
    392            if ($this -> CharInAcc($char_guid,$acc1_guid))
    393            {
    394            $this -> db -> select_db("realm1_characters");
    395            $this -> db -> query("UPDATE `characters` SET  `account` = '".$acc2_guid."' WHERE `guid` ='".$char_guid."' LIMIT 1;");
    396            $this -> Msg ("Postava přemístěna.",0);
    397            }
    398            else
    399            {
    400            $this -> Msg ("Tato postava není vaše.",1);
    401            }
    402         }
    403       }
    404       // --
    405       public function Recall($time)
    406       {
    407         if (isset($_SERVER["HTTP_REFERER"]))
    408         {
    409           $link = parse_url($_SERVER["HTTP_REFERER"]);
    410           if ($link["host"] == "wow.zdechov.net" OR $link["host"] == "localhost")
    411           {
    412             echo "<meta http-equiv=\"refresh\" content=\"".$time.";?".$link["query"]."\">";
    413           }
    414           else
    415           {
    416             echo "<meta http-equiv=\"refresh\" content=\"".$time.";\">";
    417           }
    418         }
    419       }
    420       // --
    421       // done
    422       public function CharsOnAcc ($accid)
    423       {
    424            include("inc/db.php");
    425         echo "
    426         <table>
     345    }
     346  }
     347
     348  public function CharsOnAcc($accid)
     349  {
     350    global $Config;
     351   
     352    echo('<table>
    427353          <tr>
    428             <th align=\"center\">Jméno</th>
    429             <th align=\"center\">Úroveň</th>
    430             <th align=\"center\">Rasa</th>
    431             <th align=\"center\">Class</th>
    432             <th align=\"center\">Nahráno</th>
    433           </tr>
    434         ";
    435         $this -> db -> select_db($db_characters);
    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;");
    437         while ($row = $sql -> fetch_array())
    438         {
    439         $gender = ($row["gender"] == 0)?"m":"f";
    440         echo "
    441           <tr>
    442             <td align=\"center\">".$row["name"]."</td>
    443             <td align=\"center\">".$this -> GetPlayerLvl($row["guid"])."</td>
    444             <td align=\"center\"><img src=\"imgs/icons/".$this -> GetPlayerRace($row["race"])."-".$gender.".gif\"></td>
    445             <td align=\"center\"><img src=\"imgs/icons/".$this -> GetPlayerClass($row["class"]).".gif\"></td>
    446             <td align=\"center\">".round($row["totaltime"]/3600)." h</td>
    447           </tr>
    448         ";
    449         }
    450         echo "</table>";
    451       }
    452       // --
    453       // prihlaseni se ke generaci signatury
    454       public function SignatureOn ($guid)
    455       {
    456       $this -> db -> select_db($db_webu);
    457       }
    458       // lol
    459       private function NumCheck ($number)
    460       {
    461         if (!is_numeric($number))
    462         {
    463           die("Input Error");
    464         }
    465       }
     354            <th align="center">Jméno</th>
     355            <th align="center">Úroveň</th>
     356            <th align="center">Rasa</th>
     357            <th align="center">Třída</th>
     358            <th align="center">Nahráno</th>
     359          </tr>');
     360    $this->db->select_db($Config['Mangos']['DatabaseCharacters']);
     361    echo($this->db->error);
     362    $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 `account`='.$accid.' ORDER BY `totaltime` DESC LIMIT 0, 10');
     363    echo($this->db->error);
     364    while($row = $sql->fetch_array())
     365    {
     366      $gender = ($row['gender'] == 0) ? 'm' : 'f';
     367      echo('<tr>'.
     368        '<td align="center">'.$row['name'].'</td>'.
     369        '<td align="center">'.$this->GetPlayerLvl($row['guid']).'</td>'.
     370        '<td align="center"><img src="imgs/icons/'.$this->GetPlayerRace($row['race']).'-'.$gender.'.gif"></td>'.
     371        '<td align="center"><img src="imgs/icons/'.$this->GetPlayerClass($row['class']).'.gif"</td>'.
     372        '<td align="center">'.round($row['totaltime'] / 3600).' h</td>'.
     373        '</tr>');
     374    }
     375    echo('</table>');
     376  }
    466377}
     378
    467379?>
  • trunk/index.php

    r575 r576  
    11<?php
    22
     3// SQL injection hack protection
     4foreach($_POST as $Index => $Item) $_POST[$Index] = addslashes($Item);
     5foreach($_GET as $Index => $Item) $_GET[$Index] = addslashes($Item);
     6
    37session_start();
    4 include_once("./inc/db.php");
    5 include_once("./inc/html.php");
    6 include_once("./inc/player.php");
    7 include_once("./inc/server.php");
     8include_once('inc/db.php');
     9include_once('inc/db.php');
     10include_once('inc/html.php');
     11include_once('inc/player.php');
     12include_once('inc/server.php');
    813
    914// classes start
     
    1116$server = new Server($db);
    1217$html = new Html(0, $db);
    13 include_once('./functions.php');
    14 $html -> Start();
    15 if(isset($_COOKIE['hof-random']) AND $_COOKIE['hof-random'] == 'no') $num_headers = 1;
     18include_once('functions.php');
     19$html->Start();
     20if(isset($_COOKIE['hof-random']) and $_COOKIE['hof-random'] == 'no') $num_headers = 1;
    1621  else $num_headers = 8;
    1722
     
    5762echo('</div>');
    5863
    59 echo('<p><div class="Banners">'.
     64echo('<div class="Banners">'.
    6065  '<strong>Naše ikonka :</strong><br />'.
    61   '<a href="http://wow.zdechov.net/"><img src="imgs/web/hof_ban.png" alt="WoW Server Heroes of Fantasy" /></a><br />'.
     66  '<a href="'.$Config['Web']['BaseURL'].'"><img src="imgs/web/hof_ban.png" alt="WoW Server Heroes of Fantasy" /></a><br />'.
    6267  '<strong>Odkazy :</strong><br />'.
    6368  '<a href="http://servery.wowresource.eu/"><img src="http://servery.wowresource.eu/templates/img/bannery/banner_maly.gif" alt="WoW Server status" /></a><br />'.
     
    8893if($include == 1)
    8994{
    90   if(isset($_GET['page'])) include_once($html -> Pager($_GET['page'], 'pages', 'main'));
     95  if(isset($_GET['page'])) include_once($html->Pager($_GET['page'], 'pages', 'main'));
    9196    else include_once('pages/main.php');
    9297}
    93 echo('</div><div id="footer"><p><br /></p><div id="copyright"><a href="?page=autori">Vývoj webu</a></div></div></div>');
     98echo('</div><div id="footer"><br /><div id="copyright"><a href="?page=autori">Vývoj webu</a></div></div>');
    9499
    95100$html->Stop();
  • trunk/pages/chars.php

    r405 r576  
    11<?php
    2 $html -> PrgStart();
    3 echo "&nbsp;<a href=\"?page=acc\">&lt;- Zpět do správy účtu</a>";
    42
    5 $player -> CharsOnAcc($_SESSION["UserId"]);
     3$html->PrgStart();
     4echo('&nbsp;<a href="?page=acc">&lt;- Zpět do správy účtu</a>');
    65
     6$player->CharsOnAcc($_SESSION['UserId']);
    77
    8 echo "<font size=\"1\">Výpis omezen na 10 postav</font>";
    9 $html -> PrgStop();
     8echo('<font size="1">Výpis omezen na 10 postav</font>');
     9$html->PrgStop();
     10
    1011?>
  • trunk/pages/gmteam.php

    r573 r576  
    11<?php
    2 
    3 include('inc/db.php');
    42
    53$Role = array('Hráč', 'Moderátor', 'Game Master', 'Kontrolor chyb', 'Vedoucí Tábora', 'Administrátor', 'Správce Systému');
     
    4644  {
    4745    echo('<tr><td>Profil na foru:</td>');
    48     echo('<td><strong><a href="http://wow.zdechov.net/forum/memberlist.php?mode=viewprofile&u='.$Line['ForumId'].'">Profil</a></strong></td>');
     46    echo('<td><strong><a href="'.$Config['Web']['BaseURL'].'forum/memberlist.php?mode=viewprofile&u='.$Line['ForumId'].'">Profil</a></strong></td>');
    4947    echo '</tr>';
    5048  }
  • trunk/pages/register.php

    r567 r576  
    1 <?
    2    include('./inc/db.php');
    3 ?>
     1<?php
    42
    5 <table align="center" width="520">
    6           <tr><th align="center"><img src="./imgs/logoreg.png"</th></tr>
    7          
    8           <tr><td align="center"><br>
    9          
    10 <table align="center" width="230">
    11 <form method="post" action="http://wow.zdechov.net/?page=register">
    12 <tr><td>Account</td><td><input type="text" name="account"></td></tr>
    13 <tr><td>Heslo</td><td><input type="password" name="heslo1"></td></tr>
    14 <tr><td>Heslo znovu</td><td><input type="password" name="heslo2"></td></tr>
    15 <tr><td>Email</td><td><input type="text" name="email"></td></tr>
    16 <tr><td>Typ účtu</td><td><select name="expansion">
    17       <option value="">-- vyber typ účtu --</option>
    18       <option value="0">Classic</option>
    19       <option value="1">TBC</option>
    20       <option value="2">WoTLK</option></td></tr>     
    21           <tr><td>Pravidla <a href="http://wow.zdechov.net/forum/viewtopic.php?f=11&t=2066">ČTI</a></td><td><center>Souhlasím<input type="checkbox" name="agree" value="ON"></td><td></td></tr></center>
    22 <tr><td></td><td><input type="submit" Value="Registrovat"></td></tr>
    23 </form>
    24 <style type="text/css">
    25 h10 {color: red; font-style: arial}
    26 h11 {color: blue; font-style: arial}
    27 </style>
    28 <tr><td colspan="2" align="center"><strong>
    29 <?php
    30 mysql_connect($db_server, $db_user, $db_pass)  or die ("Spojení nebylo uspěšné");
    31 $p = mysql_num_rows(mysql_query("SELECT * FROM `realm1_realmd`.`account`"));
    32 if($p >= 13000) {
    33 echo "<h10>Registrace jsou uzavřeny</h10><p>";
    34 echo "<h11>Limit vyčerpán</h11>";
    35 } else {
    36 $account = addslashes($_POST['account']);
    37 $password1 = addslashes($_POST['heslo1']);
    38 $password2 = addslashes($_POST['heslo2']);
    39 $email = addslashes($_POST['email']);
    40 $expansion = addslashes($_POST['expansion']);
    41 
    42 function sha_password($account,$password){
    43 $account = strtoupper($account);
    44 $password = strtoupper($password);
    45    
    46 return SHA1($account.':'.$password);
     3function sha_password($account, $password)
     4{
     5  $account = strtoupper($account);
     6  $password = strtoupper($password);   
     7  return(sha1($account.':'.$password));
    478}
    489
    49 echo "<br>";
     10echo('<div style="margin-left:auto; margin-right:auto; text-align:center; align: center;">'.
     11  '<div style="margin-left:auto; margin-right:auto; text-align:center; align: center;">'.
     12  '<img style="align: center" src="./imgs/logoreg.png" alt="logo" /></div>'.
     13  '<form method="post" action="?page=register">'.
     14  '<table style="margin-left:auto; margin-right:auto; text-align:center;">'.
     15  '<tr><td>Účet:</td><td><input type="text" name="account" value="'.$_POST['account'].'"/></td></tr>'.
     16  '<tr><td>Heslo:</td><td><input type="password" name="heslo1" value="'.$_POST['heslo1'].'"/></td></tr>'.
     17  '<tr><td>Heslo znovu:</td><td><input type="password" name="heslo2" value="'.$_POST['heslo2'].'"/></td></tr>'.
     18  '<tr><td>Email:</td><td><input type="text" name="email" value="'.$_POST['email'].'"/></td></tr>'.
     19  '<tr><td>Typ účtu:</td><td><select name="expansion" value="'.$_POST['expansion'].'">'.
     20  '<option value="">-- vyber typ účtu --</option>'.
     21  '<option value="0">Klasický</option>'.
     22  '<option value="1">Rozšíření TBC</option>'.
     23  '<option value="2">Rozšíření WoTLK</option>'.
     24  '</select></td></tr>'.
     25  '<tr><td>Pravidla <a href="'.$Config['Web']['BaseURL'].'forum/viewtopic.php?f=11&amp;t=2066">ČTI</a></td><td>Souhlasím <input type="checkbox" name="agree" value="on" /></td><td></td></tr>'.
     26  '<tr><td></td><td><input type="submit" value="Registrovat" /></td></tr></table>'.
     27  '</form>'.
     28  '<br />');
    5029
    51 if ($account == "" || $password1 == "" || $password2 == "" || $email="" || $expansion="" || $agree=""):
    52 echo "<h10>Je nutno vyplnit všechny údaje</h10>";
    53 echo "<p>";
    54 echo "<h11>Registrace otevřeny</h11>";
    55   else:
     30$db->select_db($Config['Mangos']['DatabaseRealmd']);
     31$DbResult = $db->query('SELECT COUNT(*) FROM `account`');
     32if($DbResult->num_rows >= $Config['Mangos']['MaxAccountCount'])
     33{
     34  echo('<div class="h10">Registrace jsou uzavřeny</div>');
     35  echo('<div class="h11">Limit vyčerpán</div>');
     36} else
     37{
     38  echo('<div class="h11">Registrace otevřeny</div>');
    5639 
    57   if ($password1 != $password2):
    58   echo "Zadaná hesla se neshodují";
    59  
    60   else:
    61   $password = $password1;
    62   $account = strtoupper($account);
    63   $heslo = sha_password($account, $password);
     40  $account = addslashes($_POST['account']);
     41  $password1 = addslashes($_POST['heslo1']);
     42  $password2 = addslashes($_POST['heslo2']);
    6443  $email = addslashes($_POST['email']);
    6544  $expansion = addslashes($_POST['expansion']);
    66   $dbconn = mysql_connect($db_server, $db_user, $db_pass)  or die ("Spojení nebylo uspěšné");
    67   mysql_select_db($db_realmd, $dbconn)  or die ("Nepovedlo se vybrat databázy $realmd");
    68   $acc_dotaz_sql = "SELECT id, username, sha_pass_hash FROM account WHERE username='".$account."'";
    69   $acc_dotaz_sql_vysledek = mysql_query($acc_dotaz_sql, $dbconn);
    70   $row = mysql_fetch_array($acc_dotaz_sql_vysledek);
    71    
    72       if ($row["id"] != ""):
    73         echo "Účet již existuje";
    74        
    75       else:
     45  $agree = addslashes($_POST['agree']);
    7646
    77         mysql_select_db($db_realmd, $dbconn) or die ("Nepovedlo se vybrat databázy $characters");
    78        
    79         $sqlko = "INSERT INTO `account` (`username`,`sha_pass_hash`,`email`,`expansion`) values ('$account','$heslo','$email','$expansion')";
    80            
    81             mysql_query($sqlko, $dbconn) or die ('něco nevyšlo v querry');
    82             echo "Účet $character byl vytvořen!";
    83          
    84           endif;
    85                 mysql_close();         
    86         endif;
    87       endif;
     47  echo('<br />');
    8848
     49  if(($account == '') or ($password1 == '') or ($password2 == '') or ($email == '') or ($expansion == '') or ($agree == ''))
     50  {
     51    echo('<div class="h10">Je nutno vyplnit všechny údaje</div>');
     52  } else
     53  {
     54    if($password1 != $password2) echo('Zadaná hesla se neshodují');
     55    else
     56    {
     57      $password = $password1;
     58      $account = strtoupper($account);
     59      $heslo = sha_password($account, $password);
     60      $email = addslashes($_POST['email']);
     61      $expansion = addslashes($_POST['expansion']);
     62
     63      $DbResult = $db->query('SELECT `id`, `username`, `sha_pass_hash` FROM `account` WHERE `username`="'.$account.'"');
     64      if($DbResult->num_rows > 0)
     65      {
     66        echo('<div class="h10">Účet již existuje</div>');
     67      } else
     68      {       
     69        $DbResult = $db->query('INSERT INTO `account` (`username`,`sha_pass_hash`,`email`,`expansion`) values ("'.$account.'","'.$heslo.'","'.$email.'","'.$expansion.'")');
     70        echo($db->error);               
     71        echo('<div class="h10">Účet '.$account.' byl vytvořen!</div>');
     72      }
     73    }
     74  }
    8975}
     76echo('</div><p></p>');
     77
    9078?>
    91 </strong></table></td></tr></table>
    92 <? echo('<center><br><br><br><a href="http://wow.zdechov.net/?page=acc">Úprava Profilu</a><br/></center>'); ?>
  • trunk/pages/server.php

    r571 r576  
    88  <tr>
    99    <td>Herní server je</td>
    10     <td>'.$server->ServerImg($server->ServerOnline('wow.zdechov.net', 8085)).'</td>
     10    <td>'.$server->ServerImg($server->ServerOnline($Config['Web']['WoWServerAddr'], 8085)).'</td>
    1111  </tr>
    1212
     
    2929  <tr>
    3030    <td><a href="?page=teamspeak">TeamSpeak</a> server je</td>
    31     <td>'.$server->ServerImg($server->ServerOnline('game.zdechov.net', 51234)).'</td>
     31    <td>'.$server->ServerImg($server->ServerOnline($Config['Web']['WoWServerAddr'], 51234)).'</td>
    3232  </tr>
    3333  <tr>
    3434    <td><a href="http://game.zdechov.net:6969/">Torrent</a> server je</td>
    35     <td>'.$server->ServerImg($server->ServerOnline('game.zdechov.net', 6969)).'</td>
     35    <td>'.$server->ServerImg($server->ServerOnline($Config['Web']['WoWServerAddr'], 6969)).'</td>
    3636  </tr>
    3737  <tr>
  • trunk/pages/xpreset.php

    r438 r576  
    11<?php
    2 $html -> PrgStart();
    3 if ($player -> Check())
    4   {
    5 echo "
    6 &nbsp;<a href=\"?page=acc\">&lt;- Zpět do správy účtu</a>
     2
     3$html->PrgStart();
     4if($player->Check())
     5{
     6  echo('<a href="?page=acc">&lt;- Zpět do správy účtu</a>
    77<center><h3>Resetování XP vaší postavy</h3></center>
    8 <form method=\"post\">
    9 <table align=\"center\">
     8<form method="post">
     9<table align="center">
    1010  <tr>
    1111    <td>
    12       Jméno postavy pro resetování XP : </td>
     12      Jméno postavy: </td>
    1313    <td>
    14       <input type=\"text\" name=\"char\"></td>
     14      <input type="text" name="char"></td>
    1515  </tr>
    1616  <tr>
    17     <td colspan=\"2\" align=\"right\">
    18       <input type=\"submit\" value=\"Resetovat\" name=\"xpreset\"></td>
     17    <td colspan="2" align="right">
     18      <input type="submit" value="Resetovat" name="xpreset"></td>
    1919  </tr>
    2020</table>
    21 </form>
    22 ";
    23 if (isset($_POST["xpreset"]) AND $_POST["char"] != "")
     21</form>');
     22
     23  if(isset($_POST['xpreset']) and $_POST['char'] != '')
     24  {
     25    $guid = $player->CharNameToGuid($_POST['char']);
     26    $player->ResetXP($guid);
     27  }
     28} else
    2429{
    25 $guid = $player -> CharNameToGuid($_POST["char"]);
    26 $player -> ResetXP($guid);
    27 }
    28 }
    29 else
    30 {
    31 $player -> LoginForm();
     30  $player->LoginForm();
    3231}
    3332
    34 $html -> PrgStop();
     33$html->PrgStop();
     34
    3535?>
  • trunk/styles/style.css

    r557 r576  
    215215  width: 90%;
    216216}
     217
     218.h10
     219{
     220  color: red;
     221  font-style: arial;
     222  font-weight: bold;
     223}
     224
     225.h11
     226{
     227  color: blue;
     228  font-style: arial;
     229  font-weight: bold;
     230}
     231
Note: See TracChangeset for help on using the changeset viewer.