#1
|
||||
|
||||
Simple Inventory Script
NOTE: This is just a simple inventory addon/mod, not anything too fancy.
First, log in to phpMyAdmin or wherever you can manage your database and add a new table with the following: id, int(11), not null, auto_increment owner, varchar(40), latin1_general_ci, yes (NULL) itemtype, varchar(40), latin1_general_ci, yes (NULL) imgurl, varchar(120), latin1_general_ci, yes (NULL) This allows for ID search if such a mod is made, the owner, what kind of item it is, and its image's URL. Now create a new page with this script. PHP Code:
Now, in order for users to hold items, they need them to begin with, correct? To make a page (or part of a page) hand out an item to the current user, add this script where needed: PHP Code:
If I missed anything, please tell me, as well as if you find any glitches. This is my first major modification, so it can be improved. So give me feedback EDIT: btw, if you need a replacement image or temporary image for an item, you may use what I made; Code:
http://img37.imageshack.us/img37/1815/74598913.png
__________________
Yacker Quote:
Last edited by The Codfin Keeper; 02-23-2011 at 02:56 PM. |
#2
|
|||
|
|||
this was very helpful, thanks! :3
|
#3
|
||||
|
||||
I'm glad it helped you.
__________________
Yacker Quote:
|
#4
|
||||
|
||||
YOU POSTED IT!
This is definitely going to be useful. I LOL'd at the text version of the smiley. XDDDDD /off-topic |
#5
|
||||
|
||||
Yus, I finally posted it.
Now all we need is an awesome face smiley...
__________________
Yacker Quote:
|
#6
|
||||
|
||||
I'm having a problem with this script, it's not showing up and telling me I have an error on line 113, which is the following;
$template = file_get_contents($file); It's saying it can't find the file? |
#7
|
||||
|
||||
Well this script is incompatible with Mys v1.2.x, you will have to make slight modifications for it to work. Simply take out the site information at the beginning and template definition at the bottom of this script file and it should work just fine.
__________________
Mysidia Adoptables, a free and ever-improving script for aspiring adoptables/pets site. |
#8
|
||||
|
||||
I tried doing that and it looked okay, but then it kept saying I wasn't logged in every time I visited. Someone helped me edit the script a little, i'll try again.
|
#9
|
|||
|
|||
Well, did you remember to include the functions.php file?
|
#10
|
||||
|
||||
my inventory script looks like this right now;
Code:
<?php include("inc/functions.php"); include("inc/config.php"); //***************// // START SCRIPT // //***************// $themeurl = grabanysetting("themeurl"); $links = getlinks(); $ads = getads("any"); $pagecontent = getsitecontent("index"); $article_title = $pagecontent[title]; $article_content = $pagecontent[content]; $article_content = nl2br($article_content); $article_title = "Your Inventory"; if ($isloggedin == "yes") { $article_content = "Here you can see a list of items that you have collected.<table width='500' border='2'> <tr> <td width='200'><strong>Picture:</strong></td> <td width='230'><strong>Item Type: </strong></td> <td width='70'><strong>ID Number:</strong></td> </tr>"; $query = "SELECT * FROM ".$prefix."useritems WHERE Owner = '$loggedinname'"; $result = mysql_query($query); $num = mysql_numrows($result); $i=0; while ($i < $num) { $iid=@mysql_result($result,$i,"ID"); $object=@mysql_result($result,$i,"Item"); $url=@mysql_result($result,$i,"imageurl"); $article_content = $article_content."<tr> <td><center><img src='".$url."'></center></td> <td><center>".$object."</center></td> <td><center>".$iid."</center></td> </tr>"; unset($iid); unset($object); $i = $i + 1; } $article_content = $article_content."</table>"; } else { $article_content = "You must be logged in to view items."; } //***************// // OUTPUT PAGE // //***************// echo showpage($article_title, $article_content, $date); ?> the page looks fine when i'm logged out though. |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Blank Inventory Page | ilrak | Questions and Supports | 5 | 09-23-2014 10:03 PM |
Simple adopts | superdude44 | Adoptables Buzz | 2 | 06-03-2013 06:09 PM |
limited inventory idea | schepers12 | Suggestions and Feature Requests | 3 | 05-19-2013 06:28 PM |
Simple Feature | Abronsyth | Suggestions and Feature Requests | 3 | 03-31-2013 09:48 AM |
Simple adopts | superdude44 | Adoptables Sites Showcase | 7 | 05-01-2012 10:49 PM |
What's New? |
What's Hot? |
What's Popular? |