View Full Version : Currency for leveling up / Adoptable shop (Fixed again)
kisazeky
03-25-2009, 01:33 PM
Note with this update! Please, re-run the queries to add the shop adoptables, if you have already installed it. Thanks.
Important!! A way to prevent people stealing shop adoptables!
Open adopt.php and find something like this in the code (it won't be exactly like mine):
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:
if($memberlevel != free){
$stop = 1;
$article_content = "You cannot adopt this pet for free!.";
}
Earning money on level up
Step 1: Run this here MySQL query to add the money field in your users table:
ALTER TABLE users
ADD money INT(11) NULL 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:
mysql_query("INSERT INTO users VALUES ('', '$username', '$pass1','$email','free',)");
Replace it with:
mysql_query("INSERT INTO users VALUES ('', '$username', '$pass1','$email','free','0')");
Show the total amount of money to your users
Add this....
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 ...
//$isloggedin = "no";
and...
}
else{
//User is not logged in
On all of your pages.
Shop to buy adoptables
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.
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.
INSERT INTO adoptable_rankimages VALUES ('name','1','2','3','4','5','6','7','8')
BMR777
03-25-2009, 01:57 PM
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:
mysql_query("INSERT INTO users VALUES ('', '$username', '$pass1','$email','free')");
Replace With:
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:
ALTER TABLE users
ADD money VARCHAR(11) NULL DEFAULT '0'
To:
ALTER TABLE users
ADD money INT
Use INT when only a number is expected. :)
Brandon
Killgore
03-25-2009, 05:33 PM
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
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
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
$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
Does it work right now?
kisazeky
03-25-2009, 10:24 PM
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
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
Thanks :) I'll try to add this to SE if the host decides to work ><
kisazeky
03-26-2009, 12:45 PM
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
This looks great :3 I've sent you a PM on the SE forums, kisazeky...
rosepose
03-26-2009, 07:33 PM
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
Could you edit the first post and add Brandon's extra part because I fail at this stuff...Thanks.
Done. ^^
Awesome thanks =)
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
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
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
I like it ^^ Thanks ^^ I am going to add it to my site right away!
Ashje
03-28-2009, 03:58 AM
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:
<?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,$templ ate);
$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
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:
<?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,$templ ate);
$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 :)
<?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,$templ ate);
$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
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
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:
<?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,$templ ate);
$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 :)
<?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,$templ ate);
$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:
<p>Currency name: '.$money.'
After:
<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/w11/ashje_photo/crystal.png 2"
or
"You have 2 http://i172.photobucket.com/albums/w11/ashje_photo/crystal.png Twilight Crystal(s)."
mattalien
03-28-2009, 03:49 PM
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
It still comes up with the same error. Thanks though. =)
mattalien
03-28-2009, 05:08 PM
hmmmmm.......strange. I'll keep looking though
Rsmiley
03-28-2009, 09:41 PM
Try this!
<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
^
That appears as "\"Twilight 18" (18 being the number of crystals). Thanks though =)
EDIT:
Figured it out, it's:
<p><img src="http://i172.photobucket.com/albums/w11/ashje_photo/crystal.png"/> '.$money.'
Thanks Rsmiley! XD
Tequila
03-29-2009, 10:57 AM
I put the code in, and am getting errors. Could I be missing anything?
Edit to add 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(1, 10000);
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\">http://www.".$dname."".$spath."/get.php?id=".$cid."
Creature Name: ".$name."
Level this creature up! Click Here! (http://www.".$dname."".$spath."/levelup.php?id=".$cid.")</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,$templ ate);
$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
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:
<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
Looks great, I'll install this tonight ><
Tequila
03-31-2009, 09:00 AM
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
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
What pages do you add the script to? "etc" is a little vague.
gjac1
03-31-2009, 10:39 AM
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
I have run into a new error:
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
// 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,$templ ate);
$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
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
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
Ok thanks :)
I too am getting errors, i listed them just above your post..... :(
densaugeo
03-31-2009, 06:22 PM
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
http://sheegarden.com/test/shop.php
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
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");
mattalien
04-01-2009, 09:54 AM
Im getting the same error as well, It has to be because of the 'egg' part.
gjac1
04-01-2009, 09:57 AM
i think a "kind" and "cost" row has to be added to the adoptables table......
mattalien
04-01-2009, 11:24 AM
yeah, i'll try it.
EDIT: YES! I did it! you have to add a 'kind' column to the table 'adoptables'. then when you add the adoptable, you use this query:
INSERT INTO adoptables VALUES ('', 'name','level 0 image','shop','cost','kind')
then go to the shop.php file, and find this:
$query = "SELECT * FROM adoptables WHERE kind = 'egg' LIMIT 0,5";
change the 'egg' bit to what ever you put in the 'kind' bit of the query. :)
The adoptable still appears in the adoption page, but i will look and try to fix this.
NEW EDIT: Fixed that too! in the database, go to the 'adoptables' table, and in the adoptables you want in the offcial adoption place, set their kind to something like, 'adoptable'.
then, in adopt.php, find this line:
$query = "SELECT * FROM adoptables"
and change it to this:
$query = "SELECT * FROM adoptables WHERE kind = 'adoptable'";
change the 'adoptable' to whatever you set in the 'kind' area for the official adoptables.
:)
gjac1
04-01-2009, 12:54 PM
Thats what i did too, and changed the "egg" to "shop" and the "full" to "shop2"
The creator of this mod must have forgotten to post the bit about adding the new rows to the adoptables table as well....
rosepose
04-01-2009, 04:59 PM
Erm... How exactly do you add the column?
Ashje
04-02-2009, 01:29 AM
@ rosepose:
Click here:
http://i172.photobucket.com/albums/w11/ashje_photo/kind1.jpg
Then fill it in like this:
http://i172.photobucket.com/albums/w11/ashje_photo/kind2.png
And click Save.
Thanks mattalien, everything works perfectly now. =)
kisazeky
04-02-2009, 01:47 AM
Ok, with the update, there is now no need to add new columns. It adds "shop" to the "memberlevel" column and the cost to the "description" table.
Also this is a more secure buying method so people cannot get them for free.
densaugeo
04-02-2009, 07:07 PM
I still don't get how to add a pet to the shop :P Heh, i've looked over the files..but I'm not sure what to change or add...
zhiichiro
04-02-2009, 10:25 PM
we now have the shop.. thanks
visit : fresbopet.netau.net to see
Ashje
04-03-2009, 01:01 AM
I still don't get how to add a pet to the shop :P Heh, i've looked over the files..but I'm not sure what to change or add...
Don't add or change anything. Just run the SQL Queries in Post 43.
Ok, with the update, there is now no need to add new columns. It adds "shop" to the "memberlevel" column and the cost to the "description" table.
Also this is a more secure buying method so people cannot get them for free.
How is it safer? It is much easier to add a kind column with the old one. Anyways, thanks for the buyconfirm. =)
EDIT:
buyconfirm doesn't work, the new shop file doesn't work (it screws up the template and when you buy something, nothing appears on the page...
mattalien
04-03-2009, 10:20 AM
Can i just ask, how can I add a new section to the shop?
e.g. I have the one heading that says "Gold Coin Frames", and I would like another one saying "Platinum Coin Frames" underneath.
How do I do this?
kisazeky
04-03-2009, 01:35 PM
Easy, mattalien.
First of all, insert the adoptables you want in this section using this query. Replace shop with something different like shop_platinum.
INSERT INTO adoptables VALUES ('', 'name','level 0 image','shop_platinum','cost')
Don't forget to add the rank images.
Then edit shop.php and find this line:
$article_content = stripslashes($article_content);
Right below it, put this in:
$article_content=$article_content."<p>Platinum Coin Frames";
$query = "SELECT * FROM adoptables WHERE memberlevel = 'shop_platinum'";
$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");
//Begin our content output...
$article_content=$article_content."<p>".$name."<p><img src='".$imageurl."' /><p>".$cost." <p><a href='buy.php?aID=".$aID."'>Buy ".$name."</a>";
$i++;
}
densaugeo
04-03-2009, 01:51 PM
I ended up having to add a kind row anyway :P With the memberlevel one, no matter what i put the adoptable's level at, anyone could still get it. and that was the problem i was having XD but i fixed it with adding a 'kind' to it. so it's all good now :D Thank you!
kisazeky
04-03-2009, 02:05 PM
Densaugeo, I've added an anti-theft code to the adopt page, so no one can adopt these shop creatures through the adopt page. :)
mattalien
04-03-2009, 03:14 PM
Easy, mattalien.
First of all, insert the adoptables you want in this section using this query. Replace shop with something different like shop_platinum.
INSERT INTO adoptables VALUES ('', 'name','level 0 image','shop_platinum','cost')
Don't forget to add the rank images.
Then edit shop.php and find this line:
$article_content = stripslashes($article_content);
Right below it, put this in:
$article_content=$article_content."<p>Platinum Coin Frames";
$query = "SELECT * FROM adoptables WHERE memberlevel = 'shop_platinum'";
$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");
//Begin our content output...
$article_content=$article_content."<p>".$name."<p><img src='".$imageurl."' /><p>".$cost." <p><a href='buy.php?aID=".$aID."'>Buy ".$name."</a>";
$i++;
}
Thanks! You are the best, apart from BMR77!
:)
Ashje
04-03-2009, 04:12 PM
I still don't get how to add a pet to the shop :P Heh, i've looked over the files..but I'm not sure what to change or add...
Don't add or change anything. Just run the SQL Queries in Post 43.
Ok, with the update, there is now no need to add new columns. It adds "shop" to the "memberlevel" column and the cost to the "description" table.
Also this is a more secure buying method so people cannot get them for free.
How is it safer? It is much easier to add a kind column with the old one. Anyways, thanks for the buyconfirm. =)
EDIT:
buyconfirm doesn't work, the new shop file doesn't work (it screws up the template and when you buy something, nothing appears on the page...
EDIT: The stealing thing doesn't work either, it just prevents any user adopting the main adoptables, not in the shop.
Killgore
04-03-2009, 04:23 PM
Is there any way i could set the adoptables in a table that would look like this:<center><table border='2' bordercolor='#3d3d3d' cellpadding='5' cellspacing='1'>
<tr>
<td bgcolor='#575757'><p><font face='Verdana' size='1' color='ffffff'><center>".$name."<p><img src='".$imageurl."' /><p>".$cost."<p><a href='buy.php?aID=".aID."'>Buy a ".$name."!</a></td>
<td bgcolor='#575757'><p><font face='Verdana' size='1' color='ffffff'><center>".$name."<p><img src='".$imageurl."' /><p>".$cost."<p><a href='buy.php?aID=".aID."'>Buy a ".$name."!</a></td>
<td bgcolor='#575757'><p><font face='Verdana' size='1' color='ffffff'><center>".$name."<p><img src='".$imageurl."' /><p>".$cost."<p><a href='buy.php?aID=".aID."'>Buy a ".$name."!</a></td>
</tr>
<tr>
<td bgcolor='#575757'><p><font face='Verdana' size='1' color='ffffff'><center>".$name."<p><img src='".$imageurl."' /><p>".$cost."<p><a href='buy.php?aID=".aID."'>Buy a ".$name."!</a></td>
<td></td>
<td bgcolor='#575757'><p><font face='Verdana' size='1' color='ffffff'><center>".$name."<p><img src='".$imageurl."' /><p>".$cost."<p><a href='buy.php?aID=".aID."'>Buy a ".$name."!</a></td>
</tr>
</table></center>
Unfortunately, it repeats, and makes 5 tables all in the order i want, but all 5 cells have the same adoptable and each table displays a different adoptable. In case I'm talking gibberish, here's what i mean: http://sylonia.comyr.com/adoptables/shop.php
kisazeky
04-03-2009, 07:31 PM
I still don't get how to add a pet to the shop :P Heh, i've looked over the files..but I'm not sure what to change or add...
Don't add or change anything. Just run the SQL Queries in Post 43.
Ok, with the update, there is now no need to add new columns. It adds "shop" to the "memberlevel" column and the cost to the "description" table.
Also this is a more secure buying method so people cannot get them for free.
How is it safer? It is much easier to add a kind column with the old one. Anyways, thanks for the buyconfirm. =)
EDIT:
buyconfirm doesn't work, the new shop file doesn't work (it screws up the template and when you buy something, nothing appears on the page...
EDIT: The stealing thing doesn't work either, it just prevents any user adopting the main adoptables, not in the shop.
Your shop adoptables need to have something other than free in their memberlevel column. Put shop in memberlevel.
Blue Icebox
04-03-2009, 10:41 PM
OMG this is going to be so helpful on my site! *squeals!*
Thank you sooooooooo much for making this!!! :D
Ashje
04-04-2009, 04:59 PM
Got it. You forgot to add this:$memberlevel=@mysql_result($result,$i,"memberlevel");to the mysql results.
kisazeky
04-04-2009, 05:03 PM
Added.
Ashje
04-06-2009, 04:46 AM
Just went to buy an adoptable from the shop. I clicked it, it all worked fine 'till I clicked adopt. Then it wouldn't let me adopt, even when I legitimately adopted it. I had to take that part out of adopt.php for it to work. Help?
Tequila
04-06-2009, 02:16 PM
Now that I got the one issue taken care of, I want to submit this information to see if you'd know how to help me convert from adoptables to items.
shop.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";
}
// Define our Template File
$file = $current_theme;
// Get our content for the items page
if($isloggedin == "yes" and $ID == ""){
$article_title = "Market Place";
$article_content = "Shop description goes here.";
$query = "SELECT * FROM items WHERE memberlevel = 'shop'";
$result = mysql_query($query);
$num = mysql_numrows($result);
//Loop out code
$i=0;
while ($i < $num) {
$iID=@mysql_result($result,$i,"uid");
$name=@mysql_result($result,$i,"name");
$imageurl=@mysql_result($result,$i,"imageurl");
$memberlevel=@mysql_result($result,$i,"memberlevel");
$cost=@mysql_result($result,$i,"description");
//Begin our content output...
$article_content=$article_content."<p>".$name."<p><img src='".$imageurl."' /><p>".$cost." <p><a href='buy.php?ID=".$ID."'>Buy ".$name."</a></td>";
$i++;
}
$article_title = stripslashes($article_title);
$article_content = stripslashes($article_content);
}
else if ($isloggedin == "no" and $iID == ""){
// Guest is viewing the available items
$article_title = "Shop";
$article_date = date('Y-m-d');
$article_content = "Please log in to buy items.";
$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 = "Error";
$article_date = date('Y-m-d');
$article_content = "You must <a href='register.php'>register</a> an account before you can buy adoptables.";
$article_title = stripslashes($article_title);
$article_content = stripslashes($article_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,$templ ate);
$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"){
$template = replace(':WELCOMEORREGISTER:','',$template);
$template = replace(':LOGINORACCT:', '<p>Hi, <a href="profile.php?owner='.$username.'">'.$username.'</a>
<p><a href="logout.php">Log out</a>' ,$template);
}
else{
//User is not logged in
$template = replace(':WELCOMEORREGISTER:','Hi there, please login or register',$template);
$loginform = "<form name='form1' method='post' action='login.php'>
<p><font size=1>Username
<input name='username' type='text' id='username' size=10>
</p>
<p><font size=1>Password</font>
<input name='password' type='password' id='password' size=10>
</p>
<p>
<input type='submit' name='submit' value='Let`s Go!'>
</p>
</form>
";
$template = replace(':LOGINORACCT:', $loginform ,$template);
}
echo $template;
?>
MySQL Code
CREATE TABLE items VALUES('uid', 'name', 'image', 'shop', 'cost')
So far it only gives a blank page with an error (http://familiarelements.info/shop.php):
Warning: mysql_numrows(): supplied argument is not a valid MySQL result resource in /home/enddayne/public_html/shop.php on line 88
Ashje
04-06-2009, 04:23 PM
^
Sounds like there's an error here:
$iID=@mysql_result($result,$i,"uid");
$name=@mysql_result($result,$i,"name");
$imageurl=@mysql_result($result,$i,"imageurl");
$memberlevel=@mysql_result($result,$i,"memberlevel");
$cost=@mysql_result($result,$i,"description");
Just went to buy an adoptable from the shop. I clicked it, it all worked fine 'till I clicked adopt. Then it wouldn't let me adopt, even when I legitimately adopted it. I had to take that part out of adopt.php for it to work. Help?
rosepose
04-06-2009, 05:05 PM
When I put the anti-theft thingamajig in it gives me an error (I'm still using the Kind column)
kisazeky
04-06-2009, 07:50 PM
Don't use the kind column, rose.
Use memberlevel. You are to put shop in memberlevel and make sure all of your free adoptables do in fact say free in their memberlevel for the anti-theft to work.
Just went to buy an adoptable from the shop. I clicked it, it all worked fine 'till I clicked adopt. Then it wouldn't let me adopt, even when I legitimately adopted it. I had to take that part out of adopt.php for it to work. Help?
It sounds like you are still using the old version of shop.php. Please download shop.php again from my post as well as buy.php and buyconfirm.php if you have not already.
Ashje
04-07-2009, 01:25 AM
The new shop has errors. When I click buy, the page comes up completely blank. Just a white screen.
rosepose
04-08-2009, 07:54 PM
For me, too.
Killgore
04-08-2009, 08:28 PM
Slight issue: the money portion of the script stops working after a bit. I'll get som, then it won't show that i got some, as well as how much i currently have.
aroymart
04-11-2009, 11:53 AM
Hi! what do you mean by "running queries"? do you mean in the mySQL text document? if so do you think you could make a mod to let me add adopts to the shop directly from the admin part? because my friend controlls the mySQL parts of the site and he's not on a lot
Ashje
04-11-2009, 06:00 PM
^
You can't do that, you have to have access to MySQL.
mugwumpr
04-11-2009, 10:49 PM
Okay, dumb question time..... Are all the fixes discussed in the 8 pages of this thread included in the first post, or do I have to go through and do a bunch of edits? I know, lame question.... it's late.... brain no workee. Humour the crazy lady, 'k?
:P
aroymart
04-12-2009, 06:13 AM
you may want to see if there are any errors the creator of this forum didn't see but once you get past his last post it should be on the first page (i hope)
Ashje
04-12-2009, 04:57 PM
Okay, dumb question time..... Are all the fixes discussed in the 8 pages of this thread included in the first post, or do I have to go through and do a bunch of edits? I know, lame question.... it's late.... brain no workee. Humour the crazy lady, 'k?
:P
There seems to be one rampant issue, which I am trying to fix. Kisazeky isn't responding though.
EDIT:
If you re-install everything on the front page and re-run the queries, it all works fine.
mugwumpr
04-13-2009, 12:26 AM
EDIT: If you re-install everything on the front page and re-run the queries, it all works fine.
Excellent, thank you! I'll give that a whirl tomorrow. The brain doesn't work very well after a heavy load of Easter ham....
:rolleyes: ;)
Ashje
04-13-2009, 01:40 AM
^
Yum yum? =D
mugwumpr
04-13-2009, 09:48 PM
Oh, very yum yum!! I still haven't fully recovered.
:o9
trollis76
04-15-2009, 09:25 AM
OK, seriously. How do I add an adoptable to the shop? And how do I make it so that it says something like this:
"You have earned 20 bucks for leveling up this pet." because it just says: You have earned (number) (currency name) for leveling up this pet.
Ashje
04-15-2009, 05:06 PM
^
Easy.
1 (Adding Adoptables to the shop). Go to MySQL and open the queries. Copy-Paste this:INSERT INTO adoptables VALUES ('', 'name','level 0 image','shop','cost')
This is how it works:
'' - Leave this blank
'name' - Replace name with the Adoptable Name but keep the ''.
'level 0 image' - Replace level 0 image with the default image for your adoptable but keep the ''.
'shop' - Leave this as it is.
'cost' - Replace cost with how much the adoptable is going to cost but keep the ''.
Run that query. Now copy-paste this new query into the box:INSERT INTO adoptable_rankimages VALUES ('name','1','2','3','4','5','6','7','8')
Again:
'name' - Replace name with the same name you did in the last one. It has to be the same name or your adoptable won't evolve. Keep the ''.
'1' - Replace 1 with the first adoptable image but keep the ''.
and so on and so on. When that is done, run the query and check that your adoptable appears in the shop.
2 (changing Money Message). Go to levelup.php and search for $article_content=$article_content. "
<p>You have earned (number) (currency name) for leveling up this pet.
<br>You now have ".$newbalance." (currency name)";
}
Change the "You have earned (number) (currency name) for leveling up this pet, etc."...
trollis76
04-16-2009, 07:49 AM
Hm, well... I don't know how to change the (number) because my users get a random amount from 10-25 "Emeralds". Does the command $money work? Or does anything else so? Maybe I can add something new to the MySQL, like $Money_Get or something, and I do it like this:
$Money_Get = rand(10,25)?
But I seriously don't think that will work.
Can anyone here help me to get the money to show? Please? I enter the code where it should be. And I get THIS error:
"Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in /home/a8498929/public_html/index.php on line 62"
Or anything similar. How do I solve this?
Ashje
04-16-2009, 08:05 AM
$money should work for the amount you get but you're on your own on figuring out how to make it random. You see, if you manage to get it random, $money will show the random number, which is what you want. The problem is getting the random number. Try talking to Brandon, it is similar to the "Featured Adoptable". For that error, show me line 62 and I'll show you the error.
trollis76
04-16-2009, 08:48 AM
OK, well, I already know how to make it random. You helped me a lot. I'll show you the document soon.
EDIT: Here it is:
<?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";
}
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
$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,$templ ate);
$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"){
$template = replace(':WELCOMEORREGISTER:','<u>Welcome Back:</u>',$template);
$template = replace(':LOGINORACCT:', 'Welcome back '.$username.'. <br><br><a href="account.php">Click here to view or edit your account.</a><br><br><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;
?>
Oh, if it is any help: I used Words to make this. If you can't use that program, please tell me so.
Ashje
04-16-2009, 04:57 PM
I use Notepad but I also use Microsoft Word. I prefer Notepad as it is much easier to use. Also, you do realise that that document is reading from your index page..?
trollis76
04-16-2009, 11:59 PM
What do you mean "Reading from your Index"? He/She said we were supposed to paste it into every page!
It just doesn't work on any of them.
Ashje
04-17-2009, 02:31 AM
Never mind, I made a mistake. Now I just need line 62. Instead of clicking 'Edit' or 'Open', click 'View' and it will show you the line numbers. Copy-paste line 62...
trollis76
04-17-2009, 09:50 AM
Well, I don't have that version any more. Do you know if this currency-thing will work with the new release?
BMR777
04-17-2009, 09:55 AM
Well, I don't have that version any more. Do you know if this currency-thing will work with the new release?
It will need to be upgraded to work with the new release.
trollis76
04-17-2009, 10:04 AM
OK, thank you.
Hope you upgrade it!
Ashje
04-17-2009, 06:30 PM
^
Kisazeky needs to do that, but I'll give it a shot once I get the upgrade script. He hasn't been responding of late...
zhiichiro
04-21-2009, 11:05 AM
the adoptables bought from my shop doesnt level up XD
it always says "max level" when it's about to level-up
Ashje
04-21-2009, 06:06 PM
I think it's because you are using the new version...
Aluka
05-02-2009, 09:18 PM
Where is register2.php? I can't find one.
zhiichiro
06-16-2009, 07:23 AM
how to add this on new release?
Seapyramid
06-16-2009, 08:40 AM
If you actually read this thread you would know it was NOT made for and does NOT work with the latest release. You would also know that a mod for the new version has been created and will be released for DONATORS only! Please, if you wont do some research and learning, at least read the thread you are posting in!
Bloodrun
07-18-2009, 04:53 PM
The last three posts in this thread have been deleted.
The altercations between them, are being dealt with.
At the same time, I would like to ask that non-staff members, leave the staffing to the actual staff.
I understand that you want to help, but it just causes to much commotion to others, especially when comments tend to get a little aggressive.
Please, don't let us see arguing in the Forums. If you have a problem with someone, please take it to PM, and alert a Moderator immediately. This is all in hopes to keep this community fun, and helpful.
Blues
07-27-2009, 06:14 PM
Can you add so we will also get money when clicking other people pet? And is this compitable with Rusnak PHP script 1.0.0?
Tequila
07-29-2009, 09:10 AM
Can you add so we will also get money when clicking other people pet? And is this compitable with Rusnak PHP script 1.0.0?
Unfortunaetly this is not compatible with the new script. Its for the old one.
SieghartZeke
10-06-2009, 11:44 AM
Ehm...i dont know where to put the MYSQL code....
And when i uplod the levelup file i get an error when i level up my pet...
Seapyramid
10-06-2009, 01:54 PM
Ehm...i dont know where to put the MYSQL code....
And when i uplod the levelup file i get an error when i level up my pet...
That is because this is for the old script & doesn't work with the new one.
jthm0138
10-06-2009, 09:51 PM
Ok... I am guessing this is a long shot but worth the try.
As everyone keeps pointing out, this mod is for an older version of the script, and is not compatible with the new one...... So...... Any chance of getting a copy of the old script? :-)
SieghartZeke
10-07-2009, 03:44 AM
Can you add so we will also get money when clicking other people pet? And is this compitable with Rusnak PHP script 1.0.0?
Unfortunaetly this is not compatible with the new script. Its for the old one.
But i have the version 1.00 of the script.... not the 2 beta...
Seapyramid
10-07-2009, 04:01 PM
Ok... I am guessing this is a long shot but worth the try.
As everyone keeps pointing out, this mod is for an older version of the script, and is not compatible with the new one...... So...... Any chance of getting a copy of the old script? :-)
Brandon might have a copy laying around, but support for it is no longer offered nor for any of it's mods such as this one.
Sea
SieghartZeke
10-08-2009, 03:47 AM
Ehm..someone know how to upgrade the Script??I WANT THE SHOP WITH THE CURRENCY!!!!!!
Seapyramid
10-08-2009, 06:45 AM
Currency mod has been added to the donators forum.
Sea
Bloodrun
10-08-2009, 07:51 AM
Ehm..someone know how to upgrade the Script??I WANT THE SHOP WITH THE CURRENCY!!!!!!
We can see that you want the shop, as well as many other people. There is currently this and many more scripts in the Donators Forum that would fix your problem.
But as it stands there is not a release planned for non-Donators. That does not mean that there won't be one.
I was planning on making a new one for non-Donators, but after what I need to get done, gets done.
SieghartZeke
10-12-2009, 01:11 PM
Nuuuuuuu...I cant wait! Dx
jthm0138
10-12-2009, 01:44 PM
Ummm.... Ok.. am I missing something?
I am a donator, and I cant find the updated script anywhere.
The reason I requested the old script was so I could compare the changes and update the script, as I would really like to have this on gamingarmy.com in the end. :-)
Seapyramid
10-12-2009, 01:54 PM
It's available in the Donator Forum. http://www.rusnakweb.com/forum/showthread.php?tid=1333
Sea
SieghartZeke
10-12-2009, 02:18 PM
Sniff...i want go in the Donator Forum!Pleaseeeeeeeeee can i enter only one time???I cant donating because i have only 14 age......=_=
Arianna
10-26-2009, 01:25 PM
It's available in the Donator Forum. http://www.rusnakweb.com/forum/showthread.php?tid=1333
Sea
*Waits quietly and patiently for her paypal account to be billed so she can see the amazing script.*
Gah! I am not a patient person. xP
SieghartZeke
10-31-2009, 08:47 AM
Ueee!
Szymon
02-08-2010, 07:01 AM
can anybody re-upload?
Tequila
02-08-2010, 10:28 AM
can anybody re-upload?
Old script mod, the newer mod is for Premium Members (and well worth $15 to help a college student out, buy the guy a brewski and a pizza pie).
Szymon
02-08-2010, 01:56 PM
but i'm form Poland :|
please send it to me on e-mail vandallow@wp.pl
Seapyramid
02-08-2010, 09:50 PM
but i'm form Poland :|
please send it to me on e-mail vandallow@wp.pl
It can't be sent to your email for free. It is for DONATORS only.. not for FREE.
Sea
Tequila
02-09-2010, 09:57 AM
but i'm form Poland :|
please send it to me on e-mail vandallow@wp.pl
http://www.xe.com/ucc/ - to find equivalent costs.
Brandon is giving way more than he gets out of this.
aldredheron
02-22-2010, 05:05 AM
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.
Seapyramid
02-22-2010, 07:48 AM
This mod is NOT for the current release of the adoptables. It is for the first release & does not work with the current version.
Sea
Tequila
02-22-2010, 08:13 AM
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.
This is for the old script (EasyPHP Adoptables) not the new Rusnak PHP Adoptables script. If you want access to the new shop/cash mod you'll need a premium membership. It's like 15$ to help Brandon out, he is a college student after all.
vBulletin® v3.8.11, Copyright ©2000-2025, vBulletin Solutions Inc.