Mysidia Adoptables Support Forum

Mysidia Adoptables Support Forum (http://www.mysidiaadoptables.com/forum/index.php)
-   Addons/Mods Graveyard (http://www.mysidiaadoptables.com/forum/forumdisplay.php?f=41)
-   -   Currency for leveling up / Adoptable shop (Fixed again) (http://www.mysidiaadoptables.com/forum/showthread.php?t=561)

kisazeky 03-25-2009 01:33 PM

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
[/size]
Step 1: Run this here MySQL query to add the money field in your users table:

PHP Code:

ALTER TABLE users
ADD money INT
(11NULL DEFAULT '0' 

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);
$i=0;
    while (
$i 1) {
    
    
$money =@mysql_result($result,$i,"money");
    
$i++;
            }
$template replace(':WELCOMEORREGISTER:','',$template);
$template replace(':LOGINORACCT:''<p>Hi, '.$username.'
<p>Currency name: '
.$money.'
<p><a href="logout.php">Log out</a>' 
,$template); 

In between ...
PHP Code:

//$isloggedin = "no"; 

and...
PHP Code:

}
else{

//User is not logged in 

On all of your pages.

[size=large]
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'


BMR777 03-25-2009 01:57 PM

RE: [In Development] Currency for leveling up
 
Well, using your system of altering the users table will break the user registration system. :P

You would want to also find in register2.php:

PHP Code:

mysql_query("INSERT INTO users VALUES ('', '$username', '$pass1','$email','free')"); 

Replace With:

PHP Code:

mysql_query("INSERT INTO users VALUES ('', '$username', '$pass1','$email','free','0')"); 

You need to add the extra column in there for the user's money. If the columns don't match, MySQL freaks out and new users are not registered correctly.

Also, I would change:

Code:

ALTER TABLE users
ADD money VARCHAR(11) NULL DEFAULT '0'

To:

Code:

ALTER TABLE users
ADD money INT

Use INT when only a number is expected. :)

Brandon

Killgore 03-25-2009 05:33 PM

RE: [In Development] Currency for leveling up
 
So Brandon, would i be able to fuse this with my idea i was working on? If so, how?

BMR777 03-25-2009 05:37 PM

RE: [In Development] Currency for leveling up
 
Quote:

Originally Posted by Killgore
So Brandon, would i be able to fuse this with my idea i was working on? If so, how?

I would suggest do the same, except add a second column to the database to account for pearls and emeralds.

Killgore 03-25-2009 05:40 PM

RE: [In Development] Currency for leveling up
 
Okay. But there's still the dilemma that there's a chance of getting one out of five colors for each pearl or emerald. I'm guessing I'd need to create a field for each color pearl and emerald?

BMR777 03-25-2009 06:31 PM

RE: [In Development] Currency for leveling up
 
PHP Code:

$color "";
$number rand(1,5); // Get random number between 1 and 5

if($number == 1){
$color "redpebbleimage.gif";
}
else if(
$number == 2){
$color "greenpebbleimage.gif";
}
else if(... and 
so on 

Just do that to assign a random pebble image and save in the db. :)

rosepose 03-25-2009 07:22 PM

RE: [In Development] Currency for leveling up
 
Does it work right now?

kisazeky 03-25-2009 10:24 PM

RE: [In Development] Currency for leveling up
 
Yes rosepose, getting currency for leveling up works. Just make sure to include Brandon's amendment or else people can't register anymore. :P

What's in progress still is the shop for buying adoptables with the money.

Ashje 03-26-2009 12:29 AM

RE: [In Development] Currency for leveling up
 
Could you edit the first post and add Brandon's extra part because I fail at this stuff...Thanks.

rosepose 03-26-2009 12:10 PM

RE: [In Development] Currency for leveling up
 
Thanks :) I'll try to add this to SE if the host decides to work ><

kisazeky 03-26-2009 12:45 PM

RE: [In Development] Currency for leveling up
 
Quote:

Originally Posted by Ashje
Could you edit the first post and add Brandon's extra part because I fail at this stuff...Thanks.

Done. ^^

rosepose 03-26-2009 01:08 PM

RE: [In Development] Currency for leveling up
 
This looks great :3 I've sent you a PM on the SE forums, kisazeky...

rosepose 03-26-2009 07:33 PM

RE: [In Development] Currency for leveling up
 
Just a quick question: Where do I put the login message? Because there's text in between the two fields you tell us to paste the code into.

Ashje 03-27-2009 12:21 AM

RE: [In Development] Currency for leveling up
 
Quote:

Originally Posted by kisazeky
Quote:

Originally Posted by Ashje
Could you edit the first post and add Brandon's extra part because I fail at this stuff...Thanks.

Done. ^^

Awesome thanks =)


Quote:

Originally Posted by rosepose
Just a quick question: Where do I put the login message? Because there's text in between the two fields you tell us to paste the code into.

I have that problem as well. I tried replacing and adding to the original text but it all doesn't work. rosepose, I suggest you back up your system before doing any of this.

zhiichiro 03-27-2009 06:32 PM

RE: [In Development] Currency for leveling up
 
MR, CAN I ASK YOU SOMETHING!!!??


HOW CAN I CHANGE THE "DIGIMON" THING THAT SHOWS WHEN I VISIT A PET??

AND HOW CAN I CHANGE THE CURRENCY?? I THINK IT SAYS "BITS"..

I DONT EVEN KNOW WHAT "BITS" MEANS..

kisazeky 03-27-2009 07:46 PM

RE: [In Development] Currency for leveling up
 
Quote:

Originally Posted by rosepose
Just a quick question: Where do I put the login message? Because there's text in between the two fields you tell us to paste the code into.

Put the login message in the place where you say "Welcome back, $username" or whatever.

Techdude7 03-27-2009 08:08 PM

RE: [In Development] Currency for leveling up
 
I like it ^^ Thanks ^^ I am going to add it to my site right away!

Ashje 03-28-2009 03:58 AM

RE: [In Development] Currency for leveling up
 
This doesn't work. It shows this error: "Parse error: syntax error, unexpected T_ELSE in /home/--------/public_html/index.php on line 160"

It won't show it when you go there now because I reversed Step 3 but if I were to put it in then that error would appear.

I followed everything exactly. This is my index.php file:

Code:

<?php

// Easy Adoptables Script by Brandon Rusnak
// Get our includes out of the way

include("inc/functions.php");
include("inc/config.php");
include("inc/settings.php");
include("inc/nbbc.php");  // BBCODE Parser
$bbcode = new BBCode;

// Connect to our database

$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql database!');
mysql_select_db($dbname);


//Set up our login info...
$username = "";
$password = "";

//Check for cookie

