Tequila
02-27-2010, 11:01 AM
If you level up any of the adoptables on my site at the moment it gives you something like this: http://familiarelements.info/earith/levelup.php?id=2
http://www.rusnakweb.com/forum/attachment.php?aid=244
[attachment=244]
Code I'm running for the template is as follows
<html>
<head>
<title>The World of Earith (Familiar Elements)</title>
<link rel="stylesheet" href="http://familiarelements.info/earith/templates/beta/levelstyle.css" type="text/css" />
<link rel="stylesheet" href="http://familiarelements.info/earith/templates/beta/favicon.ico" />
<!-- Meta Tags Snipped -->
</head>
<body>
<div id="floater" style="position:absolute; left:100px; top:25px;">
<center><script type="text/javascript"><!--
google_ad_client = "pub-9937811682735223";
/* 200x200, created 2/7/10 */
google_ad_slot = "5348034708";
google_ad_width = 200;
google_ad_height = 200;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></center>
<center><strong>Affiliates</strong><br /><!-- SNIP --><a href="pages.php?page=affiliate">Apply for Affiliation</a></center>
<center><strong>Vote for Us</strong><br /><a href="http://www.virtualpetcommunity.com/vote.php?vpsid=73"><img src="http://www.virtualpetcommunity.com/images/vpsbutton.gif" border="0"></a> <a href="http://www.ppntop50.com/"><img src="http://www.ppntop50.com/button.php?u=nyxiofearith" alt="PPN Top 50" border="0" /></a></center>
</div>
<div id="levelbox"><h1>:ARTICLETITLE:</h1>
<p>:ARTICLECONTENT:</p>
<div id="levelsignup"><a href="http://familiarelements.info/earith/register.php">Adopt Your Own</a> // <a href="http://familiarelements.info/earith/login.php">View Your Adoptables</a></div>
</div>
</body>
</html>
I cannot figure this one out. Any ideas anyone?
BMR777
02-27-2010, 12:07 PM
What is your levelup.php file code? Chances are you have an if statement or something where you never echo out the correct info to the user. Have you modified the levelup.php file?
Tequila
02-27-2010, 12:42 PM
Only additions are Sea's cash mod and Arianna's Decoration mod, and I changed the url setting for the theme.
Here's the file
<?php
// ************************************************** ********************
// Rusnak PHP Adoptables Script
// Copyright 2009 Brandon Rusnak
// For help and support: http://www.rusnakweb.com/forum/
//
// Redistribution prohibited without written permission
// ************************************************** ********************
// Wake the sleeping giant
// ************************************************** ********************
// Basic Configuration Info
// ************************************************** ********************
include("inc/functions.php");
include("inc/config.php");
include("lang/lang.php");
$themeurl = grabanysetting("leveltheme");
// ************************************************** ********************
// Define our top links by calling getlinks()
// ************************************************** ********************
$links = getlinks();
// ************************************************** ********************
// Define our ads by calling getads()
// ************************************************** ********************
$ads = getads("any");
// ************************************************** ********************
// Grab any dynamic article content from the content table
// ************************************************** ********************
$pagecontent = getsitecontent("index");
$article_title = $pagecontent[title];
$article_content = $pagecontent[content];
$article_content = nl2br($article_content);
// ************************************************** ********************
// Grab any settings that we will need for the current page from the DB
// ************************************************** ********************
$browsertitle = grabanysetting("browsertitle");
$sitename = grabanysetting("sitename");
$slogan = grabanysetting("slogan");
// ************************************************** ********************
// Check and see if the user is logged in to the site
// ************************************************** ********************
$loginstatus = logincheck();
$isloggedin = $loginstatus[loginstatus];
$loggedinname = $loginstatus[username];
// ************************************************** ********************
// End Prepwork - Output the page to the user
// ************************************************** ********************
$id = $_GET["id"];
$id = preg_replace("/[^a-zA-Z0-9s]/", "", $id);
$id = secure($id);
if($id == "" or !is_numeric($id)){
// If the ID is blank or non-numeric, then it is invalid...
$article_title = $err_idnoexist;
$article_content = $err_idnoexist_text;
}
else{
// We have what appears to be a valid adoptable ID, so we pull the adoptable's information from the database...
$query = "SELECT * FROM ".$prefix."owned_adoptables WHERE aid='$id'";
$result = mysql_query($query);
$num = mysql_numrows($result);
//Loop out code
$i=0;
while ($i < 1) {
$aid=@mysql_result($result,$i,"aid");
$type=@mysql_result($result,$i,"type");
$name=@mysql_result($result,$i,"name");
$totalclicks=@mysql_result($result,$i,"totalclicks");
$currentlevel=@mysql_result($result,$i,"currentlevel");
$usealternates=@mysql_result($result,$i,"usealternates");
$isfrozen=@mysql_result($result,$i,"isfrozen");
$owner=@mysql_result($result,$i,"owner");
$i++;
}
if($aid == $id){
// The adoptable does exist, so now we need to see if we can vote...
// We need to get the date today and the user's IP address (if is guest we use this)
$date = date('Y-m-d');
$ip = $_SERVER['REMOTE_ADDR'];
$ip = preg_replace("/[^a-zA-Z0-9@._-]/", "", $ip);
$ip = secure($ip);
$num = 0;
if($isloggedin == "yes"){
// If we are logged in, we check if a user with our username voted for this adoptable today...
$query = "SELECT * FROM ".$prefix."vote_voters WHERE adoptableid='$id' and username = '$loggedinname' and date = '$date'";
}
else{
$query = "SELECT * FROM ".$prefix."vote_voters WHERE adoptableid='$id' and ip = '$ip' and date = '$date'";
} // End the is logged in check else statement
// Check what the number for the query is...
$result = mysql_query($query);
$num = mysql_numrows($result);
if($num == 0){
// The number of results is still zero, so we did not vote on this adoptable yet today...
// Now we see if the adoptable is frozen by its owner. If it is, we do not level...
if($isfrozen == "yes"){
$article_title = $lang_isfrozen_title;
$article_content = $lang_isfrozen_explain;
}
else{
// Adoptable is NOT frozen, so I think we can actually proceed with the leveling up of this adoptable...
$newclicks = $totalclicks + 1; // Add 1 click to the current click total of this adoptable...
// Actually insert our click information into the database...
$query = "UPDATE ".$prefix."owned_adoptables SET totalclicks='".$newclicks."' WHERE aid='".$id."'";
mysql_query($query);
// Now we need to update our vote_voters table with the user's vote...
mysql_query("INSERT INTO ".$prefix."vote_voters VALUES ('$date', '$loggedinname', '$ip','$id')");
// Now we need to see if we actually level this adoptable up...
// See if another level actually exists...
$nextlevelexists = getnextlevelexists($type, $currentlevel);
if($nextlevelexists == "true"){
// A higher level does exist, so we see if it is time to level up
$nextlevel = $currentlevel + 1;
$query = "SELECT * FROM ".$prefix."levels WHERE adoptiename='$type' and thisislevel='$nextlevel'";
$result = mysql_query($query);
$num = mysql_numrows($result);
//Loop out code
$i=0;
while ($i < 1) {
$requiredclicks=@mysql_result($result,$i,"requiredclicks"); // The number of clicks required for the next level
$i++;
}
// Check if the number of clicks we have now is greater than or equal to the required clicks to level up...
if($newclicks >= $requiredclicks and $requiredclicks != 0 and $requiredclicks != ""){
// We need to level this adoptable up...
$query = "UPDATE ".$prefix."owned_adoptables SET currentlevel='".$nextlevel."' WHERE aid='".$id."'";
mysql_query($query);
// Now we check if we are enabling alternate images...
$parentid = converttypetoparentid($type); // Get the ID of the parent type adoptable
$altstatus = getaltstatus($parentid, $id, $nextlevel); // Check if we are using alternate images or not...
if($altstatus == "yes"){
// We are enabling alternate images for this adoptable...
$query = "UPDATE ".$prefix."owned_adoptables SET usealternates='yes' WHERE aid='".$id."'";
mysql_query($query);
}
// Now we can see if the adoptable's owner gets a reward...
// The reward function will take care of sending out any reward that exists...
$rewardstatus = reward($id, $type, $nextlevel, $owner);
} // End the if statement if we are leveling the adoptable up
}
// Here I show the decorations for the pets.
$query2= "SELECT * FROM ".$prefix."deco WHERE petid = '".$aid."'";
$result2 = mysql_query($query2);
$numdeco = mysql_numrows($result2);
// if the number of rows is bigger than 0..
if($numdeco > 0){
$i=0;
while ($i < $numdeco) {
$id2=@mysql_result($result2,$i,"id");
$type2=@mysql_result($result2,$i,"type");
$extra = $extra."<img src='decorations/".$type2.".png'>";
$i++;
}
// Show a thank you message along with the adoptable's information to the user...
$image = getcurrentimage($id); // Get the current image of the adoptable...
$article_title = $lang_gave."".$name." one ".$lang_unit;
$article_content = "<center><img src='".$image."'>".$extra."<br>".$lang_gave."".$name." the ".$type." one ".$lang_unit.".<br>".$name." is one of <a href='profile.php?user=".$owner."'>".$owner."</a>'s Familiars.<br>".$lang_levelup_encourage;
// ************************************************
// Start Rewards
// ************************************************
//Get currency on level up
$query = "SELECT * FROM `adopts_users` WHERE `username`='$loggedinname'";
$result = mysql_query($query);
$num = mysql_numrows($result);
$i = 0;
while ($i < 1) {
$money = @mysql_result($result, $i, "money");
// Change this number 10 to the number of currency you want users to earn on level up
$newbalance = $money + 2;
$i++;
}
mysql_query("UPDATE `adopts_users` SET `money`='" . $newbalance . "' WHERE `username`='$loggedinname'");
$article_content = $article_content . "<div align='center'><br />You have earned 2 silver coins for leveling up this Familiar. <br />You now have " . $newbalance . " silver coins.<br />
<img src='http://i36.tinypic.com/9ps5qb.jpg' border='0' /></div>";
}
// number of rows is 0, means there isn't a decoration - let's insert a space instead.
else{
$extra = " ";
}
} // Adoptable is not frozen, end isfrozen else check
}
else{
// We already voted on this adoptable today, so show an error...
if($isloggedin == "yes"){
$article_title = $lang_alreadyleveled_title;
$article_content = $lang_member_alreadyleveled;
}
else{
$article_title = $lang_alreadyleveled_title;;
$article_content = $lang_guest_alreadyleveled;
}
}
}
else{
// Adoptable is invalid, show an error...
$article_title = $err_idnoexist;
$article_content = $err_idnoexist_text;
}
} // End the ID is not blank and is numeric else check
// ************************************************** ********************
// Begin Template Definition
// ************************************************** ********************
//Define our current theme
$file = $themeurl;
// Do the template changes and echo the ready template
$template = file_get_contents($file);
$template = replace(':ARTICLETITLE:',$article_title,$template) ;
$template = replace(':ARTICLECONTENT:',$article_content,$templ ate);
$template = replace(':ARTICLEDATE:',$article_date,$template);
$template = replace(':BROWSERTITLE:',$browsertitle,$template);
$template = replace(':SITENAME:',$sitename,$template);
//Define our links
$template = replace(':LINKSBAR:',$links,$template);
//Get the content for the side bar...
$sidebar = getsidebar();
$template = replace(':SIDEFEED:',$sidebar,$template);
//Get the ad content...
$template = replace(':ADS:',$ads,$template);
//Get the slogan info
$template = replace(':SLOGAN:',$slogan,$template);
echo $template;
// ************************************************** ********************
// End Template Definition
// ************************************************** ********************
?>
Arianna
02-27-2010, 01:10 PM
Look at this part, there's a problem - you're getting the index content from the database.
// ************************************************** ********************
// Grab any dynamic article content from the content table
// ************************************************** ********************
$pagecontent = getsitecontent("index");
$article_title = $pagecontent[title];
$article_content = $pagecontent[content];
$article_content = nl2br($article_content);
Remove this, and now see if it works. ;)
BMR777
02-27-2010, 01:13 PM
Maybe this:
} // End the if statement if we are leveling the adoptable up
Should be after:
else{
$extra = " ";
}
I think you got your if else brackets messed up, so the text you want shown never appears. :)
See if that helps at all. :)
Arianna
02-27-2010, 01:22 PM
Probably if you use both of our solutions, it'll work. :)
Tequila
02-27-2010, 03:03 PM
I just restored the old Level Up page. I'll re add everything in a bit.[hr]
I've got it working now, just had to redo quite a bit of my personal modifications. You can lock this now.
vBulletin® v3.8.11, Copyright ©2000-2025, vBulletin Solutions Inc.