Changeset 19 for minimanager/scripts/gen_lib.php
- Timestamp:
- Aug 13, 2007, 9:05:34 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
minimanager/scripts/gen_lib.php
r5 r19 14 14 global $lang_global, $mangos_db, $realm_id; 15 15 16 $ mysql_0 = new MySQL;17 $ mysql_0->connect($mangos_db[$realm_id]['addr'], $mangos_db[$realm_id]['user'], $mangos_db[$realm_id]['pass'], $mangos_db[$realm_id]['name'],true);16 $sql_0 = new SQL; 17 $sql_0->connect($mangos_db[$realm_id]['addr'], $mangos_db[$realm_id]['user'], $mangos_db[$realm_id]['pass'], $mangos_db[$realm_id]['name']); 18 18 19 $result = $ mysql_0->query("SELECT MAX(`id`) FROM item_text");20 $item_page_id = ($ mysql_0->result($result, 0)) + 1;21 $result = $ mysql_0->query("INSERT INTO item_text (id, text) VALUES ($item_page_id,'$body')");19 $result = $sql_0->query("SELECT MAX(`id`) FROM item_text"); 20 $item_page_id = ($sql_0->result($result, 0)) + 1; 21 $result = $sql_0->query("INSERT INTO item_text (id, text) VALUES ($item_page_id,'$body')"); 22 22 23 $result = $ mysql_0->query("SELECT MAX(`id`) FROM mail");24 $mail_id = ($ mysql_0->result($result, 0)) + 1;23 $result = $sql_0->query("SELECT MAX(`id`) FROM mail"); 24 $mail_id = ($sql_0->result($result, 0)) + 1; 25 25 26 26 $item_guid = ($item) ? gen_item_instance($to, $item, $stack) : 0; 27 27 28 $sql = "INSERT INTO mail (id,messageType,sender,receiver,subject,itemTextId,item_guid,item_template,expire_time,deliver_time,money,cod,checked) 29 VALUES ($mail_id, 0, '$from', '$to', '$subject', '$item_page_id', '$item_guid', '$item', '".(time() + (30*24*3600))."','".(time()+5)."', '$gold', 0, 0)"; 30 $result = $mysql_0->query($sql); 28 $result = $sql_0->query("INSERT INTO mail (id,messageType,sender,receiver,subject,itemTextId,item_guid,item_template,expire_time,deliver_time,money,cod,checked) 29 VALUES ($mail_id, 0, '$from', '$to', '$subject', '$item_page_id', '$item_guid', '$item', '".(time() + (30*24*3600))."','".(time()+5)."', '$gold', 0, 0)"); 31 30 32 31 if ($result) { 33 $ mysql_0->close();32 $sql_0->close(); 34 33 return $mail_id; 35 34 } else { 36 $ mysql_0->close();35 $sql_0->close(); 37 36 return 0; 38 37 } … … 45 44 global $lang_global, $mangos_db, $realm_id; 46 45 47 $ mysql_1 = new MySQL;48 $ mysql_1->connect($mangos_db[$realm_id]['addr'], $mangos_db[$realm_id]['user'], $mangos_db[$realm_id]['pass'], $mangos_db[$realm_id]['name'],true);46 $sql_1 = new SQL; 47 $sql_1->connect($mangos_db[$realm_id]['addr'], $mangos_db[$realm_id]['user'], $mangos_db[$realm_id]['pass'], $mangos_db[$realm_id]['name']); 49 48 50 $result = $ mysql_1->query("SELECT MAX(guid) FROM item_instance");51 $guid = $ mysql_1->result($result, 0) + 1;49 $result = $sql_1->query("SELECT MAX(guid) FROM item_instance"); 50 $guid = $sql_1->result($result, 0) + 1; 52 51 53 $result = $ mysql_1->query("SELECT flags,stackable,MaxDurability,spellcharges_1,spellcharges_2,52 $result = $sql_1->query("SELECT flags,stackable,MaxDurability,spellcharges_1,spellcharges_2, 54 53 spellcharges_3,spellcharges_4,spellcharges_5 FROM item_template 55 54 WHERE entry = '$item_id'"); 56 $item_template = $ mysql_1->fetch_row($result);55 $item_template = $sql_1->fetch_row($result); 57 56 58 57 if ($item_template[1] <= 1) $stack = 1; … … 86 85 $data = implode(" ",$item_data); 87 86 88 $result = $ mysql_1->query("INSERT INTO item_instance (guid, owner_guid, data) VALUES ($guid, '$owner','$data')");87 $result = $sql_1->query("INSERT INTO item_instance (guid, owner_guid, data) VALUES ($guid, '$owner','$data')"); 89 88 90 89 if ($result) { 91 $ mysql_1->close();90 $sql_1->close(); 92 91 return $guid; 93 92 } else { 94 $ mysql_1->close();93 $sql_1->close(); 95 94 return 0; 96 95 }
Note:
See TracChangeset
for help on using the changeset viewer.