if (isset($_COOKIE['adoptu']) and isset($_COOKIE['adoptp'])){

$username = $_COOKIE['adoptu'];
$password = $_COOKIE['adoptp'];

$username = preg_replace("/[^a-zA-Z0-9\\040.]/", "", $username);
$password = preg_replace("/[^a-zA-Z0-9s]/", "", $password);

//Run login operation
$query = "SELECT * FROM users WHERE username = '$username'";
$result = mysql_query($query);
$num = mysql_numrows($result);

//Loop out code
$i=0;
while ($i < 1) {

$luser=@mysql_result($result,$i,"username");
$lpass=@mysql_result($result,$i,"password");

$i++;
}

        if($username == $luser and $password == $lpass){
                $isloggedin = "yes";
        }
        else{
        if (isset($_COOKIE['adoptu'])){
        $past = time() - 10;
        setcookie("adoptu",$username,$past);
        }

        if (isset($_COOKIE['adoptp'])){
        $past = time() - 10;
        setcookie("adoptp",$password,$past);
        }
        $isloggedin = "no";
        }

}
else
{
//User is not logged in
$isloggedin = "no";

}



// Define our Template File

$file = $current_theme;



// Get our content for the index page

$query = "SELECT * FROM article_content WHERE page = 'index'";
$result = mysql_query($query);
$num = mysql_numrows($result);

//Loop out code
$i=0;
while ($i < 1) {

$article_title=mysql_result($result,$i,"title");
$article_date=mysql_result($result,$i,"date");
$article_content=mysql_result($result,$i,"content");

$i++;
}

$article_title = stripslashes($article_title);
$article_content = stripslashes($article_content);

$article_content = $bbcode->Parse($article_content);

// Run the BBCODE parser on the content

// Should we show the extra pages in the nav bar?

$link1 = "";
if($show_extra_page1 == "yes"){
$link1 = "<li><a href='$extra_page1_link'>$extra_page1_name<span class='tab-l'></span><span class='tab-r'></span></a></li>";
}

$link2 = "";
if($show_extra_page2 == "yes"){
$link2 = "<li><a href='$extra_page2_link'>$extra_page2_name<span class='tab-l'></span><span class='tab-r'></span></a></li>";
}

// Do the template changes and echo the ready template

$template = file_get_contents($file);
$template = replace(':SITETITLE:',$site_title,$template);
$template = replace(':SITENAME:',$site_name,$template);
$template = replace(':ARTICLETITLE:',$article_title,$template);
$template = replace(':ARTICLEDATE:',$article_date,$template);
$template = replace(':ARTICLECONTENT:',$article_content,$template);
$template = replace(':LINK1:',$link1,$template);
$template = replace(':LINK2:',$link2,$template);
$template = replace(':LINK3:',$link3,$template);

//Get the featured adoptable...
$featured = getfeatured();
$template = replace(':FEATURED:',$featured,$template);

//Ad Management
$header = @file_get_contents("ads/header.txt");
$footer = @file_get_contents("ads/footer.txt");
$tower = @file_get_contents("ads/tower.txt");

$header = stripslashes($header);
$footer = stripslashes($footer);
$tower = stripslashes($tower);

$template = replace(':HEADERAD:',$header,$template);
$template = replace(':FOOTERAD:',$footer,$template);
$template = replace(':TOWERAD:',$tower,$template);

