Changeset 19 for minimanager/tele.php
- Timestamp:
- Aug 13, 2007, 9:05:34 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
minimanager/tele.php
r5 r19 19 19 global $lang_tele, $lang_global, $output, $mangos_db, $realm_id, $itemperpage; 20 20 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; 28 28 $order_dir = ($dir) ? "ASC" : "DESC"; 29 29 $dir = ($dir) ? 0 : 1; 30 30 31 31 //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, orientation32 $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 35 35 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); 37 37 38 38 //==========================top tage navigaion starts here======================== … … 58 58 //==========================top tage navigaion ENDS here ======================== 59 59 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&order_by=$order_by&start=$start&dir=$dir&id='; 65 </script> 66 <table class=\"lined\"> 61 67 <tr> 62 <t d width=\"5%\" class=\"head\">{$lang_global['delete']}</td>63 <t d width=\"5%\" class=\"head\"><a href=\"tele.php?order_by=id&start=$start&dir=$dir\" class=\"head_link\">{$lang_tele['id']}</a></td>64 <t d width=\"28%\" class=\"head\"><a href=\"tele.php?order_by=name&start=$start&dir=$dir\" class=\"head_link\">{$lang_tele['name']}</a></td>65 <t d width=\"22%\" class=\"head\"><a href=\"tele.php?order_by=map&start=$start&dir=$dir\" class=\"head_link\">{$lang_tele['map']}</a></td>66 <t d width=\"9%\" class=\"head\"><a href=\"tele.php?order_by=position_x&start=$start&dir=$dir\" class=\"head_link\">{$lang_tele['x']}</a></td>67 <t d width=\"9%\" class=\"head\"><a href=\"tele.php?order_by=position_y&start=$start&dir=$dir\" class=\"head_link\">{$lang_tele['y']}</a></td>68 <t d width=\"9%\" class=\"head\"><a href=\"tele.php?order_by=position_z&start=$start&dir=$dir\" class=\"head_link\">{$lang_tele['z']}</a></td>69 <t d width=\"10%\" class=\"head\"><a href=\"tele.php?order_by=orientation&start=$start&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&start=$start&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&start=$start&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&start=$start&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&start=$start&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&start=$start&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&start=$start&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&start=$start&dir=$dir\">".($order_by=='orientation' ? "<img src=\"img/arr_".($dir ? "up" : "dw").".gif\" /> " : "")."{$lang_tele['orientation']}</a></th> 70 76 </tr>"; 71 77 72 while ($data = $ mysql->fetch_row($query)){78 while ($data = $sql->fetch_row($query)){ 73 79 $output .= "<tr> 74 <td>< a href=\"tele.php?action=del_tele&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> 75 81 <td>$data[0]</td> 76 82 <td><a href=\"tele.php?action=edit_tele&id=$data[0]\">$data[1]</a></td> … … 86 92 </table></center>"; 87 93 88 $ mysql->close();94 $sql->close(); 89 95 } 90 96 … … 98 104 if(empty($_GET['search_value']) || empty($_GET['search_by'])) redirect("guild.php?error=2"); 99 105 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; 108 114 $order_dir = ($dir) ? "ASC" : "DESC"; 109 115 $dir = ($dir) ? 0 : 1; 110 116 111 $query = $ mysql->query("SELECT id, name, map, position_x, position_y, position_z, orientation117 $query = $sql->query("SELECT id, name, map, position_x, position_y, position_z, orientation 112 118 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); 114 120 115 121 //==========================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&order_by=$order_by&dir=$dir&id='; 127 </script> 128 <center><table class=\"top_hidden\"> 117 129 <tr><td>"; 118 130 makebutton($lang_tele['add_new'], "tele.php?action=add_tele",90); … … 133 145 $output .= "<table class=\"lined\"> 134 146 <tr> 135 <t d width=\"5%\" class=\"head\">{$lang_global['delete']}</td>136 <t d width=\"5%\" class=\"head\"><a href=\"tele.php?action=search&error=4&order_by=id&search_by=$search_by&search_value=$search_value&dir=$dir\" class=\"head_link\">{$lang_tele['id']}</a></td>137 <t d width=\"28%\" class=\"head\"><a href=\"tele.php?action=search&error=4&order_by=name&search_by=$search_by&search_value=$search_value&dir=$dir\" class=\"head_link\">{$lang_tele['name']}</a></td>138 <t d width=\"22%\" class=\"head\"><a href=\"tele.php?action=search&error=4&order_by=map&search_by=$search_by&search_value=$search_value&dir=$dir\" class=\"head_link\">{$lang_tele['map']}</a></td>139 <t d width=\"9%\" class=\"head\"><a href=\"tele.php?action=search&error=4&order_by=position_x&search_by=$search_by&search_value=$search_value&dir=$dir\" class=\"head_link\">{$lang_tele['x']}</a></td>140 <t d width=\"9%\" class=\"head\"><a href=\"tele.php?action=search&error=4&order_by=position_y&search_by=$search_by&search_value=$search_value&dir=$dir\" class=\"head_link\">{$lang_tele['y']}</a></td>141 <t d width=\"9%\" class=\"head\"><a href=\"tele.php?action=search&error=4&order_by=position_z&search_by=$search_by&search_value=$search_value&dir=$dir\" class=\"head_link\">{$lang_tele['z']}</a></td>142 <t d width=\"10%\" class=\"head\"><a href=\"tele.php?action=search&error=4&order_by=orientation&search_by=$search_by&search_value=$search_value&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&error=4&order_by=id&search_by=$search_by&search_value=$search_value&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&error=4&order_by=name&search_by=$search_by&search_value=$search_value&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&error=4&order_by=map&search_by=$search_by&search_value=$search_value&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&error=4&order_by=position_x&search_by=$search_by&search_value=$search_value&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&error=4&order_by=position_y&search_by=$search_by&search_value=$search_value&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&error=4&order_by=position_z&search_by=$search_by&search_value=$search_value&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&error=4&order_by=orientation&search_by=$search_by&search_value=$search_value&dir=$dir\">".($order_by=='orientation' ? "<img src=\"img/arr_".($dir ? "up" : "dw").".gif\" /> " : "")."{$lang_tele['orientation']}</a></th> 143 155 </tr>"; 144 156 145 while ($data = $ mysql->fetch_row($query)){157 while ($data = $sql->fetch_row($query)){ 146 158 $output .= "<tr> 147 <td>< a href=\"tele.php?action=del_tele&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> 148 160 <td>$data[0]</td> 149 161 <td><a href=\"tele.php?action=edit_tele&id=$data[0]\">$data[1]</a></td> … … 161 173 </table></center>"; 162 174 163 $ mysql->close();175 $sql->close(); 164 176 } 165 177 … … 171 183 global $mangos_db, $realm_id; 172 184 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']); 177 189 else redirect("Location: tele.php?error=1"); 178 190 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"); 184 201 } else { 185 $ mysql->close();202 $sql->close(); 186 203 redirect("tele.php?error=5"); 187 204 } … … 195 212 global $lang_tele, $lang_global, $output, $mangos_db, $realm_id, $map_id; 196 213 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']); 201 218 else redirect("tele.php?error=1"); 202 219 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); 207 224 208 225 $output .= "<center> … … 261 278 } else error($lang_global['err_no_records_found']); 262 279 263 $ mysql->close();280 $sql->close(); 264 281 } 265 282 … … 275 292 redirect("tele.php?error=1"); 276 293 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(); 292 309 redirect("tele.php?error=3"); 293 310 } else { 294 $ mysql->close();311 $sql->close(); 295 312 redirect("tele.php?error=5"); 296 313 } … … 360 377 redirect("tele.php?error=1"); 361 378 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(); 376 393 redirect("tele.php?error=3"); 377 394 } else { 378 $ mysql->close();395 $sql->close(); 379 396 redirect("tele.php?error=5"); 380 397 }
Note:
See TracChangeset
for help on using the changeset viewer.