View Single Post
Old 03-25-2009, 01:33 PM
kisazeky kisazeky is offline
Join Date: Mar 2009
Posts: 44
Credits: 7,060
Default Currency for leveling up / Adoptable shop (Fixed again)

[size=medium]Note with this update! Please, re-run the queries to add the shop adoptables, if you have already installed it. Thanks.[/size]

[size=large]Important!! A way to prevent people stealing shop adoptables![/size]

Open adopt.php and find something like this in the code (it won't be exactly like mine):

PHP Code:
if($newID != $aID){
$stop 1;
$article_title "Oops";
$article_date date('Y-m-d');
$article_content "This Digimon is not available for adoption.";

below it, insert this:

PHP Code:
if($memberlevel != free){
$stop 1;
$article_content "You cannot adopt this pet for free!.";

[size=large]Earning money on level up
Step 1: Run this here MySQL query to add the money field in your users table:

PHP Code:
ADD money INT
Step 2: This is where the magic happens.

Download levelup.php and edit it to suit your site. Replace the number 10 with your desired amount of currency per level up.

Step 3: This is important if you still want people to be able to register. :P

Edit register2.php and find this line:
PHP Code:
mysql_query("INSERT INTO users VALUES ('', '$username', '$pass1','$email','free',)"); 
Replace it with:
PHP Code:
mysql_query("INSERT INTO users VALUES ('', '$username', '$pass1','$email','free','0')"); 
[size=large]Show the total amount of money to your users[/size]

Add this....

PHP Code:
if ($isloggedin == "yes"){
$query "SELECT * FROM `users` WHERE `username` = '".$luser."'";
$result mysql_query($query);
$num mysql_numrows($result);
    while (
$i 1) {
$money =@mysql_result($result,$i,"money");
$template replace(':WELCOMEORREGISTER:','',$template);
$template replace(':LOGINORACCT:''<p>Hi, '.$username.'
<p>Currency name: '
<p><a href="logout.php">Log out</a>' 
In between ...
PHP Code:
//$isloggedin = "no"; 
PHP Code:

//User is not logged in 
On all of your pages.

Shop to buy adoptables[/size]

Step 1:

Download shop.php, buy.php, and buyconfirm.php and upload them to your main folder.

Step 2:

Add adoptables for sale by running a query like this. Do not change the shop part unless you know what you're doing.
PHP Code:
INSERT INTO adoptables VALUES ('''name','level 0 image','shop','cost'
Then add the rank images, too. Put the image urls in place of the numbers. 1 will have its level 1 image, 2 the level 2 image, etc.

PHP Code:
INSERT INTO adoptable_rankimages VALUES ('name','1','2','3','4','5','6','7','8'