0 Members and 1 Guest are viewing this topic.
$query=("INSERT INTO #___depot (itemDatetime, itemHolder, itemName, itemLowid, itemHighid, itemQl, itemLowcrc, itemHighcrc, itemColour, itemUrl, itemActive) VALUES ('".$DatetimeNow."', '".$items[0]['holder']."', '".$items[0]['name']."', '".$items[0]['lowid']."', '".$items[0]['highid']."', '".$items[0]['ql']."', '".$items[0]['lowcrc']."', '".$items[0]['highcrc']."', '".$items[0]['colour']."', '$fitemname', 'Y')");
//if($result1[0][0] < 2) $candel = true;
And the auto_increment function is sometimes broken after that Suddenly I had the ID "12259xxxx" after ID "4" But it doesn't happen everytime (the ID problem, the Umlaut problem is repeatable).
$depotID = time();
$query=("INSERT INTO #___depot (id, itemName, itemURL, itemHolder) VALUES ('" . $depotID . "', '" . $fitemname . "', '', '" . $name . "')");
I changed the SQL query as below (at row 124)
Wouldn't it be better to disable the possibility of adding a normal text instead an item link?
function depot_add($itemname, $name) { $itemname = str_replace('Ä','Ae',$itemname); $itemname = str_replace('ä','ae',$itemname); $itemname = str_replace('Ö','Oe',$itemname); $itemname = str_replace('ö','oe',$itemname); $itemname = str_replace('Ü','Ue',$itemname); $itemname = str_replace('ü','ue',$itemname); $itemname = str_replace('ß','ss',$itemname); $sql = "SELECT org_rank_id FROM #___whois WHERE nickname = '$name'"; $result = $this -> bot -> db -> select($sql); if ($this -> bot -> guildbot && $result[0][0] < 6) { if(is_numeric($dimension)) { $itemPattern = '(<a href="itemref:\/\/([0-9]*)\/([0-9]*)\/([0-9]*)\/([0-9a-f]*\:[0-9a-f]*\:[0-9a-f]*:[0-9a-f]*)\/([0-9a-f]*\:[0-9a-f]*\:[0-9a-f]*:[0-9a-f]*)"><font color=#([0-9a-f]*)>\[([\\-a-zA-Z0-9_\'&\s\-]*)\]<\/font><\/a>)'; $posPattern = "/<a href=(.+)$/i"; } else { $itemPattern = '(<a style="text-decoration:none" href="itemref:\/\/([0-9]*)\/([0-9]*)\/([0-9]*)\/([0-9a-f]*\:[0-9a-f]*\:[0-9a-f]*:[0-9a-f]*)\/([0-9a-f]*\:[0-9a-f]*\:[0-9a-f]*:[0-9a-f]*)"><font color=#([0-9a-f]*)>\[([\\-a-zA-Z0-9_\'&\s\-]*)\]<\/font><\/a>)'; $posPattern = "/<a (.+) href=(.+)$/i"; } $fitemname = addslashes($itemname); $pos = preg_match($posPattern, $itemname,$info); $DatetimeNow = date('Y-m-d H:i:s'); //Debug statement, uncomment to see the values are being posted by the user. //$this->bot->log("Depot", "Add_Item", "Item string [$itemname] Cutdown[" .str_replace('a','b',$itemname). "] Info [$info]"); if ($pos) { $count = preg_match_all('/'.$itemPattern.'/i', $itemname, $matches, PREG_SET_ORDER); foreach($matches as $match) { $item['holder'] = $name; if (is_numeric($match[2])) { $item['lowid'] = $match[2]; } if (is_numeric($match[3])) { $item['highid'] = $match[3]; } if (is_numeric($match[4])) { $item['ql'] = $match[4]; } $item['lowcrc'] = $match[5]; $item['highcrc'] = $match[6]; $item['colour'] = $match[7]; $item['name'] = addslashes($match[8]); $item['name'] = str_replace('Ae','Ä',$item['name']); $item['name'] = str_replace('ae','ä',$item['name']); $item['name'] = str_replace('Oe','Ö',$item['name']); $item['name'] = str_replace('oe','ö',$item['name']); $item['name'] = str_replace('Ue','Ü',$item['name']); $item['name'] = str_replace('ue','ü',$item['name']); $items[] = $item; } $query=("INSERT INTO #___depot_eng (itemDatetime, itemHolder, itemName, itemLowid, itemHighid, itemQl, itemLowcrc, itemHighcrc, itemColour, itemUrl, itemActive) VALUES ('".$DatetimeNow."', '".$items[0]['holder']."', '".$items[0]['name']."', '".$items[0]['lowid']."', '".$items[0]['highid']."', '".$items[0]['ql']."', '".$items[0]['lowcrc']."', '".$items[0]['highcrc']."', '".$items[0]['colour']."', '$fitemname', 'Y')"); $this -> bot -> db -> query($query); $depotID = mysql_insert_id(); $strmsg = "Thank you, your item has been added to the database as id #" . $depotID; } else { $strmsg= "The link/item you are trying to share is not in a valid format!"; } } else $strmsg = "You must be at least a Unit Member of the org to insert items into the org depot."; return $strmsg; }
Dhlbot [GROUP] [MSG] [Last Crusade] ChuckTaylor: !depot add <a style="text-decoration:none" href="itemref://3746106/3746106/41/689e89fa:1e5fa7f7:a56ecf10:307d132f/689e89fa:1e5fa7f7:a56ecf10:307d132f">[Heretic's Vambraces][/link]MySQL error (# 0) on query: INSERT INTO dhlbot_depot (itemDatetime, itemHolder,itemName, itemLowid, itemHighid, itemQl, itemLowcrc, itemHighcrc, itemColour, itemUrl, itemActive) VALUES ('2009-02-05 08:09:11', 'ChuckTaylor', 'Heretic\'s Vambraces', '3746106', '3746106', '41', '689e89fa:1e5fa7f7:a56ecf10:307d132f', '689e89fa:1e5fa7f7:a56ecf10:307d132f', '6d8dff', '<a style=\"text-decoration:none\" href=\"itemref://3746106/3746106/41/689e89fa:1e5fa7f7:a56ecf10:307d132f/689e89fa:1e5fa7f7:a56ecf10:307d132f\"><font color=#6d8dff>[Heretic\'s Vambraces]</font></a>', 'Y')Unknown column 'itemDatetime' in 'field list'Dhlbot [GROUP] [MSG] [Last Crusade] Dhlbot: Thank you, your item has beenadded to the database as id #0Dhlbot [GROUP] [MSG] [Last Crusade] ChuckTaylor: !depotMySQL error (# 0) on query: SELECT id, itemName, itemURL, itemHolder, itemColour, itemLowid, itemQl, itemDatetime, itemReq FROM dhlbot_depot WHERE itemActive='Y' ORDER BY itemDatetime DESCUnknown column 'itemDatetime' in 'field list'Dhlbot [GROUP] [MSG] [Last Crusade] Dhlbot: No items exist in the org depot.