Changeset 582 for trunk/pages


Ignore:
Timestamp:
May 4, 2009, 9:38:17 PM (16 years ago)
Author:
george
Message:
  • Opraveno: Opravena a pročištěna stránky změny typu účtu. Opravena chyba řazení arén. Opraveno chyba čtení jména účtu v banlistu.
Location:
trunk/pages
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/pages/arena.php

    r407 r582  
    11<?php
    2 // razeni
    3   $order_by = (isset($_GET["order"])) ? $db->real_escape_string($_GET["order"]) : "name";
    4   $dir = (isset($_GET["dir"])) ? $db->real_escape_string($_GET["dir"]) : "down";
    5   $order_dir = ($dir == "up") ? "ASC" : "DESC";
    6   $dir = ($dir == "down") ? "up" : "down";
    7   $dir_img = ($dir == "down") ? "<img src=\"imgs/inc/up.gif\">" : "<img src=\"imgs/inc/down.gif\">";
    8 function MakeLink ($show,$sort)
     2
     3$Columns = array('name', 'atname', 'attype', 'tot_chars', 'atrating', 'atwin', 'atgames');
     4$order_by = (isset($_GET['order'])) ? $_GET['order'] : 'atname';
     5if(!array_key_exists($order_by, $Columns)) $order_by = 'atname';
     6$dir = (isset($_GET['dir'])) ? $_GET['dir'] : 'down';
     7$order_dir = ($dir == 'up') ? 'ASC' : 'DESC';
     8$dir = ($dir == 'down') ? 'up' : 'down';
     9$dir_img = ($dir == 'down') ? '<img src="imgs/inc/up.gif" alt="nahoru"/>' : '<img src="imgs/inc/down.gif" alt="dolu">';
     10
     11function MakeLink($show, $sort)
    912{
    10   global $dir , $dir_img;
    11   if (isset($_GET["order"]) AND $_GET["order"] == $sort)
    12   {
    13     $arrow = $dir_img."";
    14   }
    15   else
    16   {
    17     $arrow = "";
    18   }
    19   return $arrow."<a href=\"?page=arena&amp;order=".$sort."&amp;dir=".$dir."\">".$show."</a>";
    20 }
    21 include("inc/db.php");
    22 $db -> select_db("$db_characters");
    23 $count = $db -> query("SELECT count(*) FROM arena_team;") -> fetch_array();
     13  global $dir, $dir_img;
     14 
     15  if(isset($_GET['order']) and $_GET['order'] == $sort) $arrow = $dir_img;
     16  else $arrow = '';
     17  return($arrow.'<a href="?page=arena&amp;order='.$sort.'&amp;dir='.$dir.'">'.$show.'</a>');
     18}
     19
     20$db->select_db($Config['Mangos']['DatabaseCharacters']);
     21$count = $db->query('SELECT COUNT(*) FROM arena_team')->fetch_row();
    2422$all_record = $count[0];
    25 echo "
    26 <center><h3>Arénové týmy :</h3></center>
    27 Celkem týmů : <b>".$all_record."</b>
     23echo('<center><h3>Arénové týmy :</h3></center>
     24Celkem týmů : <b>'.$all_record.'</b>
    2825<center>
    29   <table border=\"1\" width=\"540\">
     26  <table border="1" width="540">
    3027    <tr>
    31       <th>".MakeLink("Tým","atname")."</th>
     28      <th>'.MakeLink('Tým', 'atname').'</th>
    3229      <th>Kapitán</th>
    33       <th>".MakeLink("Typ","attype")."</th>
    34       <th>".MakeLink("Členů","tot_chars")."</th>
    35       <th>".MakeLink("Rating","atrating")."</th>
    36       <th>".MakeLink("Her vyhráno","atwin")."</th>
    37       <th>".MakeLink("Her hráno","atgames")."</th>
    38     </tr>
    39 ";
    40 $query = $db -> query("SELECT arena_team.arenateamid AS atid, arena_team.name AS atname, arena_team.captainguid AS lguid, arena_team.type AS attype, (SELECT name FROM `characters` WHERE guid = lguid) AS l_name,(SELECT COUNT(*) FROM  arena_team_member WHERE arenateamid = atid) AS tot_chars, rating AS atrating, games as atgames, wins as atwins FROM arena_team, arena_team_stats WHERE arena_team.arenateamid = arena_team_stats.arenateamid ORDER BY ".$order_by." ".$order_dir.";");
    41   while ($row = $query -> fetch_array())
    42   {
    43     echo "
    44       <tr>
    45         <td align=\"center\">".$row["atname"]."</td>
    46         <td align=\"center\">".$row["l_name"]."</td>
    47         <td align=\"center\">".$row["attype"]."</td>
    48         <td align=\"center\">".$row["tot_chars"]."</td>
    49         <td align=\"center\">".$row["atrating"]."</td>
    50         <td align=\"center\">".$row["atwins"]."</td>
    51         <td align=\"center\">".$row["atgames"]."</td>
    52       </tr> 
    53     ";
    54   }
    55 echo "</table></center>";
     30      <th>'.MakeLink('Typ', 'attype').'</th>
     31      <th>'.MakeLink('Členů', 'tot_chars').'</th>
     32      <th>'.MakeLink('Rating', 'atrating').'</th>
     33      <th>'.MakeLink('Her vyhráno', 'atwin').'</th>
     34      <th>'.MakeLink('Her hráno', 'atgames').'</th>
     35    </tr>');
     36$query = $db->query('SELECT arena_team.arenateamid AS atid, arena_team.name AS atname, arena_team.captainguid AS lguid, arena_team.type AS attype, (SELECT name FROM `characters` WHERE guid = lguid) AS l_name, (SELECT COUNT(*) FROM arena_team_member WHERE arenateamid = atid) AS tot_chars, rating AS atrating, games as atgames, wins as atwins FROM arena_team, arena_team_stats WHERE arena_team.arenateamid = arena_team_stats.arenateamid ORDER BY '.$order_by.' '.$order_dir);
     37while($row = $query->fetch_assoc())
     38{
     39  echo('<tr>
     40        <td align="center">'.$row['atname'].'</td>
     41        <td align="center">'.$row['l_name'].'</td>
     42        <td align="center">'.$row['attype'].'</td>
     43        <td align="center">'.$row['tot_chars'].'</td>
     44        <td align="center">'.$row['atrating'].'</td>
     45        <td align="center">'.$row['atwins'].'</td>
     46        <td align="center">'.$row['atgames'].'</td>
     47      </tr>');
     48}
     49echo('</table></center>');
     50
    5651?>
  • trunk/pages/banlist.php

    r579 r582  
    2626$db->select_db($Config['Mangos']['DatabaseRealmd']);
    2727
    28 $DbResult = $db->query('select * from `account` where `last_ip` = "'.$ipcko.'" order by `last_login` desc limit 3');
     28$DbResult = $db->query('SELECT * FROM `account` WHERE `last_ip` = "'.$ipcko.'" ORDER BY `last_login` DESC LIMIT 3');
    2929while($DbRow = $DbResult->fetch_assoc())
    3030{
    31   $i = $$DbRow['username'];
     31  $i = $DbRow['username'];
    3232  echo($i.', ');
    3333}
  • trunk/pages/chtyp.php

    r547 r582  
    1 <center><div style="background-image:url(./imgs/web/prg.gif);
    2                 background-repeat:repeat;
    3                 width:346px;
    4                 height:417px;">
    5 <br><br><br><br>
    6 <a href="?page=acc"><- Zpět do správy účtu </a>
    7 <br><br>
    8 <center><font face="Verdana" color="black" size="3"><h3>Změna typu accountu</h3></font></center>
    9 <form action="" method="post"><center>
    10 <table border=0>
    11 <tr><td width="50px"><font face="verdana" size="2"><b>Ú&#269;et :</b></font></td>
    12 <td><input type="textbox" name="aa"></td></tr>
     1<?php
     2
     3$html->PrgStart();
     4
     5echo('<form action="" method="post">
     6<center><h3>Změna typu účtu</h3></center>
     7<table border="0" align="center">
     8<tr><td width="50px"><font face="verdana" size="2"><b>Účet :</b></font></td>
     9<td><input type="textbox" name="aa" /></td></tr>
    1310<tr><td><font face="verdana" size="2"><b>Heslo :</b></font></td>
    14 <td><input type="password" name="ab"></td></tr>
     11<td><input type="password" name="ab" /></td></tr>
    1512<tr><td></td><td><select name="vyber">
    1613 <option value="wotlk">WotLK datadisk</option>
    1714 <option value="tbc">TBC datadisk</option>
    1815 <option value="wow">bez datadisku</option></select>
    19 <tr><td><input type="submit" name="ac" value="odeslat"></td><td></center>
    20 </form>
    21 </table>
    22 <?
     16<tr><td><input type="submit" name="ac" value="odeslat" /></td><td>
     17</table></form>');
    2318
    24 include "./inc/db.php";
     19$Expansion = array(0 => 'Klasický', 1 => 'The Burning Crusade', 2 => 'Wrath of the Litch King');
    2520
    26 if(array_key_exists("aa", $_POST))
    27 if(array_key_exists("ab", $_POST))
    28 if(array_key_exists("vyber", $_POST))
     21if(array_key_exists('aa', $_POST))
     22if(array_key_exists('ab', $_POST))
     23if(array_key_exists('vyber', $_POST))
    2924{
     25  $account= @$_POST['aa'];
     26  $heslo= @$_POST['ab'];
     27  $vyber = @$_POST['vyber'];
    3028
    31 $account= @$_POST['aa'];
    32 $heslo= @$_POST['ab'];
    33 $vyber = @$_POST['vyber'];
    34 
    35 if($account!="" || $heslo!="")
    36 { mysql_connect("$db_server", "$db_user", "$db_pass");
    37 mysql_select_db("$db_realmd");
     29  if($account != '' || $heslo != '')
     30  {
     31    $db->select_db($Config['Mangos']['DatabaseRealmd']);
    3832 
    3933    $user2 = strtoupper($account);
    4034    $pass = strtoupper($heslo);
    41     $i = SHA1($user2.':'.$pass);
     35    $i = SHA1($user2.':'.$pass); 
    4236 
     37    $data = $db->query('SELECT id FROM `account` WHERE username="'.$account.'" AND sha_pass_hash="'.$i.'" LIMIT 0,1');
    4338 
    44   $data = mysql_query("select id from `$db_realmd`.`account` where username='$account' and sha_pass_hash='$i' limit 0,1");
    45  
    46   $id = mysql_fetch_array($data);
    47  
    48   if($id['id']== "")
    49   {
    50   die("<font face=\"verdana\" size=\"2\" color=\"red\">Špatně zadané údaje accountu.</font>");
    51   }
     39    $id = $data->fetch_assoc(); 
     40    if($id['id'] == '')
     41    {
     42      die('<font face="verdana" size="2" color="red">Špatně zadané údaje účtu.</font>');
     43    }
    5244
    53 switch ($vyber):
    54   case wotlk:
    55   $nastaveni = "2";
    56   break;
    57   case tbc:
    58   $nastaveni = "1";
    59   break;
    60   case wow:
    61   $nastaveni = "0";
    62   break;
    63 endswitch;
     45    switch($vyber)
     46    {
     47      case 'wotlk':
     48        $nastaveni = 2;
     49        break;
     50      case 'tbc':
     51        $nastaveni = 1;
     52        break;
     53      case 'wow':
     54        $nastaveni = 0;
     55        break;
     56    }
    6457
    65 $querko = mysql_query("update `account` set `expansion` = '$nastaveni' where `username` = '$account'");
    66 
    67 if($nastaveni == "1"){
    68 
    69 echo "<br /><font face=\"verdana\" size=\"2\" color=\"DarkGreen\">datadisk The Burning Crusade byl pro ú&#269;et $account úsp&#283;šn&#283; zapnut.</font><br>";
    70 
    71 } elseif($nastaveni == "2"){
    72 
    73 echo "<br /><font face=\"verdana\" size=\"2\" color=\"DarkGreen\">datadisk Wrath of the Litch King byl pro ú&#269;et $account úsp&#283;šn&#283; zapnut.</font><br>";
    74 
    75 } else {
    76 
    77 echo "<br /><font face=\"verdana\" size=\"2\" color=\"DarkGreen\">Veškeré datadisky byly pro ú&#269;et $account úsp&#283;šn&#283; vypnuty.</font><br>";
    78 
    79 }
    80 }
     58    $querko = $db->query('UPDATE `account` SET `expansion` = '.$nastaveni.' WHERE `username` = "'.$account.'"');
     59    if($nastaveni == 1)
     60    {
     61      echo('<br /><font face="verdana" size="2" color="DarkGreen">datadisk The Burning Crusade byl pro účet '.$account.' úspěšně zapnut.</font><br />');
     62    } elseif($nastaveni == 2)
     63    {
     64      echo('<br /><font face="verdana" size="2" color="DarkGreen">datadisk Wrath of the Litch King byl pro účet '.$account.' úspěšně zapnut.</font><br />');
     65    } else
     66    {
     67      echo('<br /><font face="verdana" size="2" color="DarkGreen">Veškeré datadisky byly pro účet '.$account.' úspěšně vypnuty.</font><br />');
     68    }
     69  } else echo('<br /><font face="verdana" size="2" color="red">Zadejte vaše jméno a heslo.</font><br />');
    8170}
    8271
    83 
     72$html->PrgStop();
    8473?>
    85 </div>
Note: See TracChangeset for help on using the changeset viewer.