Changeset 19 for minimanager/game_object.php
- Timestamp:
- Aug 13, 2007, 9:05:34 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
minimanager/game_object.php
r5 r19 63 63 global $lang_global, $lang_game_object, $output, $mangos_db, $realm_id, $go_type; 64 64 65 $ mysql = new MySQL;66 $ mysql->connect($mangos_db[$realm_id]['addr'], $mangos_db[$realm_id]['user'], $mangos_db[$realm_id]['pass'], $mangos_db[$realm_id]['name']);67 68 $result = $ mysql->query("SELECT count(*) FROM gameobject_template");69 $tot_go = $ mysql->result($result, 0);70 $ mysql->close();65 $sql = new SQL; 66 $sql->connect($mangos_db[$realm_id]['addr'], $mangos_db[$realm_id]['user'], $mangos_db[$realm_id]['pass'], $mangos_db[$realm_id]['name']); 67 68 $result = $sql->query("SELECT count(*) FROM gameobject_template"); 69 $tot_go = $sql->result($result, 0); 70 $sql->close(); 71 71 72 72 $output .= "<center> … … 133 133 } 134 134 135 $ mysql = new MySQL;136 $ mysql->connect($mangos_db[$realm_id]['addr'], $mangos_db[$realm_id]['user'], $mangos_db[$realm_id]['pass'], $mangos_db[$realm_id]['name']);137 138 if ($_POST['entry'] != '') $entry = $ mysql->quote_smart($_POST['entry']);139 if ($_POST['name'] != '') $name = $ mysql->quote_smart($_POST['name']);140 if ($_POST['type'] != -1) $type = $ mysql->quote_smart($_POST['type']);141 if ($_POST['ScriptName'] != '') $ScriptName = $ mysql->quote_smart($_POST['ScriptName']);142 if ($_POST['displayId'] != '') $displayId = $ mysql->quote_smart($_POST['displayId']);143 if ($_POST['faction'] != '') $faction = $ mysql->quote_smart($_POST['faction']);144 if ($_POST['flags'] != '') $flags = $ mysql->quote_smart($_POST['flags']);145 if ($_POST['custom_search'] != '') $custom_search = $ mysql->quote_smart($_POST['custom_search']);135 $sql = new SQL; 136 $sql->connect($mangos_db[$realm_id]['addr'], $mangos_db[$realm_id]['user'], $mangos_db[$realm_id]['pass'], $mangos_db[$realm_id]['name']); 137 138 if ($_POST['entry'] != '') $entry = $sql->quote_smart($_POST['entry']); 139 if ($_POST['name'] != '') $name = $sql->quote_smart($_POST['name']); 140 if ($_POST['type'] != -1) $type = $sql->quote_smart($_POST['type']); 141 if ($_POST['ScriptName'] != '') $ScriptName = $sql->quote_smart($_POST['ScriptName']); 142 if ($_POST['displayId'] != '') $displayId = $sql->quote_smart($_POST['displayId']); 143 if ($_POST['faction'] != '') $faction = $sql->quote_smart($_POST['faction']); 144 if ($_POST['flags'] != '') $flags = $sql->quote_smart($_POST['flags']); 145 if ($_POST['custom_search'] != '') $custom_search = $sql->quote_smart($_POST['custom_search']); 146 146 else $custom_search = ""; 147 147 … … 158 158 if($where == "WHERE entry > 0 ") redirect("game_object.php?error=1"); 159 159 160 $result = $ mysql->query("SELECT entry, type, displayId, name, faction FROM gameobject_template $where ORDER BY entry LIMIT $sql_search_limit");161 $total_found = $ mysql->num_rows($result);160 $result = $sql->query("SELECT entry, type, displayId, name, faction FROM gameobject_template $where ORDER BY entry LIMIT $sql_search_limit"); 161 $total_found = $sql->num_rows($result); 162 162 163 163 $output .= "<center> … … 171 171 $output .= "<table class=\"lined\"> 172 172 <tr> 173 <t d width=\"10%\" class=\"head\">{$lang_game_object['entry']}</td>174 <t d width=\"40%\" class=\"head\">{$lang_game_object['name']}</td>175 <t d width=\"20%\" class=\"head\">{$lang_game_object['type']}</td>176 <t d width=\"15%\" class=\"head\">{$lang_game_object['displayId']}</td>177 <t d width=\"15%\" class=\"head\">{$lang_game_object['faction']}</td>173 <th width=\"10%\">{$lang_game_object['entry']}</th> 174 <th width=\"40%\">{$lang_game_object['name']}</th> 175 <th width=\"20%\">{$lang_game_object['type']}</th> 176 <th width=\"15%\">{$lang_game_object['displayId']}</th> 177 <th width=\"15%\">{$lang_game_object['faction']}</th> 178 178 </tr>"; 179 179 180 180 for ($i=1; $i<=$total_found; $i++){ 181 $go = $ mysql->fetch_row($result);181 $go = $sql->fetch_row($result); 182 182 183 183 $output .= "<tr> … … 191 191 $output .= "</table></center><br />"; 192 192 193 $ mysql->close();193 $sql->close(); 194 194 } 195 195 … … 364 364 if (!isset($_GET['entry'])) redirect("game_object.php?error=1"); 365 365 366 $ mysql = new MySQL;367 $ mysql->connect($mangos_db[$realm_id]['addr'], $mangos_db[$realm_id]['user'], $mangos_db[$realm_id]['pass'], $mangos_db[$realm_id]['name']);368 369 $entry = $ mysql->quote_smart($_GET['entry']);370 $result = $ mysql->query("SELECT * FROM gameobject_template WHERE entry = '$entry'");371 372 if ($go = $ mysql->fetch_assoc($result)){366 $sql = new SQL; 367 $sql->connect($mangos_db[$realm_id]['addr'], $mangos_db[$realm_id]['user'], $mangos_db[$realm_id]['pass'], $mangos_db[$realm_id]['name']); 368 369 $entry = $sql->quote_smart($_GET['entry']); 370 $result = $sql->query("SELECT * FROM gameobject_template WHERE entry = '$entry'"); 371 372 if ($go = $sql->fetch_assoc($result)){ 373 373 374 374 $output .= "<script type=\"text/javascript\" src=\"js/tab.js\"></script> … … 449 449 </table><br />"; 450 450 451 $result1 = $ mysql->query("SELECT COUNT(*) FROM gameobject WHERE id = '{$go['entry']}'");452 $output .= "<tr><td colspan=\"6\">{$lang_game_object['go_swapned']} : ".$ mysql->result($result1, 0)." {$lang_game_object['times']}.</td></tr>451 $result1 = $sql->query("SELECT COUNT(*) FROM gameobject WHERE id = '{$go['entry']}'"); 452 $output .= "<tr><td colspan=\"6\">{$lang_game_object['go_swapned']} : ".$sql->result($result1, 0)." {$lang_game_object['times']}.</td></tr> 453 453 454 454 <br /> … … 534 534 $row_flag = 0; 535 535 $output .= "<table class=\"hidden\" align=\"center\"><tr>"; 536 $result1 = $ mysql->query("SELECT item,ChanceOrRef,QuestChanceOrGroup,mincount,maxcount,quest_freeforall FROM gameobject_loot_template WHERE entry = {$go['entry']} ORDER BY ChanceOrRef DESC");537 while ($item = $ mysql->fetch_row($result1)){536 $result1 = $sql->query("SELECT item,ChanceOrRef,QuestChanceOrGroup,mincount,maxcount,quest_freeforall FROM gameobject_loot_template WHERE entry = {$go['entry']} ORDER BY ChanceOrRef DESC"); 537 while ($item = $sql->fetch_row($result1)){ 538 538 $cel_counter++; 539 539 $tooltip = get_item_name($item[0])." ($item[0])<br />{$lang_game_object['drop_chance']}: $item[1]%<br />{$lang_game_object['quest_drop_chance']}: $item[2]%<br />{$lang_game_object['drop_chance']}: $item[3]-$item[4]<br />{$lang_game_object['quest_freeforall']}: $item[5]"; … … 577 577 <tr class=\"large_bold\"><td colspan=\"2\" class=\"hidden\" align=\"left\">{$lang_game_object['start_quests']}:</td></tr>"; 578 578 579 $result1 = $ mysql->query("SELECT quest FROM gameobject_questrelation WHERE id = {$go['entry']}");580 while ($quest = $ mysql->fetch_row($result1)){581 $query1 = $ mysql->query("SELECT QuestLevel,Title FROM quest_template WHERE entry ='$quest[0]'");582 $quest_templ = $ mysql->fetch_row($query1);579 $result1 = $sql->query("SELECT quest FROM gameobject_questrelation WHERE id = {$go['entry']}"); 580 while ($quest = $sql->fetch_row($result1)){ 581 $query1 = $sql->query("SELECT QuestLevel,Title FROM quest_template WHERE entry ='$quest[0]'"); 582 $quest_templ = $sql->fetch_row($query1); 583 583 584 584 $output .= "<tr><td width=\"5%\"><input type=\"checkbox\" name=\"del_questrelation[]\" value=\"$quest[0]\" /></td> … … 592 592 <tr class=\"large_bold\"><td colspan=\"2\" class=\"hidden\" align=\"left\">{$lang_game_object['ends_quests']}:</td></tr>"; 593 593 594 $result1 = $ mysql->query("SELECT quest FROM gameobject_involvedrelation WHERE id = {$go['entry']}");595 while ($quest = $ mysql->fetch_row($result1)){596 $query1 = $ mysql->query("SELECT QuestLevel,Title FROM quest_template WHERE entry ='$quest[0]'");597 $quest_templ = $ mysql->fetch_row($query1);594 $result1 = $sql->query("SELECT quest FROM gameobject_involvedrelation WHERE id = {$go['entry']}"); 595 while ($quest = $sql->fetch_row($result1)){ 596 $query1 = $sql->query("SELECT QuestLevel,Title FROM quest_template WHERE entry ='$quest[0]'"); 597 $quest_templ = $sql->fetch_row($query1); 598 598 599 599 $output .= "<tr><td width=\"5%\"><input type=\"checkbox\" name=\"del_involvedrelation[]\" value=\"$quest[0]\" /></td> … … 626 626 </table></center>"; 627 627 628 $ mysql->close();628 $sql->close(); 629 629 } else { 630 $ mysql->close();630 $sql->close(); 631 631 error($lang_game_object['tmpl_not_found']); 632 632 exit(); … … 644 644 if (!isset($_POST['entry']) || $_POST['entry'] === '') redirect("game_object.php?error=1"); 645 645 646 $ mysql = new MySQL;647 $ mysql->connect($mangos_db[$realm_id]['addr'], $mangos_db[$realm_id]['user'], $mangos_db[$realm_id]['pass'], $mangos_db[$realm_id]['name']);648 649 $entry = $ mysql->quote_smart($_POST['entry']);650 if (isset($_POST['type']) && $_POST['type'] != '') $type = $ mysql->quote_smart($_POST['type']);646 $sql = new SQL; 647 $sql->connect($mangos_db[$realm_id]['addr'], $mangos_db[$realm_id]['user'], $mangos_db[$realm_id]['pass'], $mangos_db[$realm_id]['name']); 648 649 $entry = $sql->quote_smart($_POST['entry']); 650 if (isset($_POST['type']) && $_POST['type'] != '') $type = $sql->quote_smart($_POST['type']); 651 651 else $type = 0; 652 if (isset($_POST['displayId']) && $_POST['displayId'] != '') $displayId = $ mysql->quote_smart($_POST['displayId']);652 if (isset($_POST['displayId']) && $_POST['displayId'] != '') $displayId = $sql->quote_smart($_POST['displayId']); 653 653 else $displayId = 0; 654 if (isset($_POST['name']) && $_POST['name'] != '') $name = $ mysql->quote_smart($_POST['name']);654 if (isset($_POST['name']) && $_POST['name'] != '') $name = $sql->quote_smart($_POST['name']); 655 655 else $name = ""; 656 if (isset($_POST['faction']) && $_POST['faction'] != '') $faction = $ mysql->quote_smart($_POST['faction']);656 if (isset($_POST['faction']) && $_POST['faction'] != '') $faction = $sql->quote_smart($_POST['faction']); 657 657 else $faction = 0; 658 if (isset($_POST['flags']) && $_POST['flags'] != '') $flags = $ mysql->quote_smart($_POST['flags']);658 if (isset($_POST['flags']) && $_POST['flags'] != '') $flags = $sql->quote_smart($_POST['flags']); 659 659 else $flags = 0; 660 if (isset($_POST['size']) && $_POST['size'] != '') $size = $ mysql->quote_smart($_POST['size']);660 if (isset($_POST['size']) && $_POST['size'] != '') $size = $sql->quote_smart($_POST['size']); 661 661 else $size = 0; 662 if (isset($_POST['ScriptName']) && $_POST['ScriptName'] != '') $ScriptName = $ mysql->quote_smart($_POST['ScriptName']);662 if (isset($_POST['ScriptName']) && $_POST['ScriptName'] != '') $ScriptName = $sql->quote_smart($_POST['ScriptName']); 663 663 else $ScriptName = ""; 664 if (isset($_POST['sound0']) && $_POST['sound0'] != '') $sound0 = $ mysql->quote_smart($_POST['sound0']);664 if (isset($_POST['sound0']) && $_POST['sound0'] != '') $sound0 = $sql->quote_smart($_POST['sound0']); 665 665 else $sound0 = 0; 666 if (isset($_POST['sound1']) && $_POST['sound1'] != '') $sound1 = $ mysql->quote_smart($_POST['sound1']);666 if (isset($_POST['sound1']) && $_POST['sound1'] != '') $sound1 = $sql->quote_smart($_POST['sound1']); 667 667 else $sound1 = 0; 668 if (isset($_POST['sound2']) && $_POST['sound2'] != '') $sound2 = $ mysql->quote_smart($_POST['sound2']);668 if (isset($_POST['sound2']) && $_POST['sound2'] != '') $sound2 = $sql->quote_smart($_POST['sound2']); 669 669 else $sound2 = 0; 670 if (isset($_POST['sound3']) && $_POST['sound3'] != '') $sound3 = $ mysql->quote_smart($_POST['sound3']);670 if (isset($_POST['sound3']) && $_POST['sound3'] != '') $sound3 = $sql->quote_smart($_POST['sound3']); 671 671 else $sound3 = 0; 672 if (isset($_POST['sound4']) && $_POST['sound4'] != '') $sound4 = $ mysql->quote_smart($_POST['sound4']);672 if (isset($_POST['sound4']) && $_POST['sound4'] != '') $sound4 = $sql->quote_smart($_POST['sound4']); 673 673 else $sound4 = 0; 674 if (isset($_POST['sound5']) && $_POST['sound5'] != '') $sound5 = $ mysql->quote_smart($_POST['sound5']);674 if (isset($_POST['sound5']) && $_POST['sound5'] != '') $sound5 = $sql->quote_smart($_POST['sound5']); 675 675 else $sound5 = 0; 676 if (isset($_POST['sound6']) && $_POST['sound6'] != '') $sound6 = $ mysql->quote_smart($_POST['sound6']);676 if (isset($_POST['sound6']) && $_POST['sound6'] != '') $sound6 = $sql->quote_smart($_POST['sound6']); 677 677 else $sound6 = 0; 678 if (isset($_POST['sound7']) && $_POST['sound7'] != '') $sound7 = $ mysql->quote_smart($_POST['sound7']);678 if (isset($_POST['sound7']) && $_POST['sound7'] != '') $sound7 = $sql->quote_smart($_POST['sound7']); 679 679 else $sound7 = 0; 680 if (isset($_POST['sound8']) && $_POST['sound8'] != '') $sound8 = $ mysql->quote_smart($_POST['sound8']);680 if (isset($_POST['sound8']) && $_POST['sound8'] != '') $sound8 = $sql->quote_smart($_POST['sound8']); 681 681 else $sound8 = 0; 682 if (isset($_POST['sound9']) && $_POST['sound9'] != '') $sound9 = $ mysql->quote_smart($_POST['sound9']);682 if (isset($_POST['sound9']) && $_POST['sound9'] != '') $sound9 = $sql->quote_smart($_POST['sound9']); 683 683 else $sound9 = 0; 684 if (isset($_POST['sound10']) && $_POST['sound10'] != '') $sound10 = $ mysql->quote_smart($_POST['sound10']);684 if (isset($_POST['sound10']) && $_POST['sound10'] != '') $sound10 = $sql->quote_smart($_POST['sound10']); 685 685 else $sound10 = 0; 686 if (isset($_POST['sound11']) && $_POST['sound11'] != '') $sound11 = $ mysql->quote_smart($_POST['sound11']);686 if (isset($_POST['sound11']) && $_POST['sound11'] != '') $sound11 = $sql->quote_smart($_POST['sound11']); 687 687 else $sound11 = 0; 688 if (isset($_POST['sound12']) && $_POST['sound12'] != '') $sound12 = $ mysql->quote_smart($_POST['sound12']);688 if (isset($_POST['sound12']) && $_POST['sound12'] != '') $sound12 = $sql->quote_smart($_POST['sound12']); 689 689 else $sound12 = 0; 690 if (isset($_POST['sound13']) && $_POST['sound13'] != '') $sound13 = $ mysql->quote_smart($_POST['sound13']);690 if (isset($_POST['sound13']) && $_POST['sound13'] != '') $sound13 = $sql->quote_smart($_POST['sound13']); 691 691 else $sound13 = 0; 692 if (isset($_POST['sound14']) && $_POST['sound14'] != '') $sound14 = $ mysql->quote_smart($_POST['sound14']);692 if (isset($_POST['sound14']) && $_POST['sound14'] != '') $sound14 = $sql->quote_smart($_POST['sound14']); 693 693 else $sound14 = 0; 694 if (isset($_POST['sound15']) && $_POST['sound15'] != '') $sound15 = $ mysql->quote_smart($_POST['sound15']);694 if (isset($_POST['sound15']) && $_POST['sound15'] != '') $sound15 = $sql->quote_smart($_POST['sound15']); 695 695 else $sound15 = 0; 696 if (isset($_POST['sound16']) && $_POST['sound16'] != '') $sound16 = $ mysql->quote_smart($_POST['sound16']);696 if (isset($_POST['sound16']) && $_POST['sound16'] != '') $sound16 = $sql->quote_smart($_POST['sound16']); 697 697 else $sound16 = 0; 698 if (isset($_POST['sound17']) && $_POST['sound17'] != '') $sound17 = $ mysql->quote_smart($_POST['sound17']);698 if (isset($_POST['sound17']) && $_POST['sound17'] != '') $sound17 = $sql->quote_smart($_POST['sound17']); 699 699 else $sound17 = 0; 700 if (isset($_POST['sound18']) && $_POST['sound18'] != '') $sound18 = $ mysql->quote_smart($_POST['sound18']);700 if (isset($_POST['sound18']) && $_POST['sound18'] != '') $sound18 = $sql->quote_smart($_POST['sound18']); 701 701 else $sound18 = 0; 702 if (isset($_POST['sound19']) && $_POST['sound19'] != '') $sound19 = $ mysql->quote_smart($_POST['sound19']);702 if (isset($_POST['sound19']) && $_POST['sound19'] != '') $sound19 = $sql->quote_smart($_POST['sound19']); 703 703 else $sound19 = 0; 704 if (isset($_POST['sound20']) && $_POST['sound20'] != '') $sound20 = $ mysql->quote_smart($_POST['sound20']);704 if (isset($_POST['sound20']) && $_POST['sound20'] != '') $sound20 = $sql->quote_smart($_POST['sound20']); 705 705 else $sound20 = 0; 706 if (isset($_POST['sound21']) && $_POST['sound21'] != '') $sound21 = $ mysql->quote_smart($_POST['sound21']);706 if (isset($_POST['sound21']) && $_POST['sound21'] != '') $sound21 = $sql->quote_smart($_POST['sound21']); 707 707 else $sound21 = 0; 708 if (isset($_POST['sound22']) && $_POST['sound22'] != '') $sound22 = $ mysql->quote_smart($_POST['sound22']);708 if (isset($_POST['sound22']) && $_POST['sound22'] != '') $sound22 = $sql->quote_smart($_POST['sound22']); 709 709 else $sound22 = 0; 710 if (isset($_POST['sound23']) && $_POST['sound23'] != '') $sound23 = $ mysql->quote_smart($_POST['sound23']);710 if (isset($_POST['sound23']) && $_POST['sound23'] != '') $sound23 = $sql->quote_smart($_POST['sound23']); 711 711 else $sound23 = 0; 712 712 713 if (isset($_POST['ChanceOrRef']) && $_POST['ChanceOrRef'] != '') $ChanceOrRef = $ mysql->quote_smart($_POST['ChanceOrRef']);713 if (isset($_POST['ChanceOrRef']) && $_POST['ChanceOrRef'] != '') $ChanceOrRef = $sql->quote_smart($_POST['ChanceOrRef']); 714 714 else $ChanceOrRef = 0; 715 if (isset($_POST['QuestChanceOrGroup']) && $_POST['QuestChanceOrGroup'] != '') $QuestChanceOrGroup = $ mysql->quote_smart($_POST['QuestChanceOrGroup']);715 if (isset($_POST['QuestChanceOrGroup']) && $_POST['QuestChanceOrGroup'] != '') $QuestChanceOrGroup = $sql->quote_smart($_POST['QuestChanceOrGroup']); 716 716 else $QuestChanceOrGroup = 0; 717 if (isset($_POST['mincount']) && $_POST['mincount'] != '') $mincount = $ mysql->quote_smart($_POST['mincount']);717 if (isset($_POST['mincount']) && $_POST['mincount'] != '') $mincount = $sql->quote_smart($_POST['mincount']); 718 718 else $mincount = 0; 719 if (isset($_POST['maxcount']) && $_POST['maxcount'] != '') $maxcount = $ mysql->quote_smart($_POST['maxcount']);719 if (isset($_POST['maxcount']) && $_POST['maxcount'] != '') $maxcount = $sql->quote_smart($_POST['maxcount']); 720 720 else $maxcount = 0; 721 if (isset($_POST['quest_freeforall']) && $_POST['quest_freeforall'] != '') $quest_freeforall = $ mysql->quote_smart($_POST['quest_freeforall']);721 if (isset($_POST['quest_freeforall']) && $_POST['quest_freeforall'] != '') $quest_freeforall = $sql->quote_smart($_POST['quest_freeforall']); 722 722 else $quest_freeforall = 0; 723 if (isset($_POST['item']) && $_POST['item'] != '') $item = $ mysql->quote_smart($_POST['item']);723 if (isset($_POST['item']) && $_POST['item'] != '') $item = $sql->quote_smart($_POST['item']); 724 724 else $item = 0; 725 if (isset($_POST['del_loot_items']) && $_POST['del_loot_items'] != '') $del_loot_items = $ mysql->quote_smart($_POST['del_loot_items']);725 if (isset($_POST['del_loot_items']) && $_POST['del_loot_items'] != '') $del_loot_items = $sql->quote_smart($_POST['del_loot_items']); 726 726 else $del_loot_items = NULL; 727 727 728 if (isset($_POST['involvedrelation']) && $_POST['involvedrelation'] != '') $involvedrelation = $ mysql->quote_smart($_POST['involvedrelation']);728 if (isset($_POST['involvedrelation']) && $_POST['involvedrelation'] != '') $involvedrelation = $sql->quote_smart($_POST['involvedrelation']); 729 729 else $involvedrelation = 0; 730 if (isset($_POST['del_involvedrelation']) && $_POST['del_involvedrelation'] != '') $del_involvedrelation = $ mysql->quote_smart($_POST['del_involvedrelation']);730 if (isset($_POST['del_involvedrelation']) && $_POST['del_involvedrelation'] != '') $del_involvedrelation = $sql->quote_smart($_POST['del_involvedrelation']); 731 731 else $del_involvedrelation = NULL; 732 if (isset($_POST['questrelation']) && $_POST['questrelation'] != '') $questrelation = $ mysql->quote_smart($_POST['questrelation']);732 if (isset($_POST['questrelation']) && $_POST['questrelation'] != '') $questrelation = $sql->quote_smart($_POST['questrelation']); 733 733 else $questrelation = 0; 734 if (isset($_POST['del_questrelation']) && $_POST['del_questrelation'] != '') $del_questrelation = $ mysql->quote_smart($_POST['del_questrelation']);734 if (isset($_POST['del_questrelation']) && $_POST['del_questrelation'] != '') $del_questrelation = $sql->quote_smart($_POST['del_questrelation']); 735 735 else $del_questrelation = NULL; 736 736 737 737 if ($_POST['opp_type'] == "add_new"){ 738 $sql = "INSERT INTO gameobject_template ( entry, type, displayId, name, faction, flags, size, sound0, sound1,738 $sql_query = "INSERT INTO gameobject_template ( entry, type, displayId, name, faction, flags, size, sound0, sound1, 739 739 sound2, sound3, sound4, sound5, sound6, sound7, sound8, sound9, sound10, sound11, sound12, sound13, 740 740 sound14, sound15, sound16, sound17, sound18, sound19, sound20, sound21, sound22, sound23, ScriptName ) … … 746 746 } elseif ($_POST['opp_type'] == "edit"){ 747 747 748 $sql = "UPDATE gameobject_template SET ";749 750 $result = $ mysql->query("SELECT * FROM gameobject_template WHERE entry = '$entry'");751 if ($go_templ = $ mysql->fetch_assoc($result)){752 if ($go_templ['type'] != $type) $sql .= "type='$type',";753 if ($go_templ['displayId'] != $displayId) $sql .= "displayId='$displayId',";754 if ($go_templ['name'] != $name) $sql .= "name='$name',";755 if ($go_templ['faction'] != $faction) $sql .= "faction='$faction',";756 if ($go_templ['flags'] != $flags) $sql .= "flags='$flags',";757 if ($go_templ['size'] != $size) $sql .= "size='$size',";758 if ($go_templ['sound0'] != $sound0) $sql .= "sound0='$sound0',";759 if ($go_templ['sound1'] != $sound1) $sql .= "sound1='$sound1',";760 if ($go_templ['sound2'] != $sound2) $sql .= "sound2='$sound2',";761 if ($go_templ['sound3'] != $sound3) $sql .= "sound3='$sound3',";762 if ($go_templ['sound4'] != $sound4) $sql .= "sound4='$sound4',";763 if ($go_templ['sound5'] != $sound5) $sql .= "sound5='$sound5',";764 if ($go_templ['sound6'] != $sound6) $sql .= "sound6='$sound6',";765 if ($go_templ['sound7'] != $sound7) $sql .= "sound7='$sound7',";766 if ($go_templ['sound8'] != $sound8) $sql .= "sound8='$sound8',";767 if ($go_templ['sound9'] != $sound9) $sql .= "sound9='$sound9',";768 if ($go_templ['sound10'] != $sound10) $sql .= "sound10='$sound10',";769 if ($go_templ['sound11'] != $sound11) $sql .= "sound11='$sound11',";770 if ($go_templ['sound12'] != $sound12) $sql .= "sound12='$sound12',";771 if ($go_templ['sound13'] != $sound13) $sql .= "sound13='$sound13',";772 if ($go_templ['sound14'] != $sound14) $sql .= "sound14='$sound14',";773 if ($go_templ['sound15'] != $sound15) $sql .= "sound15='$sound15',";774 if ($go_templ['sound16'] != $sound16) $sql .= "sound16='$sound16',";775 if ($go_templ['sound17'] != $sound17) $sql .= "sound17='$sound17',";776 if ($go_templ['sound18'] != $sound18) $sql .= "sound18='$sound18',";777 if ($go_templ['sound19'] != $sound19) $sql .= "sound19='$sound19',";778 if ($go_templ['sound20'] != $sound20) $sql .= "sound20='$sound20',";779 if ($go_templ['sound21'] != $sound21) $sql .= "sound21='$sound21',";780 if ($go_templ['sound22'] != $sound22) $sql .= "sound22='$sound22',";781 if ($go_templ['sound23'] != $sound23) $sql .= "sound23='$sound23',";782 if ($go_templ['ScriptName'] != $ScriptName) $sql .= "ScriptName='$ScriptName',";783 784 $ mysql->free_result($result);748 $sql_query = "UPDATE gameobject_template SET "; 749 750 $result = $sql->query("SELECT * FROM gameobject_template WHERE entry = '$entry'"); 751 if ($go_templ = $sql->fetch_assoc($result)){ 752 if ($go_templ['type'] != $type) $sql_query .= "type='$type',"; 753 if ($go_templ['displayId'] != $displayId) $sql_query .= "displayId='$displayId',"; 754 if ($go_templ['name'] != $name) $sql_query .= "name='$name',"; 755 if ($go_templ['faction'] != $faction) $sql_query .= "faction='$faction',"; 756 if ($go_templ['flags'] != $flags) $sql_query .= "flags='$flags',"; 757 if ($go_templ['size'] != $size) $sql_query .= "size='$size',"; 758 if ($go_templ['sound0'] != $sound0) $sql_query .= "sound0='$sound0',"; 759 if ($go_templ['sound1'] != $sound1) $sql_query .= "sound1='$sound1',"; 760 if ($go_templ['sound2'] != $sound2) $sql_query .= "sound2='$sound2',"; 761 if ($go_templ['sound3'] != $sound3) $sql_query .= "sound3='$sound3',"; 762 if ($go_templ['sound4'] != $sound4) $sql_query .= "sound4='$sound4',"; 763 if ($go_templ['sound5'] != $sound5) $sql_query .= "sound5='$sound5',"; 764 if ($go_templ['sound6'] != $sound6) $sql_query .= "sound6='$sound6',"; 765 if ($go_templ['sound7'] != $sound7) $sql_query .= "sound7='$sound7',"; 766 if ($go_templ['sound8'] != $sound8) $sql_query .= "sound8='$sound8',"; 767 if ($go_templ['sound9'] != $sound9) $sql_query .= "sound9='$sound9',"; 768 if ($go_templ['sound10'] != $sound10) $sql_query .= "sound10='$sound10',"; 769 if ($go_templ['sound11'] != $sound11) $sql_query .= "sound11='$sound11',"; 770 if ($go_templ['sound12'] != $sound12) $sql_query .= "sound12='$sound12',"; 771 if ($go_templ['sound13'] != $sound13) $sql_query .= "sound13='$sound13',"; 772 if ($go_templ['sound14'] != $sound14) $sql_query .= "sound14='$sound14',"; 773 if ($go_templ['sound15'] != $sound15) $sql_query .= "sound15='$sound15',"; 774 if ($go_templ['sound16'] != $sound16) $sql_query .= "sound16='$sound16',"; 775 if ($go_templ['sound17'] != $sound17) $sql_query .= "sound17='$sound17',"; 776 if ($go_templ['sound18'] != $sound18) $sql_query .= "sound18='$sound18',"; 777 if ($go_templ['sound19'] != $sound19) $sql_query .= "sound19='$sound19',"; 778 if ($go_templ['sound20'] != $sound20) $sql_query .= "sound20='$sound20',"; 779 if ($go_templ['sound21'] != $sound21) $sql_query .= "sound21='$sound21',"; 780 if ($go_templ['sound22'] != $sound22) $sql_query .= "sound22='$sound22',"; 781 if ($go_templ['sound23'] != $sound23) $sql_query .= "sound23='$sound23',"; 782 if ($go_templ['ScriptName'] != $ScriptName) $sql_query .= "ScriptName='$ScriptName',"; 783 784 $sql->free_result($result); 785 785 unset($go_templ); 786 787 if (($sql == "UPDATE gameobject_template SET ")&&(!$item)&&(!$del_loot_items)786 787 if (($sql_query == "UPDATE gameobject_template SET ")&&(!$item)&&(!$del_loot_items) 788 788 &&(!$del_questrelation)&&(!$questrelation)&&(!$del_involvedrelation)&&(!$involvedrelation)){ 789 $ mysql->close();789 $sql->close(); 790 790 redirect("game_object.php?action=edit&entry=$entry&error=6"); 791 791 } else { 792 if ($sql != "UPDATE gameobject_template SET "){793 $sql [strlen($sql)-1] = " ";794 $sql .= " WHERE entry = '$entry';\n";795 } else $sql = "";792 if ($sql_query != "UPDATE gameobject_template SET "){ 793 $sql_query[strlen($sql_query)-1] = " "; 794 $sql_query .= " WHERE entry = '$entry';\n"; 795 } else $sql_query = ""; 796 796 } 797 797 798 798 if ($item){ 799 $sql .= "INSERT INTO gameobject_loot_template (entry, item, ChanceOrRef, QuestChanceOrGroup, mincount, maxcount, quest_freeforall)799 $sql_query .= "INSERT INTO gameobject_loot_template (entry, item, ChanceOrRef, QuestChanceOrGroup, mincount, maxcount, quest_freeforall) 800 800 VALUES ($entry,$item,'$ChanceOrRef', '$QuestChanceOrGroup' ,$mincount ,$maxcount ,$quest_freeforall);\n"; 801 801 } … … 803 803 if ($del_loot_items){ 804 804 foreach($del_loot_items as $item_id) 805 $sql .= "DELETE FROM gameobject_loot_template WHERE entry = $entry AND item = $item_id;\n";805 $sql_query .= "DELETE FROM gameobject_loot_template WHERE entry = $entry AND item = $item_id;\n"; 806 806 } 807 807 808 808 if ($questrelation){ 809 $sql .= "INSERT INTO gameobject_questrelation (id, quest) VALUES ($entry,$questrelation);\n";809 $sql_query .= "INSERT INTO gameobject_questrelation (id, quest) VALUES ($entry,$questrelation);\n"; 810 810 } 811 811 812 812 if ($involvedrelation){ 813 $sql .= "INSERT INTO gameobject_involvedrelation (id, quest) VALUES ($entry,$involvedrelation);\n";813 $sql_query .= "INSERT INTO gameobject_involvedrelation (id, quest) VALUES ($entry,$involvedrelation);\n"; 814 814 } 815 815 816 816 if ($del_questrelation){ 817 817 foreach($del_questrelation as $quest_id) 818 $sql .= "DELETE FROM gameobject_questrelation WHERE id = $entry AND quest = $quest_id;\n";818 $sql_query .= "DELETE FROM gameobject_questrelation WHERE id = $entry AND quest = $quest_id;\n"; 819 819 } 820 820 821 821 if ($del_involvedrelation){ 822 822 foreach($del_involvedrelation as $quest_id) 823 $sql .= "DELETE FROM gameobject_involvedrelation WHERE id = $entry AND quest = $quest_id;\n";823 $sql_query .= "DELETE FROM gameobject_involvedrelation WHERE id = $entry AND quest = $quest_id;\n"; 824 824 } 825 825 826 826 827 827 } else { 828 $ mysql->close();828 $sql->close(); 829 829 redirect("game_object.php?error=5"); 830 830 } 831 831 } else { 832 $ mysql->close();832 $sql->close(); 833 833 redirect("game_object.php?error=5"); 834 834 } 835 835 836 836 if ( isset($_POST['backup_op']) && ($_POST['backup_op'] == 1) ){ 837 $ mysql->close();837 $sql->close(); 838 838 Header("Content-type: application/octet-stream"); 839 839 Header("Content-Disposition: attachment; filename=goid_$entry.sql"); 840 echo $sql ;840 echo $sql_query; 841 841 exit(); 842 842 redirect("game_object.php?action=edit&entry=$entry&error=4"); 843 843 } else { 844 $sql = explode(';',$sql);845 foreach($sql as $tmp_query) if(($tmp_query)&&($tmp_query != "\n")) $result = $mysql->query($tmp_query);846 $ mysql->close();844 $sql_query = explode(';',$sql_query); 845 foreach($sql_query as $tmp_query) if(($tmp_query)&&($tmp_query != "\n")) $result = $sql->query($tmp_query); 846 $sql->close(); 847 847 } 848 848 … … 884 884 else redirect("game_object.php?error=1"); 885 885 886 $ mysql = new MySQL;887 $ mysql->connect($mangos_db[$realm_id]['addr'], $mangos_db[$realm_id]['user'], $mangos_db[$realm_id]['pass'], $mangos_db[$realm_id]['name']);888 889 $result = $ mysql->query("SELECT guid FROM gameobject WHERE id = '$entry'");890 while ($guid = $ mysql->fetch_row($result)){891 $result = $ mysql->query("DELETE FROM gameobject_respawn WHERE guid = '$guid'");886 $sql = new SQL; 887 $sql->connect($mangos_db[$realm_id]['addr'], $mangos_db[$realm_id]['user'], $mangos_db[$realm_id]['pass'], $mangos_db[$realm_id]['name']); 888 889 $result = $sql->query("SELECT guid FROM gameobject WHERE id = '$entry'"); 890 while ($guid = $sql->fetch_row($result)){ 891 $result = $sql->query("DELETE FROM gameobject_respawn WHERE guid = '$guid'"); 892 892 } 893 $ mysql->query("DELETE FROM gameobject_involvedrelation WHERE id = '$entry'");894 $ mysql->query("DELETE FROM gameobject_questrelation WHERE id = '$entry'");895 $ mysql->query("DELETE FROM gameobject_loot_template WHERE entry = '$entry'");896 $ mysql->query("DELETE FROM gameobject_template WHERE entry = '$entry'");897 898 $ mysql->close();893 $sql->query("DELETE FROM gameobject_involvedrelation WHERE id = '$entry'"); 894 $sql->query("DELETE FROM gameobject_questrelation WHERE id = '$entry'"); 895 $sql->query("DELETE FROM gameobject_loot_template WHERE entry = '$entry'"); 896 $sql->query("DELETE FROM gameobject_template WHERE entry = '$entry'"); 897 898 $sql->close(); 899 899 redirect("game_object.php"); 900 900 } … … 910 910 else redirect("game_object.php?error=1"); 911 911 912 $ mysql = new MySQL;913 $ mysql->connect($mangos_db[$realm_id]['addr'], $mangos_db[$realm_id]['user'], $mangos_db[$realm_id]['pass'], $mangos_db[$realm_id]['name']);914 $ mysql->query("DELETE FROM gameobject WHERE id = '$entry'");915 $ mysql->close();912 $sql = new SQL; 913 $sql->connect($mangos_db[$realm_id]['addr'], $mangos_db[$realm_id]['user'], $mangos_db[$realm_id]['pass'], $mangos_db[$realm_id]['name']); 914 $sql->query("DELETE FROM gameobject WHERE id = '$entry'"); 915 $sql->close(); 916 916 redirect("game_object.php?action=edit&entry=$entry&error=4"); 917 917 }
Note:
See TracChangeset
for help on using the changeset viewer.