Author Topic: destory inventory item  (Read 2365 times)

Offline arcanine

destory inventory item
« on: May 06, 2008, 04:20:29 am »
Hello there I've been running your smf shop script over at http://dinogod.com
for a while now, I have a shop full of "pokemon" which are test items which then are on display in signatures but I figured as a user how would someone get rid of the pokemon so I decided to try and make an item that would "kill" them all without admin help

Now I claim no knowledge of php at all but I tried to merge two snippets together to get what I wanted before I go ahead and test it I wanted to know
if someone could just check that I wouldn't be deleting my database by using this item or if there are any obvious security problems with this item or if it would work at all lol

thanks  :P

Code: [Select]
#
<?php
#
/**********************************************\
#
| SMFSHOP (Shop MOD for Simple Machines Forum) |
#
| (c) 2007 DanSoft Australia |
#
| http://www.dansoftaustralia.net/ |
#
\**********************************************/
#
 
#
//File: DisplayMessage.php
#
// Item - Display a message when used
#
 
#
// VERSION: Not included in SMFShop yet
#
 
#
class item_DisplayMessage extends itemTemplate {
#
function getItemDetails() {
#
$this->authorName "Daniel15";
#
$this->authorWeb "http://www.dansoftaustralia.net/";
#
$this->authorEmail "dansoft@dansoftaustralia.net";
#
 
#
$this->name "Poison";
#
$this->desc "Destories all items and pokemon";
#
$this->price 20;
#
#
$this->require_input false;
#
$this->can_use_item true;
#
}
#

#
 
#
function onUse() {
$result db_query("DELETE FROM {$db_prefix}shop_inventory
WHERE ownerid = 
{$ID_MEMBER}",
__FILE____LINE__);
return 
"Inventory destroyed";
}
#
 
#
}
#
 
#
?>

Offline spearfish

Re: destory inventory item
« Reply #1 on: May 19, 2008, 05:16:27 am »
Hmm... looks about right.

I noticed one problem.

The "class displayMessage" part should be changed to something like "class destroyStuff".

That's because the class declaration has to match the filename (e.g., HelloMyNameIsFred.php would need to have "class HelloMyNameIsFred extends.... at the top")

Other than that pretty good; just watch out it'll clear the whole inventory.