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/creature.php

    r5 r19  
    5151 global $lang_global, $lang_creature, $output, $mangos_db, $realm_id, $creature_type;
    5252
    53  $mysql = new MySQL;
    54  $mysql->connect($mangos_db[$realm_id]['addr'], $mangos_db[$realm_id]['user'], $mangos_db[$realm_id]['pass'], $mangos_db[$realm_id]['name']);
    55 
    56  $result = $mysql->query("SELECT count(*) FROM creature_template");
    57  $tot_items = $mysql->result($result, 0);
    58  $mysql->close();
     53 $sql = new SQL;
     54 $sql->connect($mangos_db[$realm_id]['addr'], $mangos_db[$realm_id]['user'], $mangos_db[$realm_id]['pass'], $mangos_db[$realm_id]['name']);
     55
     56 $result = $sql->query("SELECT count(*) FROM creature_template");
     57 $tot_items = $sql->result($result, 0);
     58 $sql->close();
    5959
    6060 $output .= "<center>
     
    195195        }
    196196
    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 ($_POST['npcflag'] != '') $npcflag = $mysql->quote_smart($_POST['npcflag']);
    201 if ($_POST['type'] != '') $type = $mysql->quote_smart($_POST['type']);
    202 if ($_POST['rank'] != '') $rank = $mysql->quote_smart($_POST['rank']);
    203 if ($_POST['family'] != '') $family = $mysql->quote_smart($_POST['family']);
    204 if ($_POST['entry'] != '') $entry = $mysql->quote_smart($_POST['entry']);
    205 if ($_POST['name'] != '') $name = $mysql->quote_smart($_POST['name']);
    206 if ($_POST['level'] != '') $level = $mysql->quote_smart($_POST['level']);
    207 if ($_POST['health'] != '') $health = $mysql->quote_smart($_POST['health']);
    208 if ($_POST['faction'] != '') $faction = $mysql->quote_smart($_POST['faction']);
    209 if ($_POST['spell'] != '') $spell = $mysql->quote_smart($_POST['spell']);
    210 if ($_POST['lootid'] != '') $lootid = $mysql->quote_smart($_POST['lootid']);
    211 if ($_POST['ScriptName'] != '') $ScriptName = $mysql->quote_smart($_POST['ScriptName']);
    212 if ($_POST['custom_search'] != '') $custom_search = $mysql->quote_smart($_POST['custom_search']);
     197$sql = new SQL;
     198$sql->connect($mangos_db[$realm_id]['addr'], $mangos_db[$realm_id]['user'], $mangos_db[$realm_id]['pass'], $mangos_db[$realm_id]['name']);
     199
     200if ($_POST['npcflag'] != '') $npcflag = $sql->quote_smart($_POST['npcflag']);
     201if ($_POST['type'] != '') $type = $sql->quote_smart($_POST['type']);
     202if ($_POST['rank'] != '') $rank = $sql->quote_smart($_POST['rank']);
     203if ($_POST['family'] != '') $family = $sql->quote_smart($_POST['family']);
     204if ($_POST['entry'] != '') $entry = $sql->quote_smart($_POST['entry']);
     205if ($_POST['name'] != '') $name = $sql->quote_smart($_POST['name']);
     206if ($_POST['level'] != '') $level = $sql->quote_smart($_POST['level']);
     207if ($_POST['health'] != '') $health = $sql->quote_smart($_POST['health']);
     208if ($_POST['faction'] != '') $faction = $sql->quote_smart($_POST['faction']);
     209if ($_POST['spell'] != '') $spell = $sql->quote_smart($_POST['spell']);
     210if ($_POST['lootid'] != '') $lootid = $sql->quote_smart($_POST['lootid']);
     211if ($_POST['ScriptName'] != '') $ScriptName = $sql->quote_smart($_POST['ScriptName']);
     212if ($_POST['custom_search'] != '') $custom_search = $sql->quote_smart($_POST['custom_search']);
    213213        else $custom_search = "";
    214214
     
    230230 if($where == "WHERE entry > 0 ") redirect("creature.php?error=1");
    231231
    232  $result = $mysql->query("SELECT entry,name,maxlevel,maxhealth,rank,npcflag FROM creature_template $where ORDER BY entry LIMIT $sql_search_limit");
    233  $total_found = $mysql->num_rows($result);
     232 $result = $sql->query("SELECT entry,name,maxlevel,maxhealth,rank,npcflag FROM creature_template $where ORDER BY entry LIMIT $sql_search_limit");
     233 $total_found = $sql->num_rows($result);
    234234
    235235  $output .= "<center>
     
    243243  $output .= "<table class=\"lined\">
    244244   <tr>
    245         <td width=\"10%\" class=\"head\">{$lang_creature['entry']}</td>
    246         <td width=\"40%\" class=\"head\">{$lang_creature['name']}</td>
    247         <td width=\"10%\" class=\"head\">{$lang_creature['level']}</td>
    248         <td width=\"10%\" class=\"head\">{$lang_creature['health']}</td>
    249         <td width=\"10%\" class=\"head\">{$lang_creature['rank']}</td>
    250         <td width=\"20%\" class=\"head\">{$lang_creature['npc_flag']}</td>
     245        <th width=\"10%\">{$lang_creature['entry']}</th>
     246        <th width=\"40%\">{$lang_creature['name']}</th>
     247        <th width=\"10%\">{$lang_creature['level']}</th>
     248        <th width=\"10%\">{$lang_creature['health']}</th>
     249        <th width=\"10%\">{$lang_creature['rank']}</th>
     250        <th width=\"20%\">{$lang_creature['npc_flag']}</th>
    251251  </tr>";
    252252
    253253 for ($i=1; $i<=$total_found; $i++){
    254   $creature = $mysql->fetch_row($result);
     254  $creature = $sql->fetch_row($result);
    255255
    256256  $output .= "<tr>
     
    265265  $output .= "</table></center><br />";
    266266
    267  $mysql->close();
     267 $sql->close();
    268268}
    269269
     
    597597       
    598598<td>".makeinfocell($lang_creature['class'],$lang_creature['class_desc'])."</td>
    599            <td colspan=\"2\"><select name=\"class\">
     599           <td><select name=\"class\">
    600600                <option value=\"0\">0 - {$lang_creature['none']}</option>
    601601                <option value=\"1\">1 - {$lang_id_tab['warrior']}</option>
     
    611611
    612612<td>".makeinfocell($lang_creature['race'],$lang_creature['race_desc'])."</td>
    613            <td colspan=\"2\"><select name=\"race\">
     613           <td><select name=\"race\">
    614614                <option value=\"0\">0 - {$lang_creature['none']}</option>
    615615                <option value=\"1\">1 - {$lang_id_tab['human']}</option>
     
    623623                <option value=\"10\">10 - {$lang_id_tab['bloodelf']}</option>
    624624                <option value=\"11\">11 - {$lang_id_tab['draenei']}</option>
    625            </select></td>   
     625           </select></td>
     626           
     627 <td>".makeinfocell($lang_creature['RacialLeader'],$lang_creature['RacialLeader_desc'])."</td>
     628 <td><input type=\"checkbox\" name=\"RacialLeader\" value=\"1\" /></td>
    626629</tr>
    627630<tr>
     
    681684 if (!isset($_GET['entry'])) redirect("creature.php?error=1");
    682685       
    683  $mysql = new MySQL;
    684  $mysql->connect($mangos_db[$realm_id]['addr'], $mangos_db[$realm_id]['user'], $mangos_db[$realm_id]['pass'], $mangos_db[$realm_id]['name']);
    685  
    686  $entry = $mysql->quote_smart($_GET['entry']);
    687  $result = $mysql->query("SELECT * FROM creature_template WHERE entry = '$entry'");
    688 
    689  if ($mob = $mysql->fetch_assoc($result)){
     686 $sql = new SQL;
     687 $sql->connect($mangos_db[$realm_id]['addr'], $mangos_db[$realm_id]['user'], $mangos_db[$realm_id]['pass'], $mangos_db[$realm_id]['name']);
     688 
     689 $entry = $sql->quote_smart($_GET['entry']);
     690 $result = $sql->query("SELECT * FROM creature_template WHERE entry = '$entry'");
     691
     692 if ($mob = $sql->fetch_assoc($result)){
    690693
    691694  $output .= "<script type=\"text/javascript\" src=\"js/tab.js\"></script>
     
    935938  unset($family);
    936939 
    937 $result1 = $mysql->query("SELECT COUNT(*) FROM creature WHERE id = '{$mob['entry']}'");
    938 $output .= "<tr><td colspan=\"6\">{$lang_creature['creature_swapned']} : ".$mysql->result($result1, 0)." {$lang_creature['times']}.</td></tr>
     940$result1 = $sql->query("SELECT COUNT(*) FROM creature WHERE id = '{$mob['entry']}'");
     941$output .= "<tr><td colspan=\"6\">{$lang_creature['creature_swapned']} : ".$sql->result($result1, 0)." {$lang_creature['times']}.</td></tr>
    939942
    940943</table>
     
    10951098 
    10961099$output .= "<td>".makeinfocell($lang_creature['class'],$lang_creature['class_desc'])."</td>
    1097            <td colspan=\"2\"><select name=\"class\">
     1100           <td><select name=\"class\">
    10981101                <option value=\"0\" {$class[0]}>0 - {$lang_creature['none']}</option>
    10991102                <option value=\"1\" {$class[1]}>1 - {$lang_id_tab['warrior']}</option>
     
    11121115 $race[$mob['race']] = " selected=\"selected\" ";
    11131116 
    1114 $output .= "<td>".makeinfocell($lang_creature['race'],$lang_creature['race_desc'])."</td>
    1115            <td colspan=\"2\"><select name=\"race\">
     1117 $output .= "<td>".makeinfocell($lang_creature['race'],$lang_creature['race_desc'])."</td>
     1118           <td><select name=\"race\">
    11161119                <option value=\"0\" {$race[0]}>0 - {$lang_creature['none']}</option>
    11171120                <option value=\"1\" {$race[1]}>1 - {$lang_id_tab['human']}</option>
     
    11251128                <option value=\"10\" {$race[10]}>10 - {$lang_id_tab['bloodelf']}</option>
    11261129                <option value=\"11\" {$race[11]}>11 - {$lang_id_tab['draenei']}</option>
    1127            </select></td>   
     1130           </select></td>";
     1131
     1132 if ($mob['RacialLeader']) $RacialLeader = "checked";
     1133        else $RacialLeader = "";
     1134       
     1135$output .= "<td>".makeinfocell($lang_creature['RacialLeader'],$lang_creature['RacialLeader_desc'])."</td>
     1136        <td><input type=\"checkbox\" name=\"RacialLeader\" value=\"1\" $RacialLeader /></td>
    11281137</tr>
    11291138<tr>
     
    11761185        $row_flag = 0;
    11771186        $output .= "<table class=\"hidden\" align=\"center\"><tr>";
    1178         $result1 = $mysql->query("SELECT item,ChanceOrRef,QuestChanceOrGroup,mincount,maxcount,quest_freeforall FROM creature_loot_template WHERE entry = {$mob['lootid']} ORDER BY ChanceOrRef DESC");
    1179         while ($item = $mysql->fetch_row($result1)){
     1187        $result1 = $sql->query("SELECT item,ChanceOrRef,QuestChanceOrGroup,mincount,maxcount,quest_freeforall FROM creature_loot_template WHERE entry = {$mob['lootid']} ORDER BY ChanceOrRef DESC");
     1188        while ($item = $sql->fetch_row($result1)){
    11801189                $cel_counter++;
    11811190                $tooltip = get_item_name($item[0])." ($item[0])<br />{$lang_creature['drop_chance']}: $item[1]%<br />{$lang_creature['quest_drop_chance']}: $item[2]%<br />{$lang_creature['drop_chance']}: $item[3]-$item[4]<br />{$lang_creature['quest_freeforall']}: $item[5]";
     
    12201229        <tr class=\"large_bold\"><td colspan=\"2\" class=\"hidden\" align=\"left\">{$lang_creature['start_quests']}:</td></tr>";
    12211230
    1222         $result1 = $mysql->query("SELECT quest FROM creature_questrelation WHERE id = {$mob['entry']}");
    1223         while ($quest = $mysql->fetch_row($result1)){
    1224                 $query1 = $mysql->query("SELECT QuestLevel,Title FROM quest_template WHERE entry ='$quest[0]'");
    1225                 $quest_templ = $mysql->fetch_row($query1);
     1231        $result1 = $sql->query("SELECT quest FROM creature_questrelation WHERE id = {$mob['entry']}");
     1232        while ($quest = $sql->fetch_row($result1)){
     1233                $query1 = $sql->query("SELECT QuestLevel,Title FROM quest_template WHERE entry ='$quest[0]'");
     1234                $quest_templ = $sql->fetch_row($query1);
    12261235               
    12271236                $output .= "<tr><td width=\"5%\"><input type=\"checkbox\" name=\"del_questrelation[]\" value=\"$quest[0]\" /></td>
     
    12351244<tr class=\"large_bold\"><td colspan=\"2\" class=\"hidden\" align=\"left\">{$lang_creature['ends_quests']}:</td></tr>";
    12361245
    1237         $result1 = $mysql->query("SELECT quest FROM creature_involvedrelation WHERE id = {$mob['entry']}");
    1238         while ($quest = $mysql->fetch_row($result1)){
    1239                 $query1 = $mysql->query("SELECT QuestLevel,Title FROM quest_template WHERE entry ='$quest[0]'");
    1240                 $quest_templ = $mysql->fetch_row($query1);
     1246        $result1 = $sql->query("SELECT quest FROM creature_involvedrelation WHERE id = {$mob['entry']}");
     1247        while ($quest = $sql->fetch_row($result1)){
     1248                $query1 = $sql->query("SELECT QuestLevel,Title FROM quest_template WHERE entry ='$quest[0]'");
     1249                $quest_templ = $sql->fetch_row($query1);
    12411250               
    12421251                $output .= "<tr><td width=\"5%\"><input type=\"checkbox\" name=\"del_involvedrelation[]\" value=\"$quest[0]\" /></td>
     
    12611270        $row_flag = 0;
    12621271        $output .= "<table class=\"hidden\" align=\"center\"><tr>";
    1263         $result1 = $mysql->query("SELECT item, maxcount, incrtime FROM npc_vendor WHERE entry = {$mob['entry']}");
    1264         while ($item = $mysql->fetch_row($result1)){
     1272        $result1 = $sql->query("SELECT item, maxcount, incrtime FROM npc_vendor WHERE entry = {$mob['entry']}");
     1273        while ($item = $sql->fetch_row($result1)){
    12651274                $cel_counter++;
    12661275                if (!$item[1]) $count = "{$lang_creature['unlimited']}";
     
    13031312        $row_flag = 0;
    13041313        $output .= "<table class=\"hidden\" align=\"center\"><tr>";
    1305         $result1 = $mysql->query("SELECT spell, spellcost, reqskill, reqskillvalue, reqlevel FROM npc_trainer WHERE entry = {$mob['entry']} ORDER BY reqlevel");
    1306         while ($spell = $mysql->fetch_row($result1)){
     1314        $result1 = $sql->query("SELECT spell, spellcost, reqskill, reqskillvalue, reqlevel FROM npc_trainer WHERE entry = {$mob['entry']} ORDER BY reqlevel");
     1315        while ($spell = $sql->fetch_row($result1)){
    13071316                $cel_counter++;
    13081317                $tooltip = "{$lang_creature['spell_id']} : $spell[0]<br />{$lang_creature['cost']} :  $spell[1](c)<br />{$lang_creature['req_skill']} : $spell[2]<br />{$lang_creature['req_skill_lvl']} :  $spell[3]<br />{$lang_creature['req_level']} $spell[4]";
     
    13501359        $row_flag = 0;
    13511360        $output .= "<table class=\"hidden\" align=\"center\"><tr>";
    1352         $result1 = $mysql->query("SELECT item,ChanceOrRef,QuestChanceOrGroup,mincount,maxcount,quest_freeforall FROM skinning_loot_template WHERE entry = {$mob['skinloot']} ORDER BY ChanceOrRef DESC");
    1353         while ($item = $mysql->fetch_row($result1)){
     1361        $result1 = $sql->query("SELECT item,ChanceOrRef,QuestChanceOrGroup,mincount,maxcount,quest_freeforall FROM skinning_loot_template WHERE entry = {$mob['skinloot']} ORDER BY ChanceOrRef DESC");
     1362        while ($item = $sql->fetch_row($result1)){
    13541363                $cel_counter++;
    13551364                $tooltip = get_item_name($item[0])." ($item[0])<br />{$lang_creature['drop_chance']}: $item[1]%<br />{$lang_creature['quest_drop_chance']}: $item[2]%<br />{$lang_creature['drop_chance']}: $item[3]-$item[4]<br />{$lang_creature['quest_freeforall']}: $item[5]";
     
    13991408        $row_flag = 0;
    14001409        $output .= "<table class=\"hidden\" align=\"center\"><tr>";
    1401         $result1 = $mysql->query("SELECT item,ChanceOrRef,QuestChanceOrGroup,mincount,maxcount,quest_freeforall FROM pickpocketing_loot_template WHERE entry = {$mob['pickpocketloot']} ORDER BY ChanceOrRef DESC");
    1402         while ($item = $mysql->fetch_row($result1)){
     1410        $result1 = $sql->query("SELECT item,ChanceOrRef,QuestChanceOrGroup,mincount,maxcount,quest_freeforall FROM pickpocketing_loot_template WHERE entry = {$mob['pickpocketloot']} ORDER BY ChanceOrRef DESC");
     1411        while ($item = $sql->fetch_row($result1)){
    14031412                $cel_counter++;
    14041413                $tooltip = get_item_name($item[0])." ($item[0])<br />{$lang_creature['drop_chance']}: $item[1]%<br />{$lang_creature['quest_drop_chance']}: $item[2]%<br />{$lang_creature['drop_chance']}: $item[3]-$item[4]<br />{$lang_creature['quest_freeforall']}: $item[5]";
     
    14551464        </table></center>";
    14561465
    1457  $mysql->close();
     1466 $sql->close();
    14581467 } else {
    1459                 $mysql->close();
     1468                $sql->close();
    14601469                error($lang_creature['item_not_found']);
    14611470                exit();
     
    14731482 if (!isset($_POST['entry']) || $_POST['entry'] === '') redirect("creature.php?error=1");
    14741483 
    1475  $mysql = new MySQL;
    1476  $mysql->connect($mangos_db[$realm_id]['addr'], $mangos_db[$realm_id]['user'], $mangos_db[$realm_id]['pass'], $mangos_db[$realm_id]['name']);
    1477 
    1478  $entry = $mysql->quote_smart($_POST['entry']);
    1479  if (isset($_POST['modelid_m']) && $_POST['modelid_m'] != '') $modelid_m = $mysql->quote_smart($_POST['modelid_m']);
     1484 $sql = new SQL;
     1485 $sql->connect($mangos_db[$realm_id]['addr'], $mangos_db[$realm_id]['user'], $mangos_db[$realm_id]['pass'], $mangos_db[$realm_id]['name']);
     1486
     1487 $entry = $sql->quote_smart($_POST['entry']);
     1488 if (isset($_POST['modelid_m']) && $_POST['modelid_m'] != '') $modelid_m = $sql->quote_smart($_POST['modelid_m']);
    14801489        else $modelid_m = 0;
    1481  if (isset($_POST['modelid_f']) && $_POST['modelid_f'] != '') $modelid_f = $mysql->quote_smart($_POST['modelid_f']);
     1490 if (isset($_POST['modelid_f']) && $_POST['modelid_f'] != '') $modelid_f = $sql->quote_smart($_POST['modelid_f']);
    14821491        else $modelid_f = 0;
    1483  if (isset($_POST['name']) && $_POST['name'] != '') $name = $mysql->quote_smart($_POST['name']);
     1492 if (isset($_POST['name']) && $_POST['name'] != '') $name = $sql->quote_smart($_POST['name']);
    14841493        else $name = "";
    1485  if (isset($_POST['subname']) && $_POST['subname'] != '') $subname = $mysql->quote_smart($_POST['subname']);
     1494 if (isset($_POST['subname']) && $_POST['subname'] != '') $subname = $sql->quote_smart($_POST['subname']);
    14861495        else $subname = "";
    1487  if (isset($_POST['minlevel']) && $_POST['minlevel'] != '') $minlevel = $mysql->quote_smart($_POST['minlevel']);
     1496 if (isset($_POST['minlevel']) && $_POST['minlevel'] != '') $minlevel = $sql->quote_smart($_POST['minlevel']);
    14881497        else $minlevel = 0;
    1489  if (isset($_POST['maxlevel']) && $_POST['maxlevel'] != '') $maxlevel = $mysql->quote_smart($_POST['maxlevel']);
     1498 if (isset($_POST['maxlevel']) && $_POST['maxlevel'] != '') $maxlevel = $sql->quote_smart($_POST['maxlevel']);
    14901499        else $maxlevel = 0;
    1491  if (isset($_POST['minhealth']) && $_POST['minhealth'] != '') $minhealth = $mysql->quote_smart($_POST['minhealth']);
     1500 if (isset($_POST['minhealth']) && $_POST['minhealth'] != '') $minhealth = $sql->quote_smart($_POST['minhealth']);
    14921501        else $minhealth = 0;
    1493  if (isset($_POST['maxhealth']) && $_POST['maxhealth'] != '') $maxhealth = $mysql->quote_smart($_POST['maxhealth']);
     1502 if (isset($_POST['maxhealth']) && $_POST['maxhealth'] != '') $maxhealth = $sql->quote_smart($_POST['maxhealth']);
    14941503        else $maxhealth = 0;
    1495  if (isset($_POST['minmana']) && $_POST['minmana'] != '') $minmana = $mysql->quote_smart($_POST['minmana']);
     1504 if (isset($_POST['minmana']) && $_POST['minmana'] != '') $minmana = $sql->quote_smart($_POST['minmana']);
    14961505        else $minmana = 0;
    1497  if (isset($_POST['maxmana']) && $_POST['maxmana'] != '') $maxmana = $mysql->quote_smart($_POST['maxmana']);
     1506 if (isset($_POST['maxmana']) && $_POST['maxmana'] != '') $maxmana = $sql->quote_smart($_POST['maxmana']);
    14981507        else $maxmana = 0;
    1499  if (isset($_POST['armor']) && $_POST['armor'] != '') $armor = $mysql->quote_smart($_POST['armor']);
     1508 if (isset($_POST['armor']) && $_POST['armor'] != '') $armor = $sql->quote_smart($_POST['armor']);
    15001509        else $armor = 0;
    1501  if (isset($_POST['faction']) && $_POST['faction'] != '') $faction = $mysql->quote_smart($_POST['faction']);
     1510 if (isset($_POST['faction']) && $_POST['faction'] != '') $faction = $sql->quote_smart($_POST['faction']);
    15021511        else $faction = 0;
    1503  if (isset($_POST['npcflag'])) $npcflag = $mysql->quote_smart($_POST['npcflag']);
     1512 if (isset($_POST['npcflag'])) $npcflag = $sql->quote_smart($_POST['npcflag']);
    15041513        else $npcflag = 0;
    1505  if (isset($_POST['speed']) && $_POST['speed'] != '') $speed = $mysql->quote_smart($_POST['speed']);
     1514 if (isset($_POST['speed']) && $_POST['speed'] != '') $speed = $sql->quote_smart($_POST['speed']);
    15061515        else $speed = 0;
    1507  if (isset($_POST['rank']) && $_POST['rank'] != '') $rank = $mysql->quote_smart($_POST['rank']);
     1516 if (isset($_POST['rank']) && $_POST['rank'] != '') $rank = $sql->quote_smart($_POST['rank']);
    15081517        else $rank = 0;
    1509  if (isset($_POST['mindmg']) && $_POST['mindmg'] != '') $mindmg = $mysql->quote_smart($_POST['mindmg']);
     1518 if (isset($_POST['mindmg']) && $_POST['mindmg'] != '') $mindmg = $sql->quote_smart($_POST['mindmg']);
    15101519        else $mindmg = 0;
    1511  if (isset($_POST['maxdmg']) && $_POST['maxdmg'] != '') $maxdmg = $mysql->quote_smart($_POST['maxdmg']);
     1520 if (isset($_POST['maxdmg']) && $_POST['maxdmg'] != '') $maxdmg = $sql->quote_smart($_POST['maxdmg']);
    15121521        else $maxdmg = 0;
    1513  if (isset($_POST['attackpower']) && $_POST['attackpower'] != '') $attackpower = $mysql->quote_smart($_POST['attackpower']);
     1522 if (isset($_POST['attackpower']) && $_POST['attackpower'] != '') $attackpower = $sql->quote_smart($_POST['attackpower']);
    15141523        else $attackpower = 0;
    1515  if (isset($_POST['baseattacktime']) && $_POST['baseattacktime'] != '') $baseattacktime = $mysql->quote_smart($_POST['baseattacktime']);
     1524 if (isset($_POST['baseattacktime']) && $_POST['baseattacktime'] != '') $baseattacktime = $sql->quote_smart($_POST['baseattacktime']);
    15161525        else $baseattacktime = 0;
    1517  if (isset($_POST['rangeattacktime']) && $_POST['rangeattacktime'] != '') $rangeattacktime = $mysql->quote_smart($_POST['rangeattacktime']);
     1526 if (isset($_POST['rangeattacktime']) && $_POST['rangeattacktime'] != '') $rangeattacktime = $sql->quote_smart($_POST['rangeattacktime']);
    15181527        else $rangeattacktime = 0;
    1519  if (isset($_POST['flags']) && $_POST['flags'] != '') $flags = $mysql->quote_smart($_POST['flags']);
     1528 if (isset($_POST['flags']) && $_POST['flags'] != '') $flags = $sql->quote_smart($_POST['flags']);
    15201529        else $flags = 0;
    1521  if (isset($_POST['dynamicflags']) && $_POST['dynamicflags'] != '') $dynamicflags = $mysql->quote_smart($_POST['dynamicflags']);
     1530 if (isset($_POST['dynamicflags']) && $_POST['dynamicflags'] != '') $dynamicflags = $sql->quote_smart($_POST['dynamicflags']);
    15221531        else $dynamicflags = 0;
    1523  if (isset($_POST['size']) && $_POST['size'] != '') $size = $mysql->quote_smart($_POST['size']);
     1532 if (isset($_POST['size']) && $_POST['size'] != '') $size = $sql->quote_smart($_POST['size']);
    15241533        else $size = 0;
    1525  if (isset($_POST['family']) && $_POST['family'] != '') $family = $mysql->quote_smart($_POST['family']);
     1534 if (isset($_POST['family']) && $_POST['family'] != '') $family = $sql->quote_smart($_POST['family']);
    15261535        else $family = 0;
    1527  if (isset($_POST['bounding_radius']) && $_POST['bounding_radius'] != '') $bounding_radius = $mysql->quote_smart($_POST['bounding_radius']);
     1536 if (isset($_POST['bounding_radius']) && $_POST['bounding_radius'] != '') $bounding_radius = $sql->quote_smart($_POST['bounding_radius']);
    15281537        else $bounding_radius = 0;
    1529  if (isset($_POST['trainer_type']) && $_POST['trainer_type'] != '') $trainer_type = $mysql->quote_smart($_POST['trainer_type']);
     1538 if (isset($_POST['trainer_type']) && $_POST['trainer_type'] != '') $trainer_type = $sql->quote_smart($_POST['trainer_type']);
    15301539        else $trainer_type = 0;
    1531  if (isset($_POST['trainer_spell']) && $_POST['trainer_spell'] != '') $trainer_spell = $mysql->quote_smart($_POST['trainer_spell']);
     1540 if (isset($_POST['trainer_spell']) && $_POST['trainer_spell'] != '') $trainer_spell = $sql->quote_smart($_POST['trainer_spell']);
    15321541        else $trainer_spell = 0;
    1533  if (isset($_POST['class']) && $_POST['class'] != '') $class = $mysql->quote_smart($_POST['class']);
     1542 if (isset($_POST['class']) && $_POST['class'] != '') $class = $sql->quote_smart($_POST['class']);
    15341543        else $class = 0;
    1535  if (isset($_POST['race']) && $_POST['race'] != '') $race = $mysql->quote_smart($_POST['race']);
     1544 if (isset($_POST['race']) && $_POST['race'] != '') $race = $sql->quote_smart($_POST['race']);
    15361545        else $race = 0;
    1537  if (isset($_POST['minrangedmg']) && $_POST['minrangedmg'] != '') $minrangedmg = $mysql->quote_smart($_POST['minrangedmg']);
     1546 if (isset($_POST['minrangedmg']) && $_POST['minrangedmg'] != '') $minrangedmg = $sql->quote_smart($_POST['minrangedmg']);
    15381547        else $minrangedmg = 0;
    1539  if (isset($_POST['maxrangedmg']) && $_POST['maxrangedmg'] != '') $maxrangedmg = $mysql->quote_smart($_POST['maxrangedmg']);
     1548 if (isset($_POST['maxrangedmg']) && $_POST['maxrangedmg'] != '') $maxrangedmg = $sql->quote_smart($_POST['maxrangedmg']);
    15401549        else $maxrangedmg = 0;
    1541  if (isset($_POST['rangedattackpower']) && $_POST['rangedattackpower'] != '') $rangedattackpower = $mysql->quote_smart($_POST['rangedattackpower']);
     1550 if (isset($_POST['rangedattackpower']) && $_POST['rangedattackpower'] != '') $rangedattackpower = $sql->quote_smart($_POST['rangedattackpower']);
    15421551        else $rangedattackpower = 0;
    1543  if (isset($_POST['combat_reach']) && $_POST['combat_reach'] != '') $combat_reach = $mysql->quote_smart($_POST['combat_reach']);
     1552 if (isset($_POST['combat_reach']) && $_POST['combat_reach'] != '') $combat_reach = $sql->quote_smart($_POST['combat_reach']);
    15441553        else $combat_reach = 0;
    1545  if (isset($_POST['type']) && $_POST['type'] != '') $type = $mysql->quote_smart($_POST['type']);
     1554 if (isset($_POST['type']) && $_POST['type'] != '') $type = $sql->quote_smart($_POST['type']);
    15461555        else $type = 0;
    1547  if (isset($_POST['civilian']) && $_POST['civilian'] != '') $civilian = $mysql->quote_smart($_POST['civilian']);
     1556 if (isset($_POST['civilian']) && $_POST['civilian'] != '') $civilian = $sql->quote_smart($_POST['civilian']);
    15481557        else $civilian = 0;
    1549  if (isset($_POST['flag1']) && $_POST['flag1'] != '') $flag1 = $mysql->quote_smart($_POST['flag1']);
     1558 if (isset($_POST['flag1']) && $_POST['flag1'] != '') $flag1 = $sql->quote_smart($_POST['flag1']);
    15501559        else $flag1 = 0;
    1551  if (isset($_POST['equipmodel1']) && $_POST['equipmodel1'] != '') $equipmodel1 = $mysql->quote_smart($_POST['equipmodel1']);
     1560 if (isset($_POST['equipmodel1']) && $_POST['equipmodel1'] != '') $equipmodel1 = $sql->quote_smart($_POST['equipmodel1']);
    15521561        else $equipmodel1 = 0;
    1553  if (isset($_POST['equipmodel2']) && $_POST['equipmodel2'] != '') $equipmodel2 = $mysql->quote_smart($_POST['equipmodel2']);
     1562 if (isset($_POST['equipmodel2']) && $_POST['equipmodel2'] != '') $equipmodel2 = $sql->quote_smart($_POST['equipmodel2']);
    15541563        else $equipmodel2 = 0;
    1555  if (isset($_POST['equipmodel3']) && $_POST['equipmodel3'] != '') $equipmodel3 = $mysql->quote_smart($_POST['equipmodel3']);
     1564 if (isset($_POST['equipmodel3']) && $_POST['equipmodel3'] != '') $equipmodel3 = $sql->quote_smart($_POST['equipmodel3']);
    15561565        else $equipmodel3 = 0;
    1557  if (isset($_POST['equipinfo1']) && $_POST['equipinfo1'] != '') $equipinfo1 = $mysql->quote_smart($_POST['equipinfo1']);
     1566 if (isset($_POST['equipinfo1']) && $_POST['equipinfo1'] != '') $equipinfo1 = $sql->quote_smart($_POST['equipinfo1']);
    15581567        else $equipinfo1 = 0;
    1559  if (isset($_POST['equipinfo2']) && $_POST['equipinfo2'] != '') $equipinfo2 = $mysql->quote_smart($_POST['equipinfo2']);
     1568 if (isset($_POST['equipinfo2']) && $_POST['equipinfo2'] != '') $equipinfo2 = $sql->quote_smart($_POST['equipinfo2']);
    15601569        else $equipinfo2 = 0;
    1561  if (isset($_POST['equipinfo3']) && $_POST['equipinfo3'] != '') $equipinfo3 = $mysql->quote_smart($_POST['equipinfo3']);
     1570 if (isset($_POST['equipinfo3']) && $_POST['equipinfo3'] != '') $equipinfo3 = $sql->quote_smart($_POST['equipinfo3']);
    15621571        else $equipinfo3 = 0;
    1563  if (isset($_POST['equipslot1']) && $_POST['equipslot1'] != '') $equipslot1 = $mysql->quote_smart($_POST['equipslot1']);
     1572 if (isset($_POST['equipslot1']) && $_POST['equipslot1'] != '') $equipslot1 = $sql->quote_smart($_POST['equipslot1']);
    15641573        else $equipslot1 = 0;
    1565  if (isset($_POST['equipslot2']) && $_POST['equipslot2'] != '') $equipslot2 = $mysql->quote_smart($_POST['equipslot2']);
     1574 if (isset($_POST['equipslot2']) && $_POST['equipslot2'] != '') $equipslot2 = $sql->quote_smart($_POST['equipslot2']);
    15661575        else $equipslot2 = 0;
    1567  if (isset($_POST['equipslot3']) && $_POST['equipslot3'] != '') $equipslot3 = $mysql->quote_smart($_POST['equipslot3']);
     1576 if (isset($_POST['equipslot3']) && $_POST['equipslot3'] != '') $equipslot3 = $sql->quote_smart($_POST['equipslot3']);
    15681577        else $equipslot3 = 0;
    1569  if (isset($_POST['lootid']) && $_POST['lootid'] != '') $lootid = $mysql->quote_smart($_POST['lootid']);
     1578 if (isset($_POST['lootid']) && $_POST['lootid'] != '') $lootid = $sql->quote_smart($_POST['lootid']);
    15701579         else $lootid = 0;     
    1571  if (isset($_POST['pickpocketloot']) && $_POST['pickpocketloot'] != '') $pickpocketloot = $mysql->quote_smart($_POST['pickpocketloot']);
     1580 if (isset($_POST['pickpocketloot']) && $_POST['pickpocketloot'] != '') $pickpocketloot = $sql->quote_smart($_POST['pickpocketloot']);
    15721581        else $pickpocketloot = 0;
    1573  if (isset($_POST['skinloot']) && $_POST['skinloot'] != '') $skinloot = $mysql->quote_smart($_POST['skinloot']);
     1582 if (isset($_POST['skinloot']) && $_POST['skinloot'] != '') $skinloot = $sql->quote_smart($_POST['skinloot']);
    15741583        else $skinloot = 0;
    1575  if (isset($_POST['resistance1']) && $_POST['resistance1'] != '') $resistance1 = $mysql->quote_smart($_POST['resistance1']);
     1584 if (isset($_POST['resistance1']) && $_POST['resistance1'] != '') $resistance1 = $sql->quote_smart($_POST['resistance1']);
    15761585        else $resistance1 = 0;
    1577  if (isset($_POST['resistance2']) && $_POST['resistance2'] != '') $resistance2 = $mysql->quote_smart($_POST['resistance2']);
     1586 if (isset($_POST['resistance2']) && $_POST['resistance2'] != '') $resistance2 = $sql->quote_smart($_POST['resistance2']);
    15781587        else $resistance2 = 0;
    1579  if (isset($_POST['resistance3']) && $_POST['resistance3'] != '') $resistance3 = $mysql->quote_smart($_POST['resistance3']);
     1588 if (isset($_POST['resistance3']) && $_POST['resistance3'] != '') $resistance3 = $sql->quote_smart($_POST['resistance3']);
    15801589        else $resistance3 = 0;
    1581  if (isset($_POST['resistance4']) && $_POST['resistance4'] != '') $resistance4 = $mysql->quote_smart($_POST['resistance4']);
     1590 if (isset($_POST['resistance4']) && $_POST['resistance4'] != '') $resistance4 = $sql->quote_smart($_POST['resistance4']);
    15821591        else $resistance4 = 0;
    1583  if (isset($_POST['resistance5']) && $_POST['resistance5'] != '') $resistance5 = $mysql->quote_smart($_POST['resistance5']);
     1592 if (isset($_POST['resistance5']) && $_POST['resistance5'] != '') $resistance5 = $sql->quote_smart($_POST['resistance5']);
    15841593        else $resistance5 = 0;
    1585  if (isset($_POST['resistance6']) && $_POST['resistance6'] != '') $resistance6 = $mysql->quote_smart($_POST['resistance6']);
     1594 if (isset($_POST['resistance6']) && $_POST['resistance6'] != '') $resistance6 = $sql->quote_smart($_POST['resistance6']);
    15861595        else $resistance6 = 0;
    1587  if (isset($_POST['spell1']) && $_POST['spell1'] != '') $spell1 = $mysql->quote_smart($_POST['spell1']);
     1596 if (isset($_POST['spell1']) && $_POST['spell1'] != '') $spell1 = $sql->quote_smart($_POST['spell1']);
    15881597        else $spell1 = 0;
    1589  if (isset($_POST['spell2']) && $_POST['spell2'] != '') $spell2 = $mysql->quote_smart($_POST['spell2']);
     1598 if (isset($_POST['spell2']) && $_POST['spell2'] != '') $spell2 = $sql->quote_smart($_POST['spell2']);
    15901599        else $spell2 = 0;
    1591  if (isset($_POST['spell3']) && $_POST['spell3'] != '') $spell3 = $mysql->quote_smart($_POST['spell3']);
     1600 if (isset($_POST['spell3']) && $_POST['spell3'] != '') $spell3 = $sql->quote_smart($_POST['spell3']);
    15921601        else $spell3 = 0;
    1593  if (isset($_POST['spell4']) && $_POST['spell4'] != '') $spell4 = $mysql->quote_smart($_POST['spell4']);
     1602 if (isset($_POST['spell4']) && $_POST['spell4'] != '') $spell4 = $sql->quote_smart($_POST['spell4']);
    15941603        else $spell4 = 0;
    1595  if (isset($_POST['mingold']) && $_POST['mingold'] != '') $mingold = $mysql->quote_smart($_POST['mingold']);
     1604 if (isset($_POST['mingold']) && $_POST['mingold'] != '') $mingold = $sql->quote_smart($_POST['mingold']);
    15961605        else $mingold = 0;
    1597  if (isset($_POST['maxgold']) && $_POST['maxgold'] != '') $maxgold = $mysql->quote_smart($_POST['maxgold']);
     1606 if (isset($_POST['maxgold']) && $_POST['maxgold'] != '') $maxgold = $sql->quote_smart($_POST['maxgold']);
    15981607        else $maxgold = 0;
    1599  if (isset($_POST['AIName']) && $_POST['AIName'] != '') $AIName = $mysql->quote_smart($_POST['AIName']);
     1608 if (isset($_POST['AIName']) && $_POST['AIName'] != '') $AIName = $sql->quote_smart($_POST['AIName']);
    16001609        else $AIName = "";
    1601  if (isset($_POST['MovementType']) && $_POST['MovementType'] != '') $MovementType = $mysql->quote_smart($_POST['MovementType']);
     1610 if (isset($_POST['MovementType']) && $_POST['MovementType'] != '') $MovementType = $sql->quote_smart($_POST['MovementType']);
    16021611        else $MovementType = 0;
    1603   if (isset($_POST['InhabitType']) && $_POST['InhabitType'] != '') $InhabitType = $mysql->quote_smart($_POST['InhabitType']);
     1612 if (isset($_POST['InhabitType']) && $_POST['InhabitType'] != '') $InhabitType = $sql->quote_smart($_POST['InhabitType']);
    16041613        else $InhabitType = 0;
    1605  if (isset($_POST['ScriptName']) && $_POST['ScriptName'] != '') $ScriptName = $mysql->quote_smart($_POST['ScriptName']);
     1614 if (isset($_POST['ScriptName']) && $_POST['ScriptName'] != '') $ScriptName = $sql->quote_smart($_POST['ScriptName']);
    16061615        else $ScriptName = "";
    1607 
    1608         if (isset($_POST['ChanceOrRef']) && $_POST['ChanceOrRef'] != '') $ChanceOrRef = $mysql->quote_smart($_POST['ChanceOrRef']);
     1616 if (isset($_POST['RacialLeader']) && $_POST['RacialLeader'] != '') $RacialLeader = $sql->quote_smart($_POST['RacialLeader']);
     1617        else $RacialLeader = 0;
     1618
     1619        if (isset($_POST['ChanceOrRef']) && $_POST['ChanceOrRef'] != '') $ChanceOrRef = $sql->quote_smart($_POST['ChanceOrRef']);
    16091620                else $ChanceOrRef = 0;
    1610         if (isset($_POST['QuestChanceOrGroup']) && $_POST['QuestChanceOrGroup'] != '') $QuestChanceOrGroup = $mysql->quote_smart($_POST['QuestChanceOrGroup']);
     1621        if (isset($_POST['QuestChanceOrGroup']) && $_POST['QuestChanceOrGroup'] != '') $QuestChanceOrGroup = $sql->quote_smart($_POST['QuestChanceOrGroup']);
    16111622                else $QuestChanceOrGroup = 0;
    1612         if (isset($_POST['mincount']) && $_POST['mincount'] != '') $mincount = $mysql->quote_smart($_POST['mincount']);
     1623        if (isset($_POST['mincount']) && $_POST['mincount'] != '') $mincount = $sql->quote_smart($_POST['mincount']);
    16131624                else $mincount = 0;
    1614         if (isset($_POST['maxcount']) && $_POST['maxcount'] != '') $maxcount = $mysql->quote_smart($_POST['maxcount']);
     1625        if (isset($_POST['maxcount']) && $_POST['maxcount'] != '') $maxcount = $sql->quote_smart($_POST['maxcount']);
    16151626                else $maxcount = 0;
    1616         if (isset($_POST['quest_freeforall']) && $_POST['quest_freeforall'] != '') $quest_freeforall = $mysql->quote_smart($_POST['quest_freeforall']);
     1627        if (isset($_POST['quest_freeforall']) && $_POST['quest_freeforall'] != '') $quest_freeforall = $sql->quote_smart($_POST['quest_freeforall']);
    16171628                else $quest_freeforall = 0;
    1618         if (isset($_POST['item']) && $_POST['item'] != '') $item = $mysql->quote_smart($_POST['item']);
     1629        if (isset($_POST['item']) && $_POST['item'] != '') $item = $sql->quote_smart($_POST['item']);
    16191630                else $item = 0;
    1620         if (isset($_POST['del_loot_items']) && $_POST['del_loot_items'] != '') $del_loot_items = $mysql->quote_smart($_POST['del_loot_items']);
     1631        if (isset($_POST['del_loot_items']) && $_POST['del_loot_items'] != '') $del_loot_items = $sql->quote_smart($_POST['del_loot_items']);
    16211632                else $del_loot_items = NULL;
    16221633       
    1623         if (isset($_POST['involvedrelation']) && $_POST['involvedrelation'] != '') $involvedrelation = $mysql->quote_smart($_POST['involvedrelation']);
     1634        if (isset($_POST['involvedrelation']) && $_POST['involvedrelation'] != '') $involvedrelation = $sql->quote_smart($_POST['involvedrelation']);
    16241635                else $involvedrelation = 0;
    1625         if (isset($_POST['del_involvedrelation']) && $_POST['del_involvedrelation'] != '') $del_involvedrelation = $mysql->quote_smart($_POST['del_involvedrelation']);
     1636        if (isset($_POST['del_involvedrelation']) && $_POST['del_involvedrelation'] != '') $del_involvedrelation = $sql->quote_smart($_POST['del_involvedrelation']);
    16261637                else $del_involvedrelation = NULL;
    1627         if (isset($_POST['questrelation']) && $_POST['questrelation'] != '') $questrelation = $mysql->quote_smart($_POST['questrelation']);
     1638        if (isset($_POST['questrelation']) && $_POST['questrelation'] != '') $questrelation = $sql->quote_smart($_POST['questrelation']);
    16281639                else $questrelation = 0;
    1629         if (isset($_POST['del_questrelation']) && $_POST['del_questrelation'] != '') $del_questrelation = $mysql->quote_smart($_POST['del_questrelation']);
     1640        if (isset($_POST['del_questrelation']) && $_POST['del_questrelation'] != '') $del_questrelation = $sql->quote_smart($_POST['del_questrelation']);
    16301641                else $del_questrelation = NULL;
    16311642
    1632         if (isset($_POST['del_vendor_item']) && $_POST['del_vendor_item'] != '') $del_vendor_item = $mysql->quote_smart($_POST['del_vendor_item']);
     1643        if (isset($_POST['del_vendor_item']) && $_POST['del_vendor_item'] != '') $del_vendor_item = $sql->quote_smart($_POST['del_vendor_item']);
    16331644                else $del_vendor_item = NULL;
    1634         if (isset($_POST['vendor_item']) && $_POST['vendor_item'] != '') $vendor_item = $mysql->quote_smart($_POST['vendor_item']);
     1645        if (isset($_POST['vendor_item']) && $_POST['vendor_item'] != '') $vendor_item = $sql->quote_smart($_POST['vendor_item']);
    16351646                else $vendor_item = 0;
    1636         if (isset($_POST['vendor_maxcount']) && $_POST['vendor_maxcount'] != '') $vendor_maxcount = $mysql->quote_smart($_POST['vendor_maxcount']);
     1647        if (isset($_POST['vendor_maxcount']) && $_POST['vendor_maxcount'] != '') $vendor_maxcount = $sql->quote_smart($_POST['vendor_maxcount']);
    16371648                else $vendor_maxcount = 0;
    1638         if (isset($_POST['vendor_incrtime']) && $_POST['vendor_incrtime'] != '') $vendor_incrtime = $mysql->quote_smart($_POST['vendor_incrtime']);
     1649        if (isset($_POST['vendor_incrtime']) && $_POST['vendor_incrtime'] != '') $vendor_incrtime = $sql->quote_smart($_POST['vendor_incrtime']);
    16391650                else $vendor_incrtime = 0;
    16401651
    1641         if (isset($_POST['skin_ChanceOrRef']) && $_POST['skin_ChanceOrRef'] != '') $skin_ChanceOrRef = $mysql->quote_smart($_POST['skin_ChanceOrRef']);
     1652        if (isset($_POST['skin_ChanceOrRef']) && $_POST['skin_ChanceOrRef'] != '') $skin_ChanceOrRef = $sql->quote_smart($_POST['skin_ChanceOrRef']);
    16421653                else $skin_ChanceOrRef = 0;
    1643         if (isset($_POST['skin_QuestChanceOrGroup']) && $_POST['skin_QuestChanceOrGroup'] != '') $skin_QuestChanceOrGroup = $mysql->quote_smart($_POST['skin_QuestChanceOrGroup']);
     1654        if (isset($_POST['skin_QuestChanceOrGroup']) && $_POST['skin_QuestChanceOrGroup'] != '') $skin_QuestChanceOrGroup = $sql->quote_smart($_POST['skin_QuestChanceOrGroup']);
    16441655                else $skin_QuestChanceOrGroup = 0;
    1645         if (isset($_POST['skin_mincount']) && $_POST['skin_mincount'] != '') $skin_mincount = $mysql->quote_smart($_POST['skin_mincount']);
     1656        if (isset($_POST['skin_mincount']) && $_POST['skin_mincount'] != '') $skin_mincount = $sql->quote_smart($_POST['skin_mincount']);
    16461657                else $skin_mincount = 0;
    1647         if (isset($_POST['skin_maxcount']) && $_POST['skin_maxcount'] != '') $skin_maxcount = $mysql->quote_smart($_POST['skin_maxcount']);
     1658        if (isset($_POST['skin_maxcount']) && $_POST['skin_maxcount'] != '') $skin_maxcount = $sql->quote_smart($_POST['skin_maxcount']);
    16481659                else $skin_maxcount = 0;
    1649         if (isset($_POST['skin_quest_freeforall']) && $_POST['skin_quest_freeforall'] != '') $skin_quest_freeforall = $mysql->quote_smart($_POST['skin_quest_freeforall']);
     1660        if (isset($_POST['skin_quest_freeforall']) && $_POST['skin_quest_freeforall'] != '') $skin_quest_freeforall = $sql->quote_smart($_POST['skin_quest_freeforall']);
    16501661                else $skin_quest_freeforall = 0;
    1651         if (isset($_POST['skin_item']) && $_POST['skin_item'] != '') $skin_item = $mysql->quote_smart($_POST['skin_item']);
     1662        if (isset($_POST['skin_item']) && $_POST['skin_item'] != '') $skin_item = $sql->quote_smart($_POST['skin_item']);
    16521663                else $skin_item = 0;
    1653         if (isset($_POST['del_skin_items']) && $_POST['del_skin_items'] != '') $del_skin_items = $mysql->quote_smart($_POST['del_skin_items']);
     1664        if (isset($_POST['del_skin_items']) && $_POST['del_skin_items'] != '') $del_skin_items = $sql->quote_smart($_POST['del_skin_items']);
    16541665                else $del_skin_items = NULL;
    16551666
    1656         if (isset($_POST['pp_ChanceOrRef']) && $_POST['pp_ChanceOrRef'] != '') $pp_ChanceOrRef = $mysql->quote_smart($_POST['pp_ChanceOrRef']);
     1667        if (isset($_POST['pp_ChanceOrRef']) && $_POST['pp_ChanceOrRef'] != '') $pp_ChanceOrRef = $sql->quote_smart($_POST['pp_ChanceOrRef']);
    16571668                else $pp_ChanceOrRef = 0;
    1658         if (isset($_POST['pp_QuestChanceOrGroup']) && $_POST['pp_QuestChanceOrGroup'] != '') $pp_QuestChanceOrGroup = $mysql->quote_smart($_POST['pp_QuestChanceOrGroup']);
     1669        if (isset($_POST['pp_QuestChanceOrGroup']) && $_POST['pp_QuestChanceOrGroup'] != '') $pp_QuestChanceOrGroup = $sql->quote_smart($_POST['pp_QuestChanceOrGroup']);
    16591670                else $pp_QuestChanceOrGroup = 0;
    1660         if (isset($_POST['pp_mincount']) && $_POST['pp_mincount'] != '') $pp_mincount = $mysql->quote_smart($_POST['pp_mincount']);
     1671        if (isset($_POST['pp_mincount']) && $_POST['pp_mincount'] != '') $pp_mincount = $sql->quote_smart($_POST['pp_mincount']);
    16611672                else $pp_mincount = 0;
    1662         if (isset($_POST['pp_maxcount']) && $_POST['pp_maxcount'] != '') $pp_maxcount = $mysql->quote_smart($_POST['pp_maxcount']);
     1673        if (isset($_POST['pp_maxcount']) && $_POST['pp_maxcount'] != '') $pp_maxcount = $sql->quote_smart($_POST['pp_maxcount']);
    16631674                else $pp_maxcount = 0;
    1664         if (isset($_POST['pp_quest_freeforall']) && $_POST['pp_quest_freeforall'] != '') $pp_quest_freeforall = $mysql->quote_smart($_POST['pp_quest_freeforall']);
     1675        if (isset($_POST['pp_quest_freeforall']) && $_POST['pp_quest_freeforall'] != '') $pp_quest_freeforall = $sql->quote_smart($_POST['pp_quest_freeforall']);
    16651676                else $pp_quest_freeforall = 0;
    1666         if (isset($_POST['pp_item']) && $_POST['pp_item'] != '') $pp_item = $mysql->quote_smart($_POST['pp_item']);
     1677        if (isset($_POST['pp_item']) && $_POST['pp_item'] != '') $pp_item = $sql->quote_smart($_POST['pp_item']);
    16671678                else $pp_item = 0;
    1668         if (isset($_POST['del_pp_items']) && $_POST['del_pp_items'] != '') $del_pp_items = $mysql->quote_smart($_POST['del_pp_items']);
     1679        if (isset($_POST['del_pp_items']) && $_POST['del_pp_items'] != '') $del_pp_items = $sql->quote_smart($_POST['del_pp_items']);
    16691680                else $del_pp_items = NULL;
    16701681
    1671         if (isset($_POST['trainer_spell']) && $_POST['trainer_spell'] != '') $trainer_spell = $mysql->quote_smart($_POST['trainer_spell']);
     1682        if (isset($_POST['trainer_spell']) && $_POST['trainer_spell'] != '') $trainer_spell = $sql->quote_smart($_POST['trainer_spell']);
    16721683                else $trainer_spell = 0;
    1673         if (isset($_POST['spellcost']) && $_POST['spellcost'] != '') $spellcost = $mysql->quote_smart($_POST['spellcost']);
     1684        if (isset($_POST['spellcost']) && $_POST['spellcost'] != '') $spellcost = $sql->quote_smart($_POST['spellcost']);
    16741685                else $spellcost = 0;
    1675         if (isset($_POST['reqskill']) && $_POST['reqskill'] != '') $reqskill = $mysql->quote_smart($_POST['reqskill']);
     1686        if (isset($_POST['reqskill']) && $_POST['reqskill'] != '') $reqskill = $sql->quote_smart($_POST['reqskill']);
    16761687                else $reqskill = 0;
    1677         if (isset($_POST['reqskillvalue']) && $_POST['reqskillvalue'] != '') $reqskillvalue = $mysql->quote_smart($_POST['reqskillvalue']);
     1688        if (isset($_POST['reqskillvalue']) && $_POST['reqskillvalue'] != '') $reqskillvalue = $sql->quote_smart($_POST['reqskillvalue']);
    16781689                else $reqskillvalue = 0;
    1679         if (isset($_POST['reqlevel']) && $_POST['reqlevel'] != '') $reqlevel = $mysql->quote_smart($_POST['reqlevel']);
     1690        if (isset($_POST['reqlevel']) && $_POST['reqlevel'] != '') $reqlevel = $sql->quote_smart($_POST['reqlevel']);
    16801691                else $reqlevel = 0;
    1681         if (isset($_POST['del_trainer_spell']) && $_POST['del_trainer_spell'] != '') $del_trainer_spell = $mysql->quote_smart($_POST['del_trainer_spell']);
     1692        if (isset($_POST['del_trainer_spell']) && $_POST['del_trainer_spell'] != '') $del_trainer_spell = $sql->quote_smart($_POST['del_trainer_spell']);
    16821693                else $del_trainer_spell = NULL;
    16831694
     
    17031714
    17041715  if ($_POST['opp_type'] == "add_new"){
    1705         $sql = "INSERT INTO creature_template ( entry, modelid_m, modelid_f, name, subname, minlevel,
     1716        $sql_query = "INSERT INTO creature_template ( entry, modelid_m, modelid_f, name, subname, minlevel,
    17061717        maxlevel, minhealth, maxhealth, minmana, maxmana, armor, faction, npcflag, speed, rank, mindmg,
    17071718        maxdmg, attackpower, baseattacktime, rangeattacktime, flags, dynamicflags, size, family,
     
    17101721        equipinfo3, equipslot1, equipslot2, equipslot3, lootid, pickpocketloot, skinloot, resistance1,
    17111722        resistance2, resistance3, resistance4, resistance5, resistance6, spell1, spell2, spell3, spell4,
    1712         mingold, maxgold, AIName, MovementType, InhabitType, ScriptName ) VALUES ( '$entry', '$modelid_m', '$modelid_f', '$name',
     1723        mingold, maxgold, AIName, MovementType, InhabitType, RacialLeader, ScriptName) VALUES ( '$entry', '$modelid_m', '$modelid_f', '$name',
    17131724        '$subname', '$minlevel', '$maxlevel', '$minhealth', '$maxhealth', '$minmana', '$maxmana', '$armor', '$faction', '$npcflag',
    17141725        '$speed', '$rank', '$mindmg', '$maxdmg', '$attackpower', '$baseattacktime', '$rangeattacktime', '$flags',
     
    17181729        '$equipslot2', '$equipslot3', '$lootid', '$pickpocketloot', '$skinloot', '$resistance1', '$resistance2',
    17191730        '$resistance3', '$resistance4', '$resistance5', '$resistance6', '$spell1', '$spell2', '$spell3', '$spell4',
    1720         '$mingold', '$maxgold', '$AIName', '$MovementType', '$InhabitType', '$ScriptName' )";
     1731        '$mingold', '$maxgold', '$AIName', '$MovementType', '$InhabitType', '$RacialLeader', '$ScriptName' )";
    17211732
    17221733 } elseif ($_POST['opp_type'] == "edit"){
    17231734
    1724         $sql = "UPDATE creature_template SET  ";
    1725  
    1726         $result = $mysql->query("SELECT * FROM creature_template WHERE entry = '$entry'");
    1727         if ($mob_templ = $mysql->fetch_assoc($result)){
    1728                 if ($mob_templ['modelid_m'] != $modelid_m) $sql .= "modelid_m='$modelid_m',";
    1729                 if ($mob_templ['modelid_f'] != $modelid_f) $sql .= "modelid_f='$modelid_f',";
    1730                 if ($mob_templ['name'] != $name) $sql .= "name='$name',";
    1731                 if ($mob_templ['subname'] != $subname) $sql .= "subname='$subname',";
    1732                 if ($mob_templ['minlevel'] != $minlevel) $sql .= "minlevel='$minlevel',";
    1733                 if ($mob_templ['maxlevel'] != $maxlevel) $sql .= "maxlevel='$maxlevel',";
    1734                 if ($mob_templ['minhealth'] != $minhealth) $sql .= "minhealth='$minhealth',";
    1735                 if ($mob_templ['maxhealth'] != $maxhealth) $sql .= "maxhealth='$maxhealth',";
    1736                 if ($mob_templ['minmana'] != $minmana) $sql .= "minmana='$minmana',";
    1737                 if ($mob_templ['maxmana'] != $maxmana) $sql .= "maxmana='$maxmana',";
    1738                 if ($mob_templ['armor'] != $armor) $sql .= "armor='$armor',";
    1739                 if ($mob_templ['faction'] != $faction) $sql .= "faction='$faction',";
    1740                 if ($mob_templ['npcflag'] != $npcflag) $sql .= "npcflag='$npcflag',";
    1741                 if ($mob_templ['speed'] != $speed) $sql .= "speed='$speed',";
    1742                 if ($mob_templ['rank'] != $rank) $sql .= "rank='$rank',";
    1743                 if ($mob_templ['mindmg'] != $mindmg) $sql .= "mindmg='$mindmg',";
    1744                 if ($mob_templ['maxdmg'] != $maxdmg) $sql .= "maxdmg='$maxdmg',";
    1745                 if ($mob_templ['attackpower'] != $attackpower) $sql .= "attackpower='$attackpower',";
    1746                 if ($mob_templ['baseattacktime'] != $baseattacktime) $sql .= "baseattacktime='$baseattacktime',";
    1747                 if ($mob_templ['rangeattacktime'] != $rangeattacktime) $sql .= "rangeattacktime='$rangeattacktime',";
    1748                 if ($mob_templ['flags'] != $flags) $sql .= "flags='$flags',";
    1749                 if ($mob_templ['dynamicflags'] != $dynamicflags) $sql .= "dynamicflags='$dynamicflags',";
    1750                 if ($mob_templ['size'] != $size) $sql .= "size='$size',";
    1751                 if ($mob_templ['family'] != $family) $sql .= "family='$family',";
    1752                 if ($mob_templ['bounding_radius'] != $bounding_radius) $sql .= "bounding_radius='$bounding_radius',";
    1753                 if ($mob_templ['trainer_type'] != $trainer_type) $sql .= "trainer_type='$trainer_type',";
    1754                 if ($mob_templ['trainer_spell'] != $trainer_spell) $sql .= "trainer_spell='$trainer_spell',";
    1755                 if ($mob_templ['class'] != $class) $sql .= "class='$class',";
    1756                 if ($mob_templ['race'] != $race) $sql .= "race='$race',";
    1757                 if ($mob_templ['minrangedmg'] != $minrangedmg) $sql .= "minrangedmg='$minrangedmg',";
    1758                 if ($mob_templ['maxrangedmg'] != $maxrangedmg) $sql .= "maxrangedmg='$maxrangedmg',";
    1759                 if ($mob_templ['rangedattackpower'] != $rangedattackpower) $sql .= "rangedattackpower='$rangedattackpower',";
    1760                 if ($mob_templ['combat_reach'] != $combat_reach) $sql .= "combat_reach='$combat_reach',";
    1761                 if ($mob_templ['type'] != $type) $sql .= "type='$type',";
    1762                 if ($mob_templ['civilian'] != $civilian) $sql .= "civilian='$civilian',";
    1763                 if ($mob_templ['flag1'] != $flag1) $sql .= "flag1='$flag1',";
    1764                 if ($mob_templ['equipmodel1'] != $equipmodel1) $sql .= "equipmodel1='$equipmodel1',";
    1765                 if ($mob_templ['equipmodel2'] != $equipmodel2) $sql .= "equipmodel2='$equipmodel2',";
    1766                 if ($mob_templ['equipmodel3'] != $equipmodel3) $sql .= "equipmodel3='$equipmodel3',";
    1767                 if ($mob_templ['equipinfo1'] != $equipinfo1) $sql .= "equipinfo1='$equipinfo1',";
    1768                 if ($mob_templ['equipinfo2'] != $equipinfo2) $sql .= "equipinfo2='$equipinfo2',";
    1769                 if ($mob_templ['equipinfo3'] != $equipinfo3) $sql .= "equipinfo3='$equipinfo3',";
    1770                 if ($mob_templ['equipslot1'] != $equipslot1) $sql .= "equipslot1='$equipslot1',";
    1771                 if ($mob_templ['equipslot2'] != $equipslot2) $sql .= "equipslot2='$equipslot2',";
    1772                 if ($mob_templ['equipslot3'] != $equipslot3) $sql .= "equipslot3='$equipslot3',";
    1773                 if ($mob_templ['lootid'] != $lootid) $sql .= "lootid='$lootid',";
    1774                 if ($mob_templ['pickpocketloot'] != $pickpocketloot) $sql .= "pickpocketloot='$pickpocketloot',";
    1775                 if ($mob_templ['skinloot'] != $skinloot) $sql .= "skinloot='$skinloot',";
    1776                 if ($mob_templ['resistance1'] != $resistance1) $sql .= "resistance1='$resistance1',";
    1777                 if ($mob_templ['resistance2'] != $resistance2) $sql .= "resistance2='$resistance2',";
    1778                 if ($mob_templ['resistance3'] != $resistance3) $sql .= "resistance3='$resistance3',";
    1779                 if ($mob_templ['resistance4'] != $resistance4) $sql .= "resistance4='$resistance4',";
    1780                 if ($mob_templ['resistance5'] != $resistance5) $sql .= "resistance5='$resistance5',";
    1781                 if ($mob_templ['resistance6'] != $resistance6) $sql .= "resistance6='$resistance6',";
    1782                 if ($mob_templ['spell1'] != $spell1) $sql .= "spell1='$spell1',";
    1783                 if ($mob_templ['spell2'] != $spell2) $sql .= "spell2='$spell2',";
    1784                 if ($mob_templ['spell3'] != $spell3) $sql .= "spell3='$spell3',";
    1785                 if ($mob_templ['spell4'] != $spell4) $sql .= "spell4='$spell4',";
    1786                 if ($mob_templ['mingold'] != $mingold) $sql .= "mingold='$mingold',";
    1787                 if ($mob_templ['maxgold'] != $maxgold) $sql .= "maxgold='$maxgold',";
    1788                 if ($mob_templ['AIName'] != $AIName) $sql .= "AIName='$AIName',";
    1789                 if ($mob_templ['MovementType'] != $MovementType) $sql .= "MovementType='$MovementType',";
    1790                 if ($mob_templ['InhabitType'] != $InhabitType) $sql .= "InhabitType='$InhabitType',";
    1791                 if ($mob_templ['ScriptName'] != $ScriptName) $sql .= "ScriptName='$ScriptName',";
    1792 
    1793           $mysql->free_result($result);
     1735        $sql_query = "UPDATE creature_template SET  ";
     1736 
     1737        $result = $sql->query("SELECT * FROM creature_template WHERE entry = '$entry'");
     1738        if ($mob_templ = $sql->fetch_assoc($result)){
     1739                if ($mob_templ['modelid_m'] != $modelid_m) $sql_query .= "modelid_m='$modelid_m',";
     1740                if ($mob_templ['modelid_f'] != $modelid_f) $sql_query .= "modelid_f='$modelid_f',";
     1741                if ($mob_templ['name'] != $name) $sql_query .= "name='$name',";
     1742                if ($mob_templ['subname'] != $subname) $sql_query .= "subname='$subname',";
     1743                if ($mob_templ['minlevel'] != $minlevel) $sql_query .= "minlevel='$minlevel',";
     1744                if ($mob_templ['maxlevel'] != $maxlevel) $sql_query .= "maxlevel='$maxlevel',";
     1745                if ($mob_templ['minhealth'] != $minhealth) $sql_query .= "minhealth='$minhealth',";
     1746                if ($mob_templ['maxhealth'] != $maxhealth) $sql_query .= "maxhealth='$maxhealth',";
     1747                if ($mob_templ['minmana'] != $minmana) $sql_query .= "minmana='$minmana',";
     1748                if ($mob_templ['maxmana'] != $maxmana) $sql_query .= "maxmana='$maxmana',";
     1749                if ($mob_templ['armor'] != $armor) $sql_query .= "armor='$armor',";
     1750                if ($mob_templ['faction'] != $faction) $sql_query .= "faction='$faction',";
     1751                if ($mob_templ['npcflag'] != $npcflag) $sql_query .= "npcflag='$npcflag',";
     1752                if ($mob_templ['speed'] != $speed) $sql_query .= "speed='$speed',";
     1753                if ($mob_templ['rank'] != $rank) $sql_query .= "rank='$rank',";
     1754                if ($mob_templ['mindmg'] != $mindmg) $sql_query .= "mindmg='$mindmg',";
     1755                if ($mob_templ['maxdmg'] != $maxdmg) $sql_query .= "maxdmg='$maxdmg',";
     1756                if ($mob_templ['attackpower'] != $attackpower) $sql_query .= "attackpower='$attackpower',";
     1757                if ($mob_templ['baseattacktime'] != $baseattacktime) $sql_query .= "baseattacktime='$baseattacktime',";
     1758                if ($mob_templ['rangeattacktime'] != $rangeattacktime) $sql_query .= "rangeattacktime='$rangeattacktime',";
     1759                if ($mob_templ['flags'] != $flags) $sql_query .= "flags='$flags',";
     1760                if ($mob_templ['dynamicflags'] != $dynamicflags) $sql_query .= "dynamicflags='$dynamicflags',";
     1761                if ($mob_templ['size'] != $size) $sql_query .= "size='$size',";
     1762                if ($mob_templ['family'] != $family) $sql_query .= "family='$family',";
     1763                if ($mob_templ['bounding_radius'] != $bounding_radius) $sql_query .= "bounding_radius='$bounding_radius',";
     1764                if ($mob_templ['trainer_type'] != $trainer_type) $sql_query .= "trainer_type='$trainer_type',";
     1765                if ($mob_templ['trainer_spell'] != $trainer_spell) $sql_query .= "trainer_spell='$trainer_spell',";
     1766                if ($mob_templ['class'] != $class) $sql_query .= "class='$class',";
     1767                if ($mob_templ['race'] != $race) $sql_query .= "race='$race',";
     1768                if ($mob_templ['minrangedmg'] != $minrangedmg) $sql_query .= "minrangedmg='$minrangedmg',";
     1769                if ($mob_templ['maxrangedmg'] != $maxrangedmg) $sql_query .= "maxrangedmg='$maxrangedmg',";
     1770                if ($mob_templ['rangedattackpower'] != $rangedattackpower) $sql_query .= "rangedattackpower='$rangedattackpower',";
     1771                if ($mob_templ['combat_reach'] != $combat_reach) $sql_query .= "combat_reach='$combat_reach',";
     1772                if ($mob_templ['type'] != $type) $sql_query .= "type='$type',";
     1773                if ($mob_templ['civilian'] != $civilian) $sql_query .= "civilian='$civilian',";
     1774                if ($mob_templ['flag1'] != $flag1) $sql_query .= "flag1='$flag1',";
     1775                if ($mob_templ['equipmodel1'] != $equipmodel1) $sql_query .= "equipmodel1='$equipmodel1',";
     1776                if ($mob_templ['equipmodel2'] != $equipmodel2) $sql_query .= "equipmodel2='$equipmodel2',";
     1777                if ($mob_templ['equipmodel3'] != $equipmodel3) $sql_query .= "equipmodel3='$equipmodel3',";
     1778                if ($mob_templ['equipinfo1'] != $equipinfo1) $sql_query .= "equipinfo1='$equipinfo1',";
     1779                if ($mob_templ['equipinfo2'] != $equipinfo2) $sql_query .= "equipinfo2='$equipinfo2',";
     1780                if ($mob_templ['equipinfo3'] != $equipinfo3) $sql_query .= "equipinfo3='$equipinfo3',";
     1781                if ($mob_templ['equipslot1'] != $equipslot1) $sql_query .= "equipslot1='$equipslot1',";
     1782                if ($mob_templ['equipslot2'] != $equipslot2) $sql_query .= "equipslot2='$equipslot2',";
     1783                if ($mob_templ['equipslot3'] != $equipslot3) $sql_query .= "equipslot3='$equipslot3',";
     1784                if ($mob_templ['lootid'] != $lootid) $sql_query .= "lootid='$lootid',";
     1785                if ($mob_templ['pickpocketloot'] != $pickpocketloot) $sql_query .= "pickpocketloot='$pickpocketloot',";
     1786                if ($mob_templ['skinloot'] != $skinloot) $sql_query .= "skinloot='$skinloot',";
     1787                if ($mob_templ['resistance1'] != $resistance1) $sql_query .= "resistance1='$resistance1',";
     1788                if ($mob_templ['resistance2'] != $resistance2) $sql_query .= "resistance2='$resistance2',";
     1789                if ($mob_templ['resistance3'] != $resistance3) $sql_query .= "resistance3='$resistance3',";
     1790                if ($mob_templ['resistance4'] != $resistance4) $sql_query .= "resistance4='$resistance4',";
     1791                if ($mob_templ['resistance5'] != $resistance5) $sql_query .= "resistance5='$resistance5',";
     1792                if ($mob_templ['resistance6'] != $resistance6) $sql_query .= "resistance6='$resistance6',";
     1793                if ($mob_templ['spell1'] != $spell1) $sql_query .= "spell1='$spell1',";
     1794                if ($mob_templ['spell2'] != $spell2) $sql_query .= "spell2='$spell2',";
     1795                if ($mob_templ['spell3'] != $spell3) $sql_query .= "spell3='$spell3',";
     1796                if ($mob_templ['spell4'] != $spell4) $sql_query .= "spell4='$spell4',";
     1797                if ($mob_templ['mingold'] != $mingold) $sql_query .= "mingold='$mingold',";
     1798                if ($mob_templ['maxgold'] != $maxgold) $sql_query .= "maxgold='$maxgold',";
     1799                if ($mob_templ['AIName'] != $AIName) $sql_query .= "AIName='$AIName',";
     1800                if ($mob_templ['MovementType'] != $MovementType) $sql_query .= "MovementType='$MovementType',";
     1801                if ($mob_templ['InhabitType'] != $InhabitType) $sql_query .= "InhabitType='$InhabitType',";
     1802                if ($mob_templ['ScriptName'] != $ScriptName) $sql_query .= "ScriptName='$ScriptName',";
     1803                if ($mob_templ['RacialLeader'] != $RacialLeader) $sql_query .= "RacialLeader='$RacialLeader',";
     1804
     1805          $sql->free_result($result);
    17941806          unset($mob_templ);
    17951807         
    1796         if (($sql == "UPDATE creature_template SET  ")&&(!$item)&&(!$del_loot_items)
     1808        if (($sql_query == "UPDATE creature_template SET  ")&&(!$item)&&(!$del_loot_items)
    17971809                &&(!$del_questrelation)&&(!$questrelation)&&(!$del_involvedrelation)&&(!$involvedrelation)
    17981810                &&(!$del_vendor_item)&&(!$vendor_item)&&(!$del_skin_items)&&(!$skin_item)
    17991811                &&(!$del_pp_items)&&(!$pp_item)&&(!$trainer_spell)&&(!$del_trainer_spell)){
    1800                 $mysql->close();
     1812                $sql->close();
    18011813                redirect("creature.php?action=edit&entry=$entry&error=6");
    18021814                } else {
    1803                                 if ($sql != "UPDATE creature_template SET  "){
    1804                                         $sql[strlen($sql)-1] = " ";
    1805                                         $sql .= " WHERE entry = '$entry';\n";
    1806                                         } else $sql = "";
     1815                                if ($sql_query != "UPDATE creature_template SET  "){
     1816                                        $sql_query[strlen($sql_query)-1] = " ";
     1817                                        $sql_query .= " WHERE entry = '$entry';\n";
     1818                                        } else $sql_query = "";
    18071819                }
    18081820               
    18091821        if ($trainer_spell){
    1810         $sql .= "INSERT INTO npc_trainer (entry, spell, spellcost, reqskill, reqskillvalue, reqlevel)
     1822        $sql_query .= "INSERT INTO npc_trainer (entry, spell, spellcost, reqskill, reqskillvalue, reqlevel)
    18111823                        VALUES ($entry,$trainer_spell,$spellcost,$reqskill ,$reqskillvalue ,$reqlevel);\n";
    18121824        }
     
    18141826        if ($del_trainer_spell){
    18151827        foreach($del_trainer_spell as $spell_id)
    1816                 $sql .= "DELETE FROM npc_trainer WHERE entry = $entry AND spell = $spell_id;\n";
     1828                $sql_query .= "DELETE FROM npc_trainer WHERE entry = $entry AND spell = $spell_id;\n";
    18171829        }
    18181830
    18191831        if ($item){
    1820         $sql .= "INSERT INTO creature_loot_template (entry, item, ChanceOrRef, QuestChanceOrGroup, mincount, maxcount, quest_freeforall)
     1832        $sql_query .= "INSERT INTO creature_loot_template (entry, item, ChanceOrRef, QuestChanceOrGroup, mincount, maxcount, quest_freeforall)
    18211833                        VALUES ($lootid,$item,'$ChanceOrRef', '$QuestChanceOrGroup' ,$mincount ,$maxcount ,$quest_freeforall);\n";
    18221834        }
     
    18241836        if ($del_loot_items){
    18251837        foreach($del_loot_items as $item_id)
    1826                 $sql .= "DELETE FROM creature_loot_template WHERE entry = $lootid AND item = $item_id;\n";
     1838                $sql_query .= "DELETE FROM creature_loot_template WHERE entry = $lootid AND item = $item_id;\n";
    18271839        }
    18281840
    18291841        if ($skin_item){
    1830         $sql .= "INSERT INTO skinning_loot_template (entry, item, ChanceOrRef, QuestChanceOrGroup, mincount, maxcount, quest_freeforall)
     1842        $sql_query .= "INSERT INTO skinning_loot_template (entry, item, ChanceOrRef, QuestChanceOrGroup, mincount, maxcount, quest_freeforall)
    18311843                        VALUES ($skinloot,$skin_item,'$skin_ChanceOrRef', '$skin_QuestChanceOrGroup' ,$skin_mincount ,$skin_maxcount ,$skin_quest_freeforall);\n";
    18321844        }
     
    18341846        if ($del_skin_items){
    18351847        foreach($del_skin_items as $item_id)
    1836                 $sql .= "DELETE FROM skinning_loot_template WHERE entry = $skinloot AND item = $item_id;\n";
     1848                $sql_query .= "DELETE FROM skinning_loot_template WHERE entry = $skinloot AND item = $item_id;\n";
    18371849        }
    18381850   
    18391851        if ($pp_item){
    1840         $sql .= "INSERT INTO pickpocketing_loot_template (entry, item, ChanceOrRef, QuestChanceOrGroup, mincount, maxcount, quest_freeforall)
     1852        $sql_query .= "INSERT INTO pickpocketing_loot_template (entry, item, ChanceOrRef, QuestChanceOrGroup, mincount, maxcount, quest_freeforall)
    18411853                        VALUES ($pickpocketloot,$pp_item,'$pp_ChanceOrRef', '$pp_QuestChanceOrGroup' ,$pp_mincount ,$pp_maxcount ,$pp_quest_freeforall);\n";
    18421854        }
     
    18441856        if ($del_pp_items){
    18451857        foreach($del_pp_items as $item_id)
    1846                 $sql .= "DELETE FROM pickpocketing_loot_template WHERE entry = $pickpocketloot AND item = $item_id;\n";
     1858                $sql_query .= "DELETE FROM pickpocketing_loot_template WHERE entry = $pickpocketloot AND item = $item_id;\n";
    18471859        }
    18481860
    18491861        if ($questrelation){
    1850         $sql .= "INSERT INTO creature_questrelation (id, quest) VALUES ($entry,$questrelation);\n";
     1862        $sql_query .= "INSERT INTO creature_questrelation (id, quest) VALUES ($entry,$questrelation);\n";
    18511863        }
    18521864       
    18531865        if ($involvedrelation){
    1854         $sql .= "INSERT INTO creature_involvedrelation (id, quest) VALUES ($entry,$involvedrelation);\n";
     1866        $sql_query .= "INSERT INTO creature_involvedrelation (id, quest) VALUES ($entry,$involvedrelation);\n";
    18551867        }
    18561868
    18571869        if ($del_questrelation){
    18581870        foreach($del_questrelation as $quest_id)
    1859                 $sql .= "DELETE FROM creature_questrelation WHERE id = $entry AND quest = $quest_id;\n";
     1871                $sql_query .= "DELETE FROM creature_questrelation WHERE id = $entry AND quest = $quest_id;\n";
    18601872        }
    18611873
    18621874        if ($del_involvedrelation){
    18631875        foreach($del_involvedrelation as $quest_id)
    1864                 $sql .= "DELETE FROM creature_involvedrelation WHERE id = $entry AND quest = $quest_id;\n";
     1876                $sql_query .= "DELETE FROM creature_involvedrelation WHERE id = $entry AND quest = $quest_id;\n";
    18651877        }
    18661878       
    18671879        if ($del_vendor_item){
    18681880        foreach($del_vendor_item as $item_id)
    1869                 $sql .= "DELETE FROM npc_vendor WHERE entry = $entry AND item = $item_id;\n";
     1881                $sql_query .= "DELETE FROM npc_vendor WHERE entry = $entry AND item = $item_id;\n";
    18701882        }
    18711883       
    18721884        if ($vendor_item){
    1873         $sql .= "INSERT INTO npc_vendor (entry, item, maxcount, incrtime)
     1885        $sql_query .= "INSERT INTO npc_vendor (entry, item, maxcount, incrtime)
    18741886                        VALUES ($entry,$vendor_item,$vendor_maxcount,$vendor_incrtime);\n";
    18751887        }
    18761888
    18771889 } else {
    1878                 $mysql->close();
     1890                $sql->close();
    18791891                redirect("creature.php?error=5");
    18801892                }
    18811893 } else {
    1882         $mysql->close();
     1894        $sql->close();
    18831895        redirect("creature.php?error=5");
    18841896        }
    18851897
    18861898 if ( isset($_POST['backup_op']) && ($_POST['backup_op'] == 1) ){
    1887         $mysql->close();
     1899        $sql->close();
    18881900        Header("Content-type: application/octet-stream");
    18891901        Header("Content-Disposition: attachment; filename=creatureid_$entry.sql");
    1890         echo $sql;
     1902        echo $sql_query;
    18911903        exit();
    18921904        redirect("creature.php?action=edit&entry=$entry&error=4");
    18931905        } else {
    1894                 $sql = explode(';',$sql);
    1895                 foreach($sql as $tmp_query) if(($tmp_query)&&($tmp_query != "\n")) $result = $mysql->query($tmp_query);
    1896                 $mysql->close();
     1906                $sql_query = explode(';',$sql_query);
     1907                foreach($sql_query as $tmp_query) if(($tmp_query)&&($tmp_query != "\n")) $result = $sql->query($tmp_query);
     1908                $sql->close();
    18971909                }
    18981910
     
    19341946        else redirect("creature.php?error=1");
    19351947
    1936  $mysql = new MySQL;
    1937  $mysql->connect($mangos_db[$realm_id]['addr'], $mangos_db[$realm_id]['user'], $mangos_db[$realm_id]['pass'], $mangos_db[$realm_id]['name']);
    1938 
    1939   $result = $mysql->query("SELECT guid FROM creature WHERE id = '$entry'");
    1940   while ($guid = $mysql->fetch_row($result)){
    1941         $mysql->query("DELETE FROM creature_movement WHERE id = '$guid'");
     1948 $sql = new SQL;
     1949 $sql->connect($mangos_db[$realm_id]['addr'], $mangos_db[$realm_id]['user'], $mangos_db[$realm_id]['pass'], $mangos_db[$realm_id]['name']);
     1950
     1951  $result = $sql->query("SELECT guid FROM creature WHERE id = '$entry'");
     1952  while ($guid = $sql->fetch_row($result)){
     1953        $sql->query("DELETE FROM creature_movement WHERE id = '$guid'");
    19421954        }
    1943  $mysql->query("DELETE FROM creature WHERE id = '$entry'");
    1944  $mysql->query("DELETE FROM creature_template WHERE entry = '$entry'");
    1945  $mysql->query("DELETE FROM creature_onkill_reputation WHERE creature_id = '$entry'");
    1946  $mysql->query("DELETE FROM creature_involvedrelation WHERE id = '$entry'");
    1947  $mysql->query("DELETE FROM creature_questrelation WHERE id = '$entry'");
    1948  $mysql->query("DELETE FROM npc_vendor WHERE entry = '$entry'");
    1949  $mysql->query("DELETE FROM npc_trainer WHERE entry = '$entry'");
    1950  $mysql->query("DELETE FROM npc_gossip WHERE npc_guid = '$entry'");
    1951          
    1952  $mysql->close();
     1955 $sql->query("DELETE FROM creature WHERE id = '$entry'");
     1956 $sql->query("DELETE FROM creature_template WHERE entry = '$entry'");
     1957 $sql->query("DELETE FROM creature_onkill_reputation WHERE creature_id = '$entry'");
     1958 $sql->query("DELETE FROM creature_involvedrelation WHERE id = '$entry'");
     1959 $sql->query("DELETE FROM creature_questrelation WHERE id = '$entry'");
     1960 $sql->query("DELETE FROM npc_vendor WHERE entry = '$entry'");
     1961 $sql->query("DELETE FROM npc_trainer WHERE entry = '$entry'");
     1962 $sql->query("DELETE FROM npc_gossip WHERE npc_guid = '$entry'");
     1963         
     1964 $sql->close();
    19531965 redirect("creature.php");
    19541966 }
     
    19641976        else redirect("creature.php?error=1");
    19651977
    1966  $mysql = new MySQL;
    1967  $mysql->connect($mangos_db[$realm_id]['addr'], $mangos_db[$realm_id]['user'], $mangos_db[$realm_id]['pass'], $mangos_db[$realm_id]['name']);
    1968 
    1969  $result = $mysql->query("SELECT guid FROM creature WHERE id = '$entry'");
    1970  while ($guid = $mysql->fetch_row($result)){
    1971         $mysql->query("DELETE FROM creature_movement WHERE id = '$guid'");
     1978 $sql = new SQL;
     1979 $sql->connect($mangos_db[$realm_id]['addr'], $mangos_db[$realm_id]['user'], $mangos_db[$realm_id]['pass'], $mangos_db[$realm_id]['name']);
     1980
     1981 $result = $sql->query("SELECT guid FROM creature WHERE id = '$entry'");
     1982 while ($guid = $sql->fetch_row($result)){
     1983        $sql->query("DELETE FROM creature_movement WHERE id = '$guid'");
    19721984        }
    19731985
    1974  $mysql->query("DELETE FROM creature WHERE id = '$entry'");
    1975  $mysql->close();
     1986 $sql->query("DELETE FROM creature WHERE id = '$entry'");
     1987 $sql->close();
    19761988 redirect("creature.php?action=edit&entry=$entry&error=4");
    19771989 }
Note: See TracChangeset for help on using the changeset viewer.