Author Topic: Bug in trade centre  (Read 2789 times)

Offline TimeVortex

Bug in trade centre
« on: December 23, 2007, 07:02:39 pm »
One of my users found a bug in the SMFshop mod: when he bought an item in the trade centre, the shop always said he bought it from me (user #1), whilst in fact he had bought it from someone completely different.

Since it didn't seem to be fixed in the SVN trunk, I tracked this down to a query in Shop-Trade.php, line 89-95:

Code: [Select]
$result = db_query("
SELECT it.name, inv.tradecost, inv.trading, inv.ownerid, m.realName,
m.emailAddress
FROM {$db_prefix}shop_inventory AS inv, {$db_prefix}shop_items AS it,
{$db_prefix}members AS m
WHERE inv.id = {$_GET['id']} AND inv.itemid = it.id
LIMIT 1", __FILE__, __LINE__);


I replaced it with:
Code: [Select]
$result = db_query("
SELECT it.name, inv.tradecost, inv.trading, inv.ownerid, m.realName,
m.emailAddress
FROM {$db_prefix}shop_inventory AS inv, {$db_prefix}shop_items AS it
INNER JOIN {$db_prefix}members AS m ON inv.ownerid = m.ID_MEMBER
WHERE inv.id = {$_GET['id']} AND inv.itemid = it.id
LIMIT 1", __FILE__, __LINE__);

And that fixed it.

Offline Daniel15

Re: Bug in trade centre
« Reply #1 on: February 15, 2008, 07:26:09 am »
Thanks Aaron, I'll take a look at this and fix it as soon as possible :)