//Is the user logged in?
//$isloggedin = "no";
if ($isloggedin == "yes"){
$query = "SELECT * FROM `users` WHERE `username` = '".$luser."'";
$result = mysql_query($query);
$num = mysql_numrows($result);
$i=0;
    while ($i < 1) {
   
    $money =@mysql_result($result,$i,"money");
    $i++;
            }
$template = replace(':WELCOMEORREGISTER:','',$template);
$template = replace(':LOGINORACCT:', '<p>Hi, '.$username.'
<p>Currency name: '.$money.'
<p><a href="logout.php">Log out</a>' ,$template);
else{

//User is not logged in
$template = replace(':WELCOMEORREGISTER:','<u>Member Login:</u>',$template);
$loginform = "<form name='form1' method='post' action='login.php'>
  <p>Username:
    <input name='username' type='text' id='username'>
</p>
  <p>Password:
    <input name='password' type='password' id='password'>
</p>
  <p>
    <input type='submit' name='Submit' value='Submit'>
  </p>
  <p>Don't have an account?<br>
  <a href='register.php'>Register Free</a>  </p>
</form>
";
$template = replace(':LOGINORACCT:', $loginform ,$template);
}

echo $template;
?>

Please help. Thanks =)

mattalien 03-28-2009 04:23 AM

RE: [In Development] Currency for leveling up
 
Quote:

Originally Posted by Ashje
This doesn't work. It shows this error: "Parse error: syntax error, unexpected T_ELSE in /home/--------/public_html/index.php on line 160"

It won't show it when you go there now because I reversed Step 3 but if I were to put it in then that error would appear.

I followed everything exactly. This is my index.php file:

Code:

<?php

// Easy Adoptables Script by Brandon Rusnak
// Get our includes out of the way

include("inc/functions.php");
include("inc/config.php");
include("inc/settings.php");
include("inc/nbbc.php");  // BBCODE Parser
$bbcode = new BBCode;

// Connect to our database

$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql database!');
mysql_select_db($dbname);


//Set up our login info...
$username = "";
$password = "";

//Check for cookie

if (isset($_COOKIE['adoptu']) and isset($_COOKIE['adoptp'])){

$username = $_COOKIE['adoptu'];
$password = $_COOKIE['adoptp'];

$username = preg_replace("/[^a-zA-Z0-9\\040.]/", "", $username);
$password = preg_replace("/[^a-zA-Z0-9s]/", "", $password);

//Run login operation
$query = "SELECT * FROM users WHERE username = '$username'";
$result = mysql_query($query);
$num = mysql_numrows($result);

//Loop out code
$i=0;
while ($i < 1) {

$luser=@mysql_result($result,$i,"username");
$lpass=@mysql_result($result,$i,"password");

$i++;
}

        if($username == $luser and $password == $lpass){
                $isloggedin = "yes";
        }
        else{
        if (isset($_COOKIE['adoptu'])){
        $past = time() - 10;
        setcookie("adoptu",$username,$past);
        }

        if (isset($_COOKIE['adoptp'])){
        $past = time() - 10;
        setcookie("adoptp",$password,$past);
        }
        $isloggedin = "no";
        }

}
else
{
//User is not logged in
$isloggedin = "no";

}



// Define our Template File

$file = $current_theme;



// Get our content for the index page

$query = "SELECT * FROM article_content WHERE page = 'index'";
$result = mysql_query($query);
$num = mysql_numrows($result);

//Loop out code
$i=0;
while ($i < 1) {

$article_title=mysql_result($result,$i,"title");
$article_date=mysql_result($result,$i,"date");
$article_content=mysql_result($result,$i,"content");

$i++;
}

$article_title = stripslashes($article_title);
$article_content = stripslashes($article_content);

$article_content = $bbcode->Parse($article_content);

// Run the BBCODE parser on the content

// Should we show the extra pages in the nav bar?

$link1 = "";
if($show_extra_page1 == "yes"){
$link1 = "<li><a href='$extra_page1_link'>$extra_page1_name<span class='tab-l'></span><span class='tab-r'></span></a></li>";
}

$link2 = "";
if($show_extra_page2 == "yes"){
$link2 = "<li><a href='$extra_page2_link'>$extra_page2_name<span class='tab-l'></span><span class='tab-r'></span></a></li>";
}

// Do the template changes and echo the ready template

$template = file_get_contents($file);
$template = replace(':SITETITLE:',$site_title,$template);
$template = replace(':SITENAME:',$site_name,$template);
$template = replace(':ARTICLETITLE:',$article_title,$template);
$template = replace(':ARTICLEDATE:',$article_date,$template);
$template = replace(':ARTICLECONTENT:',$article_content,$template);
$template = replace(':LINK1:',$link1,$template);
$template = replace(':LINK2:',$link2,$template);
$template = replace(':LINK3:',$link3,$template);

//Get the featured adoptable...
$featured = getfeatured();
$template = replace(':FEATURED:',$featured,$template);

//Ad Management
$header = @file_get_contents("ads/header.txt");
$footer = @file_get_contents("ads/footer.txt");
$tower = @file_get_contents("ads/tower.txt");

$header = stripslashes($header);
$footer = stripslashes($footer);
$tower = stripslashes($tower);

$template = replace(':HEADERAD:',$header,$template);
$template = replace(':FOOTERAD:',$footer,$template);
$template = replace(':TOWERAD:',$tower,$template);

//Is the user logged in?
//$isloggedin = "no";
if ($isloggedin == "yes"){
$query = "SELECT * FROM `users` WHERE `username` = '".$luser."'";
$result = mysql_query($query);
$num = mysql_numrows($result);
$i=0;
    while ($i < 1) {
   
    $money =@mysql_result($result,$i,"money");
    $i++;
            }
$template = replace(':WELCOMEORREGISTER:','',$template);
$template = replace(':LOGINORACCT:', '<p>Hi, '.$username.'
<p>Currency name: '.$money.'
<p><a href="logout.php">Log out</a>' ,$template);
else{

//User is not logged in
$template = replace(':WELCOMEORREGISTER:','<u>Member Login:</u>',$template);
$loginform = "<form name='form1' method='post' action='login.php'>
  <p>Username:
    <input name='username' type='text' id='username'>
</p>
  <p>Password:
    <input name='password' type='password' id='password'>
</p>
  <p>
    <input type='submit' name='Submit' value='Submit'>
  </p>
  <p>Don't have an account?<br>
  <a href='register.php'>Register Free</a>  </p>
</form>
";
$template = replace(':LOGINORACCT:', $loginform ,$template);
}

echo $template;
?>

Please help. Thanks =)

With yours, you were missing one of these: "}"

This is the correct code :)

Code:

<?php

// Easy Adoptables Script by Brandon Rusnak
// Get our includes out of the way

include("inc/functions.php");
include("inc/config.php");
include("inc/settings.php");
include("inc/nbbc.php");  // BBCODE Parser
$bbcode = new BBCode;

// Connect to our database

$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql database!');
mysql_select_db($dbname);


//Set up our login info...
$username = "";
$password = "";

//Check for cookie

if (isset($_COOKIE['adoptu']) and isset($_COOKIE['adoptp'])){

$username = $_COOKIE['adoptu'];
$password = $_COOKIE['adoptp'];

$username = preg_replace("/[^a-zA-Z0-9\\040.]/", "", $username);
$password = preg_replace("/[^a-zA-Z0-9s]/", "", $password);

//Run login operation
$query = "SELECT * FROM users WHERE username = '$username'";
$result = mysql_query($query);
$num = mysql_numrows($result);

//Loop out code
$i=0;
while ($i < 1) {

$luser=@mysql_result($result,$i,"username");
$lpass=@mysql_result($result,$i,"password");

$i++;
}

    if($username == $luser and $password == $lpass){
        $isloggedin = "yes";
    }
    else{
    if (isset($_COOKIE['adoptu'])){
    $past = time() - 10;
    setcookie("adoptu",$username,$past);
    }

    if (isset($_COOKIE['adoptp'])){
    $past = time() - 10;
    setcookie("adoptp",$password,$past);
    }
    $isloggedin = "no";
    }

}
else
{
//User is not logged in
$isloggedin = "no";

}



// Define our Template File

$file = $current_theme;



// Get our content for the index page

$query = "SELECT * FROM article_content WHERE page = 'index'";
$result = mysql_query($query);
$num = mysql_numrows($result);

//Loop out code
$i=0;
while ($i < 1) {

$article_title=mysql_result($result,$i,"title");
$article_date=mysql_result($result,$i,"date");
$article_content=mysql_result($result,$i,"content");

$i++;
}

$article_title = stripslashes($article_title);
$article_content = stripslashes($article_content);

$article_content = $bbcode->Parse($article_content);

// Run the BBCODE parser on the content

// Should we show the extra pages in the nav bar?

$link1 = "";
if($show_extra_page1 == "yes"){
$link1 = "<li><a href='$extra_page1_link'>$extra_page1_name<span class='tab-l'></span><span class='tab-r'></span></a></li>";
}

$link2 = "";
if($show_extra_page2 == "yes"){
$link2 = "<li><a href='$extra_page2_link'>$extra_page2_name<span class='tab-l'></span><span class='tab-r'></span></a></li>";
}

// Do the template changes and echo the ready template

$template = file_get_contents($file);
$template = replace(':SITETITLE:',$site_title,$template);
$template = replace(':SITENAME:',$site_name,$template);
$template = replace(':ARTICLETITLE:',$article_title,$template);
$template = replace(':ARTICLEDATE:',$article_date,$template);
$template = replace(':ARTICLECONTENT:',$article_content,$template);
$template = replace(':LINK1:',$link1,$template);
$template = replace(':LINK2:',$link2,$template);
$template = replace(':LINK3:',$link3,$template);

//Get the featured adoptable...
$featured = getfeatured();
$template = replace(':FEATURED:',$featured,$template);

//Ad Management
$header = @file_get_contents("ads/header.txt");
$footer = @file_get_contents("ads/footer.txt");
$tower = @file_get_contents("ads/tower.txt");

$header = stripslashes($header);
$footer = stripslashes($footer);
$tower = stripslashes($tower);

$template = replace(':HEADERAD:',$header,$template);
$template = replace(':FOOTERAD:',$footer,$template);
$template = replace(':TOWERAD:',$tower,$template);

//Is the user logged in?
//$isloggedin = "no";
if ($isloggedin == "yes"){
$query = "SELECT * FROM `users` WHERE `username` = '".$luser."'";
$result = mysql_query($query);
$num = mysql_numrows($result);
$i=0;
    while ($i < 1) {
   
    $money =@mysql_result($result,$i,"money");
    $i++;
            }
$template = replace(':WELCOMEORREGISTER:','',$template);
$template = replace(':LOGINORACCT:', '<p>Hi, '.$username.'
<p>Currency name: '.$money.'
<p><a href="logout.php">Log out</a>' ,$template);

}
else{

//User is not logged in
$template = replace(':WELCOMEORREGISTER:','<u>Member Login:</u>',$template);
$loginform = "<form name='form1' method='post' action='login.php'>
  <p>Username:
    <input name='username' type='text' id='username'>
</p>
  <p>Password:
    <input name='password' type='password' id='password'>
</p>
  <p>
    <input type='submit' name='Submit' value='Submit'>
  </p>
  <p>Don't have an account?<br>
  <a href='register.php'>Register Free</a>  </p>
</form>
";
$template = replace(':LOGINORACCT:', $loginform ,$template);
}

echo $template;
?>

:P

Techdude7 03-28-2009 11:39 AM

RE: [In Development] Currency for leveling up
 
I like it but.....I can't put it on....I can't find the right place for it :(

Ashje 03-28-2009 03:41 PM

RE: [In Development] Currency for leveling up
 
Quote:

Originally Posted by mattalien
Quote:

Originally Posted by Ashje
This doesn't work. It shows this error: "Parse error: syntax error, unexpected T_ELSE in /home/--------/public_html/index.php on line 160"

It won't show it when you go there now because I reversed Step 3 but if I were to put it in then that error would appear.

I followed everything exactly. This is my index.php file:

Code:

<?php

// Easy Adoptables Script by Brandon Rusnak
// Get our includes out of the way

include("inc/functions.php");
include("inc/config.php");
include("inc/settings.php");
include("inc/nbbc.php");  // BBCODE Parser
$bbcode = new BBCode;

// Connect to our database

$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql database!');
mysql_select_db($dbname);


//Set up our login info...
$username = "";
$password = "";

//Check for cookie

if (isset($_COOKIE['adoptu']) and isset($_COOKIE['adoptp'])){

$username = $_COOKIE['adoptu'];
$password = $_COOKIE['adoptp'];

$username = preg_replace("/[^a-zA-Z0-9\\040.]/", "", $username);
$password = preg_replace("/[^a-zA-Z0-9s]/", "", $password);

//Run login operation
$query = "SELECT * FROM users WHERE username = '$username'";
$result = mysql_query($query);
$num = mysql_numrows($result);

//Loop out code
$i=0;
while ($i < 1) {

$luser=@mysql_result($result,$i,"username");
$lpass=@mysql_result($result,$i,"password");

$i++;
}

        if($username == $luser and $password == $lpass){
                $isloggedin = "yes";
        }
        else{
        if (isset($_COOKIE['adoptu'])){
        $past = time() - 10;
        setcookie("adoptu",$username,$past);
        }

        if (isset($_COOKIE['adoptp'])){
        $past = time() - 10;
        setcookie("adoptp",$password,$past);
        }
        $isloggedin = "no";
        }

}
else
{
//User is not logged in
$isloggedin = "no";

}



// Define our Template File

$file = $current_theme;



// Get our content for the index page

$query = "SELECT * FROM article_content WHERE page = 'index'";
$result = mysql_query($query);
$num = mysql_numrows($result);

//Loop out code
$i=0;
while ($i < 1) {

$article_title=mysql_result($result,$i,"title");
$article_date=mysql_result($result,$i,"date");
$article_content=mysql_result($result,$i,"content");

$i++;
}

$article_title = stripslashes($article_title);
$article_content = stripslashes($article_content);

$article_content = $bbcode->Parse($article_content);

// Run the BBCODE parser on the content

// Should we show the extra pages in the nav bar?

$link1 = "";
if($show_extra_page1 == "yes"){
$link1 = "<li><a href='$extra_page1_link'>$extra_page1_name<span class='tab-l'></span><span class='tab-r'></span></a></li>";
}

$link2 = "";
if($show_extra_page2 == "yes"){
$link2 = "<li><a href='$extra_page2_link'>$extra_page2_name<span class='tab-l'></span><span class='tab-r'></span></a></li>";
}

// Do the template changes and echo the ready template

$template = file_get_contents($file);
$template = replace(':SITETITLE:',$site_title,$template);
$template = replace(':SITENAME:',$site_name,$template);
$template = replace(':ARTICLETITLE:',$article_title,$template);
$template = replace(':ARTICLEDATE:',$article_date,$template);
$template = replace(':ARTICLECONTENT:',$article_content,$template);
$template = replace(':LINK1:',$link1,$template);
$template = replace(':LINK2:',$link2,$template);
$template = replace(':LINK3:',$link3,$template);

//Get the featured adoptable...
$featured = getfeatured();
$template = replace(':FEATURED:',$featured,$template);

//Ad Management
$header = @file_get_contents("ads/header.txt");
$footer = @file_get_contents("ads/footer.txt");
$tower = @file_get_contents("ads/tower.txt");

$header = stripslashes($header);
$footer = stripslashes($footer);
$tower = stripslashes($tower);

$template = replace(':HEADERAD:',$header,$template);
$template = replace(':FOOTERAD:',$footer,$template);
$template = replace(':TOWERAD:',$tower,$template);

//Is the user logged in?
//$isloggedin = "no";
if ($isloggedin == "yes"){
$query = "SELECT * FROM `users` WHERE `username` = '".$luser."'";
$result = mysql_query($query);
$num = mysql_numrows($result);
$i=0;
    while ($i < 1) {
   
    $money =@mysql_result($result,$i,"money");
    $i++;
            }
$template = replace(':WELCOMEORREGISTER:','',$template);
$template = replace(':LOGINORACCT:', '<p>Hi, '.$username.'
<p>Currency name: '.$money.'
<p><a href="logout.php">Log out</a>' ,$template);
else{

//User is not logged in
$template = replace(':WELCOMEORREGISTER:','<u>Member Login:</u>',$template);
$loginform = "<form name='form1' method='post' action='login.php'>
  <p>Username:
    <input name='username' type='text' id='username'>
</p>
  <p>Password:
    <input name='password' type='password' id='password'>
</p>
  <p>
    <input type='submit' name='Submit' value='Submit'>
  </p>
  <p>Don't have an account?<br>
  <a href='register.php'>Register Free</a>  </p>
</form>
";
$template = replace(':LOGINORACCT:', $loginform ,$template);
}

echo $template;
?>

Please help. Thanks =)

With yours, you were missing one of these: "}"

This is the correct code :)

Code:

<?php

// Easy Adoptables Script by Brandon Rusnak
// Get our includes out of the way

include("inc/functions.php");
include("inc/config.php");
include("inc/settings.php");
include("inc/nbbc.php");  // BBCODE Parser
$bbcode = new BBCode;

// Connect to our database

$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql database!');
mysql_select_db($dbname);


//Set up our login info...
$username = "";
$password = "";

//Check for cookie

if (isset($_COOKIE['adoptu']) and isset($_COOKIE['adoptp'])){

$username = $_COOKIE['adoptu'];
$password = $_COOKIE['adoptp'];

$username = preg_replace("/[^a-zA-Z0-9\\040.]/", "", $username);
$password = preg_replace("/[^a-zA-Z0-9s]/", "", $password);

//Run login operation
$query = "SELECT * FROM users WHERE username = '$username'";
$result = mysql_query($query);
$num = mysql_numrows($result);

//Loop out code
$i=0;
while ($i < 1) {

$luser=@mysql_result($result,$i,"username");
$lpass=@mysql_result($result,$i,"password");

$i++;
}

    if($username == $luser and $password == $lpass){
        $isloggedin = "yes";
    }
    else{
    if (isset($_COOKIE['adoptu'])){
    $past = time() - 10;
    setcookie("adoptu",$username,$past);
    }

    if (isset($_COOKIE['adoptp'])){
    $past = time() - 10;
    setcookie("adoptp",$password,$past);
    }
    $isloggedin = "no";
    }

}
else
{
//User is not logged in
$isloggedin = "no";

}



// Define our Template File

$file = $current_theme;



// Get our content for the index page

$query = "SELECT * FROM article_content WHERE page = 'index'";
$result = mysql_query($query);
$num = mysql_numrows($result);

//Loop out code
$i=0;
while ($i < 1) {

$article_title=mysql_result($result,$i,"title");
$article_date=mysql_result($result,$i,"date");
$article_content=mysql_result($result,$i,"content");

$i++;
}

$article_title = stripslashes($article_title);
$article_content = stripslashes($article_content);

$article_content = $bbcode->Parse($article_content);

// Run the BBCODE parser on the content

// Should we show the extra pages in the nav bar?

$link1 = "";
if($show_extra_page1 == "yes"){
$link1 = "<li><a href='$extra_page1_link'>$extra_page1_name<span class='tab-l'></span><span class='tab-r'></span></a></li>";
}

$link2 = "";
if($show_extra_page2 == "yes"){
$link2 = "<li><a href='$extra_page2_link'>$extra_page2_name<span class='tab-l'></span><span class='tab-r'></span></a></li>";
}

// Do the template changes and echo the ready template

$template = file_get_contents($file);
$template = replace(':SITETITLE:',$site_title,$template);
$template = replace(':SITENAME:',$site_name,$template);
$template = replace(':ARTICLETITLE:',$article_title,$template);
$template = replace(':ARTICLEDATE:',$article_date,$template);
$template = replace(':ARTICLECONTENT:',$article_content,$template);
$template = replace(':LINK1:',$link1,$template);
$template = replace(':LINK2:',$link2,$template);
$template = replace(':LINK3:',$link3,$template);

//Get the featured adoptable...
$featured = getfeatured();
$template = replace(':FEATURED:',$featured,$template);

//Ad Management
$header = @file_get_contents("ads/header.txt");
$footer = @file_get_contents("ads/footer.txt");
$tower = @file_get_contents("ads/tower.txt");

$header = stripslashes($header);
$footer = stripslashes($footer);
$tower = stripslashes($tower);

$template = replace(':HEADERAD:',$header,$template);
$template = replace(':FOOTERAD:',$footer,$template);
$template = replace(':TOWERAD:',$tower,$template);

//Is the user logged in?
//$isloggedin = "no";
if ($isloggedin == "yes"){
$query = "SELECT * FROM `users` WHERE `username` = '".$luser."'";
$result = mysql_query($query);
$num = mysql_numrows($result);
$i=0;
    while ($i < 1) {
   
    $money =@mysql_result($result,$i,"money");
    $i++;
            }
$template = replace(':WELCOMEORREGISTER:','',$template);
$template = replace(':LOGINORACCT:', '<p>Hi, '.$username.'
<p>Currency name: '.$money.'
<p><a href="logout.php">Log out</a>' ,$template);

}
else{

//User is not logged in
$template = replace(':WELCOMEORREGISTER:','<u>Member Login:</u>',$template);
$loginform = "<form name='form1' method='post' action='login.php'>
  <p>Username:
    <input name='username' type='text' id='username'>
</p>
  <p>Password:
    <input name='password' type='password' id='password'>
</p>
  <p>
    <input type='submit' name='Submit' value='Submit'>
  </p>
  <p>Don't have an account?<br>
  <a href='register.php'>Register Free</a>  </p>
</form>
";
$template = replace(':LOGINORACCT:', $loginform ,$template);
}

echo $template;
?>

:P

Thanks, it all works now =).

But if I were to put an image code here:

Before:
Code:

<p>Currency name: '.$money.'
After:
Code:

<p><img src='http://i172.photobucket.com/albums/w11/ashje_photo/crystal.png' alt='Twilight Crystal'></a> '.$money.'
It gives that error again.

I want it to say something like:

"http://i172.photobucket.com/albums/w...to/crystal.png 2"

or

"You have 2 http://i172.photobucket.com/albums/w...to/crystal.png Twilight Crystal(s)."

mattalien 03-28-2009 03:49 PM

RE: [In Development] Currency for leveling up
 
well, this may fix it, but on your code, it says:

[code]<p><img src='http://i172.photobucket.com/albums/w11/ashje_photo/crystal.png' alt='Twilight Crystal'></a> '.$money.'

the bolded bit should be </img>

~Mattalien

Ashje 03-28-2009 03:59 PM

RE: [In Development] Currency for leveling up
 
It still comes up with the same error. Thanks though. =)

mattalien 03-28-2009 05:08 PM

RE: [In Development] Currency for leveling up
 
hmmmmm.......strange. I'll keep looking though

Rsmiley 03-28-2009 09:41 PM

RE: [In Development] Currency for leveling up
 
Try this!

Code:

<p><img src=\"http://i172.photobucket.com/albums/w11/ashje_photo/crystal.png\" alt=\"Twilight Crystal\" /> '.$money.'
[hr]
Also, do you want me to untag this as In Development?

Ashje 03-29-2009 02:18 AM

RE: [In Development] Currency for leveling up
 
^

That appears as "\"Twilight 18" (18 being the number of crystals). Thanks though =)


EDIT:

Figured it out, it's:

Code:

<p><img src="http://i172.photobucket.com/albums/w11/ashje_photo/crystal.png"/> '.$money.'
Thanks Rsmiley! XD

Tequila 03-29-2009 10:57 AM

RE: [In Development] Currency for leveling up
 
I put the code in, and am getting errors. Could I be missing anything?
Edit to add code
PHP Code:

<?php

// Easy Adoptables Script by Brandon Rusnak
// Get our includes out of the way

include("inc/functions.php");
include(
"inc/config.php");
include(
"inc/settings.php");
include(
"inc/nbbc.php");  // BBCODE Parser
$bbcode = new BBCode;

$stop 0;

// Connect to our database

$conn mysql_connect($dbhost$dbuser$dbpass) or die ('Error connecting to mysql database!');
mysql_select_db($dbname);


//Set up our login info...
$username "";
$password "";

//Check for cookie

if (isset($_COOKIE['adoptu']) and isset($_COOKIE['adoptp'])){

$username $_COOKIE['adoptu'];
$password $_COOKIE['adoptp'];

$username preg_replace("/[^a-zA-Z0-9\\040.]/"""$username);
$password preg_replace("/[^a-zA-Z0-9s]/"""$password);

//Run login operation
$query "SELECT * FROM users WHERE username = '$username'";
$result mysql_query($query);
$num mysql_numrows($result);

//Loop out code
$i=0;
while (
$i 1) {

$luser=@mysql_result($result,$i,"username");
$lpass=@mysql_result($result,$i,"password");

$i++;
}

    if(
$username == $luser and $password == $lpass){
        
$isloggedin "yes";
    }
    else{
    if (isset(
$_COOKIE['adoptu'])){
    
$past time() - 10
    
setcookie("adoptu",$username,$past);
    }

    if (isset(
$_COOKIE['adoptp'])){
    
$past time() - 10
    
setcookie("adoptp",$password,$past);
    }
    
$isloggedin "no";
    }

}
else
{
//User is not logged in
$isloggedin "no";



$aID $_GET["aID"];
$aID preg_replace("/[^a-zA-Z0-9s]/"""$aID);
$cname $_GET["cname"];
$cname preg_replace("/[^a-zA-Z0-9\\040.]/"""$cname);
$flag $_GET["flag"];
$flag preg_replace("/[^a-zA-Z0-9\\040.]/"""$flag);


// Define our Template File

$file $current_theme;



// Get our content for the adoptables page
if($isloggedin == "yes" and $aID == ""){

$article_title "Available Adoptables";
$article_date date('Y-m-d');
$article_content "Below are all the available adoptables.  To adopt a creature simply click on the creature's name.<center>";

$query "SELECT * FROM adoptables";
$result mysql_query($query);
$num mysql_numrows($result);



//Loop out code
$i=0;
while (
$i $num) {

$aID=@mysql_result($result,$i,"uid");
$name=@mysql_result($result,$i,"name");
$imageurl=@mysql_result($result,$i,"imageurl");
$memberlevel=@mysql_result($result,$i,"memberlevel");
$description=@mysql_result($result,$i,"description");

//Begin our content output...
$article_content=$article_content."<p align='center'><b><a href='adopt.php?aID=".$aID."'>".$name.":</a></b></p>
<p align='center'><a href='adopt.php?aID="
.$aID."'><img src='".$imageurl."' border='0'></a> </p>
<p align='center'><a href='adopt.php?aID="
.$aID."'>Adopt ".$name."</a></p>";


$i++;
}

$article_content $article_content."</center><br>";


$article_title stripslashes($article_title);
$article_content stripslashes($article_content);



}
else if (
$isloggedin == "no" and $aID == ""){
// Guest is viewing the available adoptables

$article_title "Available Adoptables (Viewing as Guest)";
$article_date date('Y-m-d');
$article_content "Below are all the available adoptables.  To adopt a creature you must be a member of this site.  Please <a href='login.php'>login</a> or <a href='register.php'>register</a> to get your very own free adoptable.  
You can also browse the available adoptables as a guest.<center>"
;

$query "SELECT * FROM adoptables";
$result mysql_query($query);
$num mysql_numrows($result);



//Loop out code
$i=0;
while (
$i $num) {

$aID=@mysql_result($result,$i,"uid");
$name=@mysql_result($result,$i,"name");
$imageurl=@mysql_result($result,$i,"imageurl");
$memberlevel=@mysql_result($result,$i,"memberlevel");
$description=@mysql_result($result,$i,"description");

//Begin our content output...
$article_content=$article_content."<p align='center'><b><u>".$name.":</u></b></p>
<p align='center'><img src='"
.$imageurl."' border='0'></p>
<p align='center'><a href='login.php'>Please Login to Adopt "
.$name."</a></p>";


$i++;
}

$article_content $article_content."</center><br>";


$article_title stripslashes($article_title);
$article_content stripslashes($article_content);

}
else if (
$isloggedin == "no" and $aID != ""){
// Guest is trying to adopt an adoptable -- not allowed for tracking purposes

$article_title "Permission Denied";
$article_date date('Y-m-d');
$article_content "We're sorry, but guests cannot adopt creatures.  Please <a href='login.php'>login</a> or <a href='register.php'>register</a> to get your very own free adoptable.";

$article_title stripslashes($article_title);
$article_content stripslashes($article_content);

}
else if (
$isloggedin == "yes" and $aID != ""){
//A Logged In user is adopting a new creature

//Check first that the creature does in fact exist...
$query "SELECT * FROM adoptables WHERE uid = '$aID'";
$result = @mysql_query($query);
$num = @mysql_numrows($result);

//Loop out code
$i=0;
while (
$i 1) {

$newID=@mysql_result($result,$i,"uid");
$name=@mysql_result($result,$i,"name");
$imageurl=@mysql_result($result,$i,"imageurl");

$i++;
}

if(
$newID != $aID){
$stop 1;
$article_title "Creature does not exist!";
$article_date date('Y-m-d');
$article_content "We're sorry, but the creature you're looking for can't be found.  Please go to the <a href='adopt.php'>main adoptables page</a> to choose a valid creature.";
}
else{
//Creature is valid, let's adopt the sucker...
//Procedure for giving the user's adoptable a name
    
if($cname == "" and $flag !=12){
    
$article_title "Adopting ".$name;
    
$article_date date('Y-m-d');
    
$article_content "<p align='left'>You are about to adopt ".$name.". </p>
<p align='left'><img src='"
.$imageurl."' border='0'></a> </p>
<p align='left'>You may rename your creature if you wish. Your creature's name can contain letters, numbers and spaces only, and can be up to 20 characters long.</p>
<form name='form1' method='get' action='adopt.php'>
  <p>
    <input name='aID' type='hidden' id='aID' value = '"
.$aID."'>
    Creature Name: 
    <input name='cname' type='text' id='cname' maxlength='20'>
    <input name='flag' type='hidden' id='flag' value = '12'>
  </p>
  <p>
    <input type='submit' name='Submit' value='Adopt this Creature'>
</p>
</form>"
;
    }
    else{

    
//We are adopting the creature for real finally

    
$query "SELECT * FROM adoptables WHERE uid = '$aID'";
    
$result = @mysql_query($query);
    
$num = @mysql_numrows($result);

    
//Loop out code
    
$i=0;
    while (
$i 1) {

    
$newID=@mysql_result($result,$i,"uid");
    
$name=@mysql_result($result,$i,"name");
    
$imageurl=@mysql_result($result,$i,"imageurl");

    
$i++;
    }
    
    
$type $name;
    if(
$cname != ""){
    
$name $cname;
    }
    
    
$code rand(110000);

    
mysql_query("INSERT INTO owned_adoptables VALUES ('', '$name','$imageurl','0','0','$username','$type','$code')");
    
$article_title "You have adopted ".$name.".";
    
$article_date date('Y-m-d');
    
$article_content "You have just adopted ".$name.".<br><br><img src='".$imageurl."' border='0'><br>
    Below are codes you can use to level your creature up.  Other site members must click on your creature's link to level them up.
    <br><br>"
;

    
//We are adopting the creature for real finally

    
$query "SELECT * FROM owned_adoptables WHERE owner = '$username' AND code = '$code'";
    
$result = @mysql_query($query);
    
$num = @mysql_numrows($result);

    
//Loop out code
    
$i=0;
    while (
$i 1) {

    
$cid=@mysql_result($result,$i,"uid");
    

    
$i++;
    }


    
$article_content $article_content."<b>HTML:</b><br><textarea name=\"textarea\" cols=\"50\" rows=\"4\"><img src=\"http://www.".$dname."".$spath."/get.php?id=".$cid."\"><br>Creature Name: ".$name."<br>
    <a href=\"http://www."
.$dname."".$spath."/levelup.php?id=".$cid."\">Level this creature up!  Click Here!</a><br></textarea>";

    
$article_content $article_content."<b><br><br>BBCODE:</b><br><textarea name=\"textarea\" cols=\"50\" rows=\"4\">[img]http://www.".$dname."".$spath."/get.php?id=".$cid."[/img]
    Creature Name: "
.$name."
    [url=http://www."
.$dname."".$spath."/levelup.php?id=".$cid."]Level this creature up!  Click Here![/url]</textarea><br><br>You can now manage ".$name." on the <a href='myadoptables.php'>My Adoptables Page</a>.";
    }
    

}

}


// Should we show the extra pages in the nav bar?

$link1 "";
if(
$show_extra_page1 == "yes"){
$link1 "<li><a href='$extra_page1_link'>$extra_page1_name<span class='tab-l'></span><span class='tab-r'></span></a></li>"
}

$link2 "";
if(
$show_extra_page2 == "yes"){
$link2 "<li><a href='$extra_page2_link'>$extra_page2_name<span class='tab-l'></span><span class='tab-r'></span></a></li>"
}


// Do the template changes and echo the ready template

$template file_get_contents($file);
$template replace(':SITETITLE:',$site_title,$template);
$template replace(':SITENAME:',$site_name,$template);
$template replace(':ARTICLETITLE:',$article_title,$template);
$template replace(':ARTICLEDATE:',$article_date,$template);
$template replace(':ARTICLECONTENT:',$article_content,$template);
$template replace(':LINK1:',$link1,$template);
$template replace(':LINK2:',$link2,$template);
$template replace(':LINK3:',$link3,$template);

//Get the featured adoptable...
$featured getfeatured();
$template replace(':FEATURED:',$featured,$template);

//Ad Management
$header = @file_get_contents("ads/header.txt");
$footer = @file_get_contents("ads/footer.txt");
$tower = @file_get_contents("ads/tower.txt");

$header stripslashes($header);
$footer stripslashes($footer);
$tower stripslashes($tower);

$template replace(':HEADERAD:',$header,$template);
$template replace(':FOOTERAD:',$footer,$template);
$template replace(':TOWERAD:',$tower,$template);


//Is the user logged in?
//$isloggedin = "no";
$query "SELECT * FROM `users` WHERE `username` = '".$luser."'";
$result mysql_query($query);
$num mysql_numrows($result);
$i=0;
    while (
$i 1) {
    
    
$money =@mysql_result($result,$i,"money");
    
$i++;
            }
$template replace(':WELCOMEORREGISTER:','',$template);
$template replace(':LOGINORACCT:''<p>Welcome, '.$username.'
<p><img src=http://i634.photobucket.com/albums/uu61/familiarelementspets/gold.png"/: '
.$money.'
<p><a href="logout.php">Log out</a>' 
,$template);
}
else{

//User is not logged in
$template replace(':WELCOMEORREGISTER:','<u>Member Login:</u>',$template);
$loginform "<form name='form1' method='post' action='login.php'>
  <p>Username: 
    <input name='username' type='text' id='username'>
</p>
  <p>Password: 
    <input name='password' type='password' id='password'>
</p>
  <p>
    <input type='submit' name='Submit' value='Submit'>
  </p>
  <p>Don't have an account?<br>
  <a href='register.php'>Register Free</a>  </p>
</form>
"
;
$template replace(':LOGINORACCT:'$loginform ,$template);
}

echo 
$template;
?>


Ashje 03-31-2009 12:46 AM

RE: Currency for leveling up and adoptable shop [Beta]
 
You forgot the ">" at the end of the image code. You also forgot the Quote Marks at the start of the address. It should be:
Code:

<p><img src="http://i634.photobucket.com/albums/uu61/familiarelementspets/gold.png"/>: '.$money.'

BTW: Shop looks awesome *first to download - does dance* XD Thanks.

EDIT:
The shop works fine but I ran the query and the adoptable won't appear. Also, in the first query, what is that first field? It's blank... And at the top of the screen I get "
PHP Error Message

Warning: mysql_numrows(): supplied argument is not a valid MySQL result resource in /home/---------/public_html/shop.php on line 89

Free Web Hosting
"

Help please... XD

rosepose 03-31-2009 08:41 AM

RE: Currency for leveling up and adoptable shop [Beta]
 
Looks great, I'll install this tonight ><

Tequila 03-31-2009 09:00 AM

RE: Currency for leveling up and adoptable shop [Beta]
 
Hm, I need to build an items table instead of an adoptables table.

What would I need to change to run the SQL?

gjac1 03-31-2009 09:33 AM

RE: Currency for leveling up and adoptable shop [Beta]
 
I have followed the instructions, i added a shop adoptable but it doesnt appear in the shop...it appears on the main adopt page and is free to adopt by anyone, but on the shop.php page i get these errors :

Warning: mysql_numrows(): supplied argument is not a valid MySQL result resource in /home/pfusions/public_html/shop.php on line 89

Warning: mysql_numrows(): supplied argument is not a valid MySQL result resource in /home/pfusions/public_html/shop.php on line 111

Warning: mysql_numrows(): supplied argument is not a valid MySQL result resource in /home/pfusions/public_html/shop.php on line 133

please help :(

Genkigami 03-31-2009 10:09 AM

RE: Currency for leveling up and adoptable shop [Beta]
 
What pages do you add the script to? "etc" is a little vague.

gjac1 03-31-2009 10:39 AM

RE: Currency for leveling up and adoptable shop [Beta]
 
Is the problem not that there is no extra row added to the created adoptables table ??

I mean, there is a new one added to the users, to say how much they have earned, but there is no extra row to set how much an adoptables costs....

It still only has these tables, but no "cost" row

uid name imageurl memberlevel description

Tequila 03-31-2009 11:34 AM

RE: Currency for leveling up and adoptable shop [Beta]
 
I have run into a new error:
Code:

Parse error: syntax error, unexpected '}' in /home/enddayne/public_html/tos.php on line 159
So just in case here is the file in question:
PHP Code:

<?php

// Easy Adoptables Script by Brandon Rusnak
// Get our includes out of the way

include("inc/functions.php");
include(
"inc/config.php");
include(
"inc/settings.php");
include(
"inc/nbbc.php");  // BBCODE Parser
$bbcode = new BBCode;

// Connect to our database

$conn mysql_connect($dbhost$dbuser$dbpass) or die ('Error connecting to mysql database!');
mysql_select_db($dbname);


//Set up our login info...
$username "";
$password "";

//Check for cookie

if (isset($_COOKIE['adoptu']) and isset($_COOKIE['adoptp'])){

$username $_COOKIE['adoptu'];
$password $_COOKIE['adoptp'];

$username preg_replace("/[^a-zA-Z0-9\\040.]/"""$username);
$password preg_replace("/[^a-zA-Z0-9s]/"""$password);

//Run login operation
$query "SELECT * FROM users WHERE username = '$username'";
$result mysql_query($query);
$num mysql_numrows($result);

//Loop out code
$i=0;
while (
$i 1) {

$luser=@mysql_result($result,$i,"username");
$lpass=@mysql_result($result,$i,"password");

$i++;
}

    if(
$username == $luser and $password == $lpass){
        
$isloggedin "yes";
    }
    else{
    if (isset(
$_COOKIE['adoptu'])){
    
$past time() - 10
    
setcookie("adoptu",$username,$past);
    }

    if (isset(
$_COOKIE['adoptp'])){
    
$past time() - 10
    
setcookie("adoptp",$password,$past);
    }
    
$isloggedin "no";
    }

}
else
{
//User is not logged in
$isloggedin "no";




// Define our Template File

$file $current_theme;



// Get our content for the index page

$query "SELECT * FROM article_content WHERE page = 'tos'";
$result mysql_query($query);
$num mysql_numrows($result);

//Loop out code
$i=0;
while (
$i 1) {

$article_title=mysql_result($result,$i,"title");
$article_date=mysql_result($result,$i,"date");
$article_content=mysql_result($result,$i,"content");

$i++;
}

$article_title stripslashes($article_title);
$article_content stripslashes($article_content);

$article_content $bbcode->Parse($article_content);

// Run the BBCODE parser on the content

// Should we show the extra pages in the nav bar?

$link1 "";
if(
$show_extra_page1 == "yes"){
$link1 "<li><a href='$extra_page1_link'>$extra_page1_name<span class='tab-l'></span><span class='tab-r'></span></a></li>"
}

$link2 "";
if(
$show_extra_page2 == "yes"){
$link2 "<li><a href='$extra_page2_link'>$extra_page2_name<span class='tab-l'></span><span class='tab-r'></span></a></li>"
}

// Do the template changes and echo the ready template

$template file_get_contents($file);
$template replace(':SITETITLE:',$site_title,$template);
$template replace(':SITENAME:',$site_name,$template);
$template replace(':ARTICLETITLE:',$article_title,$template);
$template replace(':ARTICLEDATE:',$article_date,$template);
$template replace(':ARTICLECONTENT:',$article_content,$template);
$template replace(':LINK1:',$link1,$template);
$template replace(':LINK2:',$link2,$template);
$template replace(':LINK3:',$link3,$template);

//Get the featured adoptable...
$featured getfeatured();
$template replace(':FEATURED:',$featured,$template);

//Ad Management
$header = @file_get_contents("ads/header.txt");
$footer = @file_get_contents("ads/footer.txt");
$tower = @file_get_contents("ads/tower.txt");

$header stripslashes($header);
$footer stripslashes($footer);
$tower stripslashes($tower);

$template replace(':HEADERAD:',$header,$template);
$template replace(':FOOTERAD:',$footer,$template);
$template replace(':TOWERAD:',$tower,$template);


//Is the user logged in?
//$isloggedin = "no";
$query "SELECT * FROM `users` WHERE `username` = '".$luser."'";
$result mysql_query($query);
$num mysql_numrows($result);
$i=0;
    while (
$i 1) {
    
    
$money =@mysql_result($result,$i,"money");
    
$i++;
            }
$template replace(':WELCOMEORREGISTER:','',$template);
$template replace(':LOGINORACCT:''<p>Welcome, '.$username.'
<p><img src="http://i634.photobucket.com/albums/uu61/familiarelementspets/gold.png"/> '
.$money.'
<p><a href="logout.php">Log out</a>' 
,$template);
}
else{

//User is not logged in
$template replace(':WELCOMEORREGISTER:','<u>Member Login:</u>',$template);
$loginform "<form name='form1' method='post' action='login.php'>
  <p>Username: 
    <input name='username' type='text' id='username'>
</p>
  <p>Password: 
    <input name='password' type='password' id='password'>
</p>
  <p>
    <input type='submit' name='Submit' value='Submit'>
  </p>
  <p>Don't have an account?<br>
  <a href='register.php'>Register Free</a>  </p>
</form>
"
;
$template replace(':LOGINORACCT:'$loginform ,$template);
}

echo 
$template;
?>


gjac1 03-31-2009 12:16 PM

RE: Currency for leveling up and adoptable shop [Beta]
 
enddayne, have you managed to get the currency adoptables to appear in the shop and available only to those with enough credits ??

Tequila 03-31-2009 12:51 PM

RE: Currency for leveling up and adoptable shop [Beta]
 
Quote:

Originally Posted by gjac1
enddayne, have you managed to get the currency adoptables to appear in the shop and available only to those with enough credits ??

Not yet. I'm getting errors on site. My tos page is one of them.

gjac1 03-31-2009 01:23 PM

RE: Currency for leveling up and adoptable shop [Beta]
 
Ok thanks :)

I too am getting errors, i listed them just above your post..... :(

densaugeo 03-31-2009 06:22 PM

RE: Currency for leveling up and adoptable shop [Beta]
 
how do you insert the adoptables into the shop? I mean like..where do I put the lines of code for it? XD I don't wanna screw anything up. I know how to make a custom adoptable, i just don't know how to add it to the shop.[hr]
And I'm also one of those getting the SQL queries at the top of the page, and i haven't edited anything other than the text in your shop code :P

http://sheegarden.com/test/shop.php

zhiichiro 04-01-2009 05:20 AM

RE: Currency for leveling up and adoptable shop [Beta]
 
Quote:

Originally Posted by densaugeo

sheegarden is cute, but too girly :P

i have an account there, my username is ZhiichirO..
you can give me rare fairies XD

i hope you can create an account on fresbopet.netau.net..

gjac1 04-01-2009 09:37 AM

RE: Currency for leveling up and adoptable shop [Beta]
 
This is the part of the shop.php file that seems to be creating the errors :

$query = "SELECT * FROM adoptables WHERE kind = 'egg' LIMIT 0,5";
$result = mysql_query($query);
$num = mysql_numrows($result);

//Loop out code
$i=0;
while ($i < $num) {

$aID=@mysql_result($result,$i,"uid");
$name=@mysql_result($result,$i,"name");
$imageurl=@mysql_result($result,$i,"imageurl");
$cost=@mysql_result($result,$i,"description");


All times are GMT -5. The time now is 06:13 PM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.