Changeset 19 for minimanager/tele.php


Ignore:
Timestamp:
Aug 13, 2007, 9:05:34 PM (17 years ago)
Author:
george
Message:

Aktualizace MaNGOS Minimanageru na verzi 0.1.4a.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • minimanager/tele.php

    r5 r19  
    1919 global $lang_tele, $lang_global, $output, $mangos_db, $realm_id, $itemperpage;
    2020
    21  $mysql = new MySQL;
    22  $mysql->connect($mangos_db[$realm_id]['addr'], $mangos_db[$realm_id]['user'], $mangos_db[$realm_id]['pass'], $mangos_db[$realm_id]['name']);
    23  
    24  $start = (isset($_GET['start'])) ? $mysql->quote_smart($_GET['start']) : 0;
    25  $order_by = (isset($_GET['order_by'])) ? $mysql->quote_smart($_GET['order_by']) : "id";
    26 
    27  $dir = (isset($_GET['dir'])) ? $mysql->quote_smart($_GET['dir']) : 1;
     21 $sql = new SQL;
     22 $sql->connect($mangos_db[$realm_id]['addr'], $mangos_db[$realm_id]['user'], $mangos_db[$realm_id]['pass'], $mangos_db[$realm_id]['name']);
     23 
     24 $start = (isset($_GET['start'])) ? $sql->quote_smart($_GET['start']) : 0;
     25 $order_by = (isset($_GET['order_by'])) ? $sql->quote_smart($_GET['order_by']) : "id";
     26
     27 $dir = (isset($_GET['dir'])) ? $sql->quote_smart($_GET['dir']) : 1;
    2828 $order_dir = ($dir) ? "ASC" : "DESC";
    2929 $dir = ($dir) ? 0 : 1;
    3030 
    3131//get total number of items
    32  $query_1 = $mysql->query("SELECT count(*) FROM game_tele");
    33  $all_record = $mysql->result($query_1,0);
    34  $query = $mysql->query("SELECT id, name, map, position_x, position_y, position_z, orientation
     32 $query_1 = $sql->query("SELECT count(*) FROM game_tele");
     33 $all_record = $sql->result($query_1,0);
     34 $query = $sql->query("SELECT id, name, map, position_x, position_y, position_z, orientation
    3535                 FROM game_tele ORDER BY $order_by $order_dir LIMIT $start, $itemperpage");
    36  $this_page = $mysql->num_rows($query);
     36 $this_page = $sql->num_rows($query);
    3737
    3838//==========================top tage navigaion starts here========================
     
    5858//==========================top tage navigaion ENDS here ========================
    5959
    60  $output .= "<table class=\"lined\">
     60 $output .= "<script type=\"text/javascript\">
     61        answerbox.btn_ok='{$lang_global['yes_low']}';
     62        answerbox.btn_cancel='{$lang_global['no']}';
     63        var question = '{$lang_global['are_you_sure']}';
     64        var del_tele = 'tele.php?action=del_tele&amp;order_by=$order_by&amp;start=$start&amp;dir=$dir&amp;id=';
     65 </script>
     66 <table class=\"lined\">
    6167   <tr>
    62         <td width=\"5%\" class=\"head\">{$lang_global['delete']}</td>
    63         <td width=\"5%\" class=\"head\"><a href=\"tele.php?order_by=id&amp;start=$start&amp;dir=$dir\" class=\"head_link\">{$lang_tele['id']}</a></td>
    64         <td width=\"28%\" class=\"head\"><a href=\"tele.php?order_by=name&amp;start=$start&amp;dir=$dir\" class=\"head_link\">{$lang_tele['name']}</a></td>
    65         <td width=\"22%\" class=\"head\"><a href=\"tele.php?order_by=map&amp;start=$start&amp;dir=$dir\" class=\"head_link\">{$lang_tele['map']}</a></td>
    66         <td width=\"9%\" class=\"head\"><a href=\"tele.php?order_by=position_x&amp;start=$start&amp;dir=$dir\" class=\"head_link\">{$lang_tele['x']}</a></td>
    67         <td width=\"9%\" class=\"head\"><a href=\"tele.php?order_by=position_y&amp;start=$start&amp;dir=$dir\" class=\"head_link\">{$lang_tele['y']}</a></td>
    68         <td width=\"9%\" class=\"head\"><a href=\"tele.php?order_by=position_z&amp;start=$start&amp;dir=$dir\" class=\"head_link\">{$lang_tele['z']}</a></td>
    69         <td width=\"10%\" class=\"head\"><a href=\"tele.php?order_by=orientation&amp;start=$start&amp;dir=$dir\" class=\"head_link\">{$lang_tele['orientation']}</a></td>
     68        <th width=\"5%\">{$lang_global['delete_short']}</th>
     69        <th width=\"5%\"><a href=\"tele.php?order_by=id&amp;start=$start&amp;dir=$dir\">".($order_by=='id' ? "<img src=\"img/arr_".($dir ? "up" : "dw").".gif\" /> " : "")."{$lang_tele['id']}</a></th>
     70        <th width=\"28%\"><a href=\"tele.php?order_by=name&amp;start=$start&amp;dir=$dir\">".($order_by=='name' ? "<img src=\"img/arr_".($dir ? "up" : "dw").".gif\" /> " : "")."{$lang_tele['name']}</a></th>
     71        <th width=\"22%\><a href=\"tele.php?order_by=map&amp;start=$start&amp;dir=$dir\">".($order_by=='map' ? "<img src=\"img/arr_".($dir ? "up" : "dw").".gif\" /> " : "")."{$lang_tele['map']}</a></th>
     72        <th width=\"9%\"><a href=\"tele.php?order_by=position_x&amp;start=$start&amp;dir=$dir\">".($order_by=='position_x' ? "<img src=\"img/arr_".($dir ? "up" : "dw").".gif\" /> " : "")."{$lang_tele['x']}</a></th>
     73        <th width=\"9%\"><a href=\"tele.php?order_by=position_y&amp;start=$start&amp;dir=$dir\">".($order_by=='position_y' ? "<img src=\"img/arr_".($dir ? "up" : "dw").".gif\" /> " : "")."{$lang_tele['y']}</a></th>
     74        <th width=\"9%\"><a href=\"tele.php?order_by=position_z&amp;start=$start&amp;dir=$dir\">".($order_by=='position_z' ? "<img src=\"img/arr_".($dir ? "up" : "dw").".gif\" /> " : "")."{$lang_tele['z']}</a></th>
     75        <th width=\"10%\"><a href=\"tele.php?order_by=orientation&amp;start=$start&amp;dir=$dir\">".($order_by=='orientation' ? "<img src=\"img/arr_".($dir ? "up" : "dw").".gif\" /> " : "")."{$lang_tele['orientation']}</a></th>
    7076   </tr>";
    7177
    72 while ($data = $mysql->fetch_row($query)){
     78while ($data = $sql->fetch_row($query)){
    7379        $output .= "<tr>
    74                         <td><a href=\"tele.php?action=del_tele&amp;id=$data[0]\"><img src=\"img/x.ico\" class=\"no_border\" alt=\"\" /></a></td>
     80                        <td><img src=\"img/aff_cross.png\" alt=\"\" onclick=\"answerBox('{$lang_global['delete']}: <font color=white>{$data[1]}</font> <br /> ' + question, del_tele + $data[0]);\" style=\"cursor:pointer;\" /></td>
    7581                        <td>$data[0]</td>
    7682                        <td><a href=\"tele.php?action=edit_tele&amp;id=$data[0]\">$data[1]</a></td>
     
    8692   </table></center>";
    8793
    88  $mysql->close();
     94 $sql->close();
    8995}
    9096
     
    98104 if(empty($_GET['search_value']) || empty($_GET['search_by'])) redirect("guild.php?error=2");
    99105
    100  $mysql = new MySQL;
    101  $mysql->connect($mangos_db[$realm_id]['addr'], $mangos_db[$realm_id]['user'], $mangos_db[$realm_id]['pass'], $mangos_db[$realm_id]['name']);
    102  
    103  $search_value = $mysql->quote_smart($_GET['search_value']);
    104  $search_by = $mysql->quote_smart($_GET['search_by']);
    105 
    106  $order_by = (isset($_GET['order_by'])) ? $mysql->quote_smart($_GET['order_by']) : "id";
    107  $dir = (isset($_GET['dir'])) ? $mysql->quote_smart($_GET['dir']) : 1;
     106 $sql = new SQL;
     107 $sql->connect($mangos_db[$realm_id]['addr'], $mangos_db[$realm_id]['user'], $mangos_db[$realm_id]['pass'], $mangos_db[$realm_id]['name']);
     108 
     109 $search_value = $sql->quote_smart($_GET['search_value']);
     110 $search_by = $sql->quote_smart($_GET['search_by']);
     111
     112 $order_by = (isset($_GET['order_by'])) ? $sql->quote_smart($_GET['order_by']) : "id";
     113 $dir = (isset($_GET['dir'])) ? $sql->quote_smart($_GET['dir']) : 1;
    108114 $order_dir = ($dir) ? "ASC" : "DESC";
    109115 $dir = ($dir) ? 0 : 1;
    110116 
    111  $query = $mysql->query("SELECT id, name, map, position_x, position_y, position_z, orientation
     117 $query = $sql->query("SELECT id, name, map, position_x, position_y, position_z, orientation
    112118                FROM game_tele WHERE $search_by LIKE '%$search_value%' ORDER BY $order_by $order_dir LIMIT $sql_search_limit");
    113  $total_found = $mysql->num_rows($query);
     119 $total_found = $sql->num_rows($query);
    114120
    115121//==========================top tage navigaion starts here========================
    116  $output .="<center><table class=\"top_hidden\">
     122 $output .="<script type=\"text/javascript\">
     123                        answerbox.btn_ok='{$lang_global['yes_low']}';
     124                        answerbox.btn_cancel='{$lang_global['no']}';
     125                        var question = '{$lang_global['are_you_sure']}';
     126                        var del_tele = 'tele.php?action=del_tele&amp;order_by=$order_by&amp;dir=$dir&amp;id=';
     127                 </script>
     128                 <center><table class=\"top_hidden\">
    117129                        <tr><td>";
    118130                        makebutton($lang_tele['add_new'], "tele.php?action=add_tele",90);
     
    133145 $output .= "<table class=\"lined\">
    134146   <tr>
    135         <td width=\"5%\" class=\"head\">{$lang_global['delete']}</td>
    136         <td width=\"5%\" class=\"head\"><a href=\"tele.php?action=search&amp;error=4&amp;order_by=id&amp;search_by=$search_by&amp;search_value=$search_value&amp;dir=$dir\" class=\"head_link\">{$lang_tele['id']}</a></td>
    137         <td width=\"28%\" class=\"head\"><a href=\"tele.php?action=search&amp;error=4&amp;order_by=name&amp;search_by=$search_by&amp;search_value=$search_value&amp;dir=$dir\" class=\"head_link\">{$lang_tele['name']}</a></td>
    138         <td width=\"22%\" class=\"head\"><a href=\"tele.php?action=search&amp;error=4&amp;order_by=map&amp;search_by=$search_by&amp;search_value=$search_value&amp;dir=$dir\" class=\"head_link\">{$lang_tele['map']}</a></td>
    139         <td width=\"9%\" class=\"head\"><a href=\"tele.php?action=search&amp;error=4&amp;order_by=position_x&amp;search_by=$search_by&amp;search_value=$search_value&amp;dir=$dir\" class=\"head_link\">{$lang_tele['x']}</a></td>
    140         <td width=\"9%\" class=\"head\"><a href=\"tele.php?action=search&amp;error=4&amp;order_by=position_y&amp;search_by=$search_by&amp;search_value=$search_value&amp;dir=$dir\" class=\"head_link\">{$lang_tele['y']}</a></td>
    141         <td width=\"9%\" class=\"head\"><a href=\"tele.php?action=search&amp;error=4&amp;order_by=position_z&amp;search_by=$search_by&amp;search_value=$search_value&amp;dir=$dir\" class=\"head_link\">{$lang_tele['z']}</a></td>
    142         <td width=\"10%\" class=\"head\"><a href=\"tele.php?action=search&amp;error=4&amp;order_by=orientation&amp;search_by=$search_by&amp;search_value=$search_value&amp;dir=$dir\" class=\"head_link\">{$lang_tele['orientation']}</a></td>
     147        <th width=\"5%\">{$lang_global['delete_short']}</th>
     148        <th width=\"5%\"><a href=\"tele.php?action=search&amp;error=4&amp;order_by=id&amp;search_by=$search_by&amp;search_value=$search_value&amp;dir=$dir\">".($order_by=='id' ? "<img src=\"img/arr_".($dir ? "up" : "dw").".gif\" /> " : "")."{$lang_tele['id']}</a></th>
     149        <th width=\"28%\"><a href=\"tele.php?action=search&amp;error=4&amp;order_by=name&amp;search_by=$search_by&amp;search_value=$search_value&amp;dir=$dir\">".($order_by=='name' ? "<img src=\"img/arr_".($dir ? "up" : "dw").".gif\" /> " : "")."{$lang_tele['name']}</a></th>
     150        <th width=\"22%\"><a href=\"tele.php?action=search&amp;error=4&amp;order_by=map&amp;search_by=$search_by&amp;search_value=$search_value&amp;dir=$dir\">".($order_by=='map' ? "<img src=\"img/arr_".($dir ? "up" : "dw").".gif\" /> " : "")."{$lang_tele['map']}</a></th>
     151        <th width=\"9%\"><a href=\"tele.php?action=search&amp;error=4&amp;order_by=position_x&amp;search_by=$search_by&amp;search_value=$search_value&amp;dir=$dir\">".($order_by=='position_x' ? "<img src=\"img/arr_".($dir ? "up" : "dw").".gif\" /> " : "")."{$lang_tele['x']}</a></th>
     152        <th width=\"9%\"><a href=\"tele.php?action=search&amp;error=4&amp;order_by=position_y&amp;search_by=$search_by&amp;search_value=$search_value&amp;dir=$dir\">".($order_by=='position_y' ? "<img src=\"img/arr_".($dir ? "up" : "dw").".gif\" /> " : "")."{$lang_tele['y']}</a></th>
     153        <th width=\"9%\"><a href=\"tele.php?action=search&amp;error=4&amp;order_by=position_z&amp;search_by=$search_by&amp;search_value=$search_value&amp;dir=$dir\">".($order_by=='position_z' ? "<img src=\"img/arr_".($dir ? "up" : "dw").".gif\" /> " : "")."{$lang_tele['z']}</a></th>
     154        <th width=\"10%\"><a href=\"tele.php?action=search&amp;error=4&amp;order_by=orientation&amp;search_by=$search_by&amp;search_value=$search_value&amp;dir=$dir\">".($order_by=='orientation' ? "<img src=\"img/arr_".($dir ? "up" : "dw").".gif\" /> " : "")."{$lang_tele['orientation']}</a></th>
    143155   </tr>";
    144156
    145 while ($data = $mysql->fetch_row($query)){
     157while ($data = $sql->fetch_row($query)){
    146158        $output .= "<tr>
    147                 <td><a href=\"tele.php?action=del_tele&amp;id=$data[0]\"><img src=\"img/x.ico\" class=\"no_border\" alt=\"\" /></a></td>
     159                <td><img src=\"img/aff_cross.png\" alt=\"\" onclick=\"answerBox('{$lang_global['delete']}: <font color=white>{$data[1]}</font> <br /> ' + question, del_tele + $data[0]);\" style=\"cursor:pointer;\" /></td>
    148160                <td>$data[0]</td>
    149161                <td><a href=\"tele.php?action=edit_tele&amp;id=$data[0]\">$data[1]</a></td>
     
    161173   </table></center>";
    162174
    163  $mysql->close();
     175 $sql->close();
    164176}
    165177
     
    171183 global $mangos_db, $realm_id;
    172184
    173  $mysql = new MySQL;
    174  $mysql->connect($mangos_db[$realm_id]['addr'], $mangos_db[$realm_id]['user'], $mangos_db[$realm_id]['pass'], $mangos_db[$realm_id]['name']);
    175  
    176  if(isset($_GET['id'])) $id = $mysql->quote_smart($_GET['id']);
     185 $sql = new SQL;
     186 $sql->connect($mangos_db[$realm_id]['addr'], $mangos_db[$realm_id]['user'], $mangos_db[$realm_id]['pass'], $mangos_db[$realm_id]['name']);
     187 
     188 if(isset($_GET['id'])) $id = $sql->quote_smart($_GET['id']);
    177189        else redirect("Location: tele.php?error=1");
    178190
    179  $mysql->query("DELETE FROM game_tele WHERE id = '$id'");
    180 
    181  if ($mysql->affected_rows() != 0) {
    182         $mysql->close();
    183         redirect("tele.php?error=3");
     191 $start = (isset($_GET['start'])) ? $sql->quote_smart($_GET['start']) : 0;
     192 $order_by = (isset($_GET['order_by'])) ? $sql->quote_smart($_GET['order_by']) : "id";
     193 $dir = (isset($_GET['dir'])) ? $sql->quote_smart($_GET['dir']) : 1;
     194 $dir = ($dir) ? 0 : 1;
     195 
     196 $sql->query("DELETE FROM game_tele WHERE id = '$id'");
     197
     198 if ($sql->affected_rows() != 0) {
     199        $sql->close();
     200        redirect("tele.php?error=3&order_by=$order_by&start=$start&dir=$dir");
    184201    } else {
    185          $mysql->close();
     202         $sql->close();
    186203         redirect("tele.php?error=5");
    187204        }
     
    195212 global  $lang_tele, $lang_global, $output, $mangos_db, $realm_id, $map_id;
    196213
    197  $mysql = new MySQL;
    198  $mysql->connect($mangos_db[$realm_id]['addr'], $mangos_db[$realm_id]['user'], $mangos_db[$realm_id]['pass'], $mangos_db[$realm_id]['name']);
    199  
    200  if(isset($_GET['id'])) $id = $mysql->quote_smart($_GET['id']);
     214 $sql = new SQL;
     215 $sql->connect($mangos_db[$realm_id]['addr'], $mangos_db[$realm_id]['user'], $mangos_db[$realm_id]['pass'], $mangos_db[$realm_id]['name']);
     216 
     217 if(isset($_GET['id'])) $id = $sql->quote_smart($_GET['id']);
    201218        else redirect("tele.php?error=1");
    202219
    203  $query = $mysql->query("SELECT id, name, map, position_x, position_y, position_z, orientation FROM game_tele WHERE id = '$id'");
    204 
    205  if ($mysql->num_rows($query) == 1) {
    206         $tele = $mysql->fetch_row($query);
     220 $query = $sql->query("SELECT id, name, map, position_x, position_y, position_z, orientation FROM game_tele WHERE id = '$id'");
     221
     222 if ($sql->num_rows($query) == 1) {
     223        $tele = $sql->fetch_row($query);
    207224
    208225        $output .= "<center>
     
    261278  } else error($lang_global['err_no_records_found']);
    262279 
    263  $mysql->close();
     280 $sql->close();
    264281}
    265282
     
    275292  redirect("tele.php?error=1");
    276293
    277  $mysql = new MySQL;
    278  $mysql->connect($mangos_db[$realm_id]['addr'], $mangos_db[$realm_id]['user'], $mangos_db[$realm_id]['pass'], $mangos_db[$realm_id]['name']);
    279  
    280  $id = $mysql->quote_smart($_GET['id']);
    281  $new_name = $mysql->quote_smart($_GET['new_name']);
    282  $new_map = $mysql->quote_smart($_GET['new_map']);
    283  $new_x = $mysql->quote_smart($_GET['new_x']);
    284  $new_y = $mysql->quote_smart($_GET['new_y']);
    285  $new_z = $mysql->quote_smart($_GET['new_z']);
    286  $new_orientation = $mysql->quote_smart($_GET['new_orientation']);
    287 
    288  $mysql->query("UPDATE game_tele SET position_x='$new_x', position_y ='$new_y', position_z ='$new_z', orientation ='$new_orientation', map ='$new_map', name ='$new_name' WHERE id = '$id'");
    289 
    290  if (mysql_affected_rows()) {
    291         $mysql->close();
     294 $sql = new SQL;
     295 $sql->connect($mangos_db[$realm_id]['addr'], $mangos_db[$realm_id]['user'], $mangos_db[$realm_id]['pass'], $mangos_db[$realm_id]['name']);
     296 
     297 $id = $sql->quote_smart($_GET['id']);
     298 $new_name = $sql->quote_smart($_GET['new_name']);
     299 $new_map = $sql->quote_smart($_GET['new_map']);
     300 $new_x = $sql->quote_smart($_GET['new_x']);
     301 $new_y = $sql->quote_smart($_GET['new_y']);
     302 $new_z = $sql->quote_smart($_GET['new_z']);
     303 $new_orientation = $sql->quote_smart($_GET['new_orientation']);
     304
     305 $sql->query("UPDATE game_tele SET position_x='$new_x', position_y ='$new_y', position_z ='$new_z', orientation ='$new_orientation', map ='$new_map', name ='$new_name' WHERE id = '$id'");
     306
     307 if ($sql->affected_rows()) {
     308        $sql->close();
    292309        redirect("tele.php?error=3");
    293310    } else {
    294                 $mysql->close();
     311                $sql->close();
    295312                redirect("tele.php?error=5");
    296313        }
     
    360377  redirect("tele.php?error=1");
    361378
    362  $mysql = new MySQL;
    363  $mysql->connect($mangos_db[$realm_id]['addr'], $mangos_db[$realm_id]['user'], $mangos_db[$realm_id]['pass'], $mangos_db[$realm_id]['name']);
    364 
    365  $name = $mysql->quote_smart($_GET['name']);
    366  $map = $mysql->quote_smart($_GET['map']);
    367  $x = $mysql->quote_smart($_GET['x']);
    368  $y = $mysql->quote_smart($_GET['y']);
    369  $z = $mysql->quote_smart($_GET['z']);
    370  $orientation = $mysql->quote_smart($_GET['orientation']);
    371 
    372  $mysql->query("INSERT INTO game_tele VALUES (NULL,'$x','$y', '$z' ,'$orientation' ,'$map' ,'$name')");
    373 
    374  if (mysql_affected_rows()) {
    375         $mysql->close();
     379 $sql = new SQL;
     380 $sql->connect($mangos_db[$realm_id]['addr'], $mangos_db[$realm_id]['user'], $mangos_db[$realm_id]['pass'], $mangos_db[$realm_id]['name']);
     381
     382 $name = $sql->quote_smart($_GET['name']);
     383 $map = $sql->quote_smart($_GET['map']);
     384 $x = $sql->quote_smart($_GET['x']);
     385 $y = $sql->quote_smart($_GET['y']);
     386 $z = $sql->quote_smart($_GET['z']);
     387 $orientation = $sql->quote_smart($_GET['orientation']);
     388
     389 $sql->query("INSERT INTO game_tele VALUES (NULL,'$x','$y', '$z' ,'$orientation' ,'$map' ,'$name')");
     390
     391 if ($sql->affected_rows()) {
     392        $sql->close();
    376393        redirect("tele.php?error=3");
    377394    } else {
    378                 $mysql->close();
     395                $sql->close();
    379396                redirect("tele.php?error=5");
    380397        }
Note: See TracChangeset for help on using the changeset viewer.