Changeset 19 for minimanager/ticket.php
- Timestamp:
- Aug 13, 2007, 9:05:34 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
minimanager/ticket.php
r5 r19 31 31 function browse_tickets() { 32 32 global $lang_global, $lang_ticket, $output, $mangos_db, $realm_id, $itemperpage, $ticket_type; 33 $itemperpage = 2; 34 $ mysql = new MySQL;35 $ mysql->connect($mangos_db[$realm_id]['addr'], $mangos_db[$realm_id]['user'], $mangos_db[$realm_id]['pass'], $mangos_db[$realm_id]['name']);36 37 $start = (isset($_GET['start'])) ? $ mysql->quote_smart($_GET['start']) : 0;38 39 $order_by = (isset($_GET['order_by'])) ? $ mysql->quote_smart($_GET['order_by']) : "ticket_id";40 $dir = (isset($_GET['dir'])) ? $ mysql->quote_smart($_GET['dir']) : 1;33 34 $sql = new SQL; 35 $sql->connect($mangos_db[$realm_id]['addr'], $mangos_db[$realm_id]['user'], $mangos_db[$realm_id]['pass'], $mangos_db[$realm_id]['name']); 36 37 $start = (isset($_GET['start'])) ? $sql->quote_smart($_GET['start']) : 0; 38 39 $order_by = (isset($_GET['order_by'])) ? $sql->quote_smart($_GET['order_by']) : "ticket_id"; 40 $dir = (isset($_GET['dir'])) ? $sql->quote_smart($_GET['dir']) : 1; 41 41 $order_dir = ($dir) ? "ASC" : "DESC"; 42 42 $dir = ($dir) ? 0 : 1; 43 43 44 44 //get total number of items 45 $query_1 = $ mysql->query("SELECT count(*) FROM character_ticket");46 $all_record = $ mysql->result($query_1,0);47 48 $query = $ mysql->query("SELECT character_ticket.ticket_id, character_ticket.guid,SUBSTRING_INDEX(character_ticket.ticket_text,' ',6),45 $query_1 = $sql->query("SELECT count(*) FROM character_ticket"); 46 $all_record = $sql->result($query_1,0); 47 48 $query = $sql->query("SELECT character_ticket.ticket_id, character_ticket.guid,SUBSTRING_INDEX(character_ticket.ticket_text,' ',6), 49 49 character_ticket.ticket_category,`character`.name 50 50 FROM character_ticket,`character` … … 52 52 WHERE character_ticket.guid = `character`.`guid` 53 53 ORDER BY $order_by $order_dir LIMIT $start, $itemperpage"); 54 $this_page = $ mysql->num_rows($query);54 $this_page = $sql->num_rows($query); 55 55 56 56 $output .="<script type=\"text/javascript\" src=\"js/check.js\"></script> … … 65 65 <table class=\"lined\"> 66 66 <tr> 67 <t d width=\"5%\" class=\"head\"><input name=\"allbox\" type=\"checkbox\" value=\"Check All\" onclick=\"CheckAll(document.form);\" /></td>68 <t d width=\"5%\" class=\"head\">{$lang_global['edit']}</td>69 <t d width=\"8%\" class=\"head\"><a href=\"ticket.php?order_by=ticket_id&start=$start&dir=$dir\" class=\"head_link\">{$lang_ticket['id']}</a></td>70 <t d width=\"15%\" class=\"head\"><a href=\"ticket.php?order_by=guid&start=$start&dir=$dir\" class=\"head_link\">{$lang_ticket['sender']}</a></td>71 <t d width=\"55%\" class=\"head\"><a href=\"ticket.php?order_by=ticket_text&start=$start&dir=$dir\" class=\"head_link\">{$lang_ticket['ticket_text']}</a></td>72 <t d width=\"13%\" class=\"head\"><a href=\"ticket.php?order_by=ticket_category&start=$start&dir=$dir\" class=\"head_link\">{$lang_ticket['category']}</a></td>67 <th width=\"5%\"><input name=\"allbox\" type=\"checkbox\" value=\"Check All\" onclick=\"CheckAll(document.form);\" /></th> 68 <th width=\"5%\">{$lang_global['edit']}</th> 69 <th width=\"8%\"><a href=\"ticket.php?order_by=ticket_id&start=$start&dir=$dir\">".($order_by=='ticket_id' ? "<img src=\"img/arr_".($dir ? "up" : "dw").".gif\" /> " : "")."{$lang_ticket['id']}</a></th> 70 <th width=\"15%\"><a href=\"ticket.php?order_by=guid&start=$start&dir=$dir\">".($order_by=='guid' ? "<img src=\"img/arr_".($dir ? "up" : "dw").".gif\" /> " : "")."{$lang_ticket['sender']}</a></th> 71 <th width=\"55%\">{$lang_ticket['ticket_text']}</th> 72 <th width=\"13%\"><a href=\"ticket.php?order_by=ticket_category&start=$start&dir=$dir\">".($order_by=='ticket_category' ? "<img src=\"img/arr_".($dir ? "up" : "dw").".gif\" /> " : "")."{$lang_ticket['category']}</a></tthd> 73 73 </tr>"; 74 74 75 while ($ticket = $ mysql->fetch_row($query)){75 while ($ticket = $sql->fetch_row($query)){ 76 76 $output .= "<tr> 77 77 <td><input type=\"checkbox\" name=\"check[]\" value=\"$ticket[0]\" onclick=\"CheckCheckAll(document.form);\" /></td> … … 94 94 </form><br /></center>"; 95 95 96 $ mysql->close();96 $sql->close(); 97 97 } 98 98 … … 104 104 global $lang_global, $mangos_db, $realm_id; 105 105 106 $ mysql = new MySQL;107 $ mysql->connect($mangos_db[$realm_id]['addr'], $mangos_db[$realm_id]['user'], $mangos_db[$realm_id]['pass'], $mangos_db[$realm_id]['name']);108 109 if(isset($_GET['check'])) $check = $ mysql->quote_smart($_GET['check']);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 if(isset($_GET['check'])) $check = $sql->quote_smart($_GET['check']); 110 110 else redirect("ticket.php?error=1"); 111 111 … … 114 114 for ($i=0; $i<count($check); $i++) { 115 115 if ($check[$i] != "" ) { 116 $query = $ mysql->query("DELETE FROM character_ticket WHERE ticket_id = '$check[$i]'");116 $query = $sql->query("DELETE FROM character_ticket WHERE ticket_id = '$check[$i]'"); 117 117 $deleted_tickets++; 118 118 } 119 119 } 120 120 121 $ mysql->close();121 $sql->close(); 122 122 123 123 if ($deleted_tickets == 0) redirect("ticket.php?error=3"); … … 132 132 global $lang_global, $lang_ticket, $output, $mangos_db, $realm_id, $ticket_type; 133 133 134 $ mysql = new MySQL;135 $ mysql->connect($mangos_db[$realm_id]['addr'], $mangos_db[$realm_id]['user'], $mangos_db[$realm_id]['pass'], $mangos_db[$realm_id]['name']);136 137 if(isset($_GET['id'])) $id = $ mysql->quote_smart($_GET['id']);134 $sql = new SQL; 135 $sql->connect($mangos_db[$realm_id]['addr'], $mangos_db[$realm_id]['user'], $mangos_db[$realm_id]['pass'], $mangos_db[$realm_id]['name']); 136 137 if(isset($_GET['id'])) $id = $sql->quote_smart($_GET['id']); 138 138 else redirect("ticket.php?error=1"); 139 139 140 $query = $ mysql->query("SELECT character_ticket.guid, character_ticket.ticket_text,140 $query = $sql->query("SELECT character_ticket.guid, character_ticket.ticket_text, 141 141 character_ticket.ticket_category,`character`.name 142 142 FROM character_ticket,`character` … … 144 144 WHERE character_ticket.guid = `character`.`guid` AND character_ticket.ticket_id = '$id'"); 145 145 146 if ($ticket = $ mysql->fetch_row($query)) {146 if ($ticket = $sql->fetch_row($query)) { 147 147 $output .= "<center> 148 148 <fieldset style=\"width: 550px;\"> … … 189 189 } else error($lang_global['err_no_records_found']); 190 190 191 $ mysql->close();191 $sql->close(); 192 192 } 193 193 … … 203 203 } 204 204 205 $ mysql = new MySQL;206 $ mysql->connect($mangos_db[$realm_id]['addr'], $mangos_db[$realm_id]['user'], $mangos_db[$realm_id]['pass'], $mangos_db[$realm_id]['name']);207 208 $new_category = $ mysql->quote_smart($_POST['new_category']);209 $new_text = $ mysql->quote_smart($_POST['new_text']);210 $id = $ mysql->quote_smart($_POST['id']);211 212 $query = $ mysql->query("UPDATE character_ticket SET ticket_text='$new_text', ticket_category ='$new_category' WHERE ticket_id = '$id'");213 214 if ( mysql_affected_rows()) {215 $ mysql->close();205 $sql = new SQL; 206 $sql->connect($mangos_db[$realm_id]['addr'], $mangos_db[$realm_id]['user'], $mangos_db[$realm_id]['pass'], $mangos_db[$realm_id]['name']); 207 208 $new_category = $sql->quote_smart($_POST['new_category']); 209 $new_text = $sql->quote_smart($_POST['new_text']); 210 $id = $sql->quote_smart($_POST['id']); 211 212 $query = $sql->query("UPDATE character_ticket SET ticket_text='$new_text', ticket_category ='$new_category' WHERE ticket_id = '$id'"); 213 214 if ($sql->affected_rows()) { 215 $sql->close(); 216 216 redirect("ticket.php?error=5"); 217 217 } else { 218 $ mysql->close();218 $sql->close(); 219 219 redirect("ticket.php?error=6"); 220 220 }
Note:
See TracChangeset
for help on using the changeset viewer.