![]() |
|
#1
|
||||
|
||||
|
*Eye twitch* Well, I just set up 1.2.3, and everything was working perfectly...until now. I can not, it seems, adopt more than one pet. I've adopted one, but it says it's id is 2, and then I adopted another, the success page popped up, but then when I clicked "Feed" in the sentence, the id was not automatically filled in, so I added in "3", which was the correct id, but it said that the pet didn't exist. So I went to my adoptables, and, what do you know! I only have one pet.
I have no idea what's up with this...and I'm not sure which PHP I should post...so if anyone has any idea of what to do, please help O_O EDIT: Here's a snap shot of part of what's going on: HERE Here's the site, if that helps: Here EDIT: Might be in my doadopt.php? Here that is: Code:
<?php
include("inc/functions.php");
//***************//
// START SCRIPT //
//***************//
$id = $_GET["id"];
$promocode = $_GET["promocode"];
$name = $_GET["name"];
if($isloggedin == "yes"){
if($_SESSION["allow"] != 1){
$article_title = $err_idnoexist;
$article_content = $err_idnoexist_text;
}
elseif($_SESSION["allow"] == 1){
// I guess the first thing to do is see if we have a valid adoptable ID submitted...
if($id == "" or !is_numeric($id)){
$article_title = $err_idnoexist;
$article_content = $err_idnoexist_text;
}
else{
// The adoptable ID appears to be valid, so we need to double check that it is valid by pulling up the adoptable in the DB
$query = "SELECT * FROM {$prefix}adoptables WHERE id={$id}";
$result = runquery($query);
$row = mysql_fetch_array($result);
if($id == $row['id']){
// The ID submitted matches an existing adoptable type
$canadopt = canadopt($row['id'], "adopting", $promocode, $row);
// If we can adopt this creature, do the adoption
if($canadopt == "yes") {
if (changecash(-$row['cost'], $GLOBALS['loggedinname'], $GLOBALS['money'])==true) {
// BEGIN the actual adoption process
// First we see if we have a custom name; if not, we use the default name
if($name == ""){
$name = $row['type'];
}
// Now we determine if we are using alternate images or not
$alts = getaltstatus($id, 0, 0);
// We need a unique code for the adoptable so we can show it to the user when we're done here...
$code = rand(1, 20000);
$genders = array('f', 'm');
$rand = rand(0,1);
runquery("INSERT INTO {$prefix}owned_adoptables VALUES ('', '{$row['type']}', '$name','$loggedinname','0','0', '$code', '','$alts','fortrade','no', '$genders[$rand]','0')");
// Adoption complete, show the user a confirmation screen...
$result = runquery("SELECT * FROM {$prefix}owned_adoptables WHERE code='{$code}' and owner='{$loggedinname}'") ;
$id=@mysql_result($result,0,"aid");
$article_title = $name." adopted successfully";
$article_content = "<img src='{$row['eggimage']}'><br>{$congrats1} {$name}. You can now manage {$name} on the
<a href='myadopts.php'>My Adopts</a> page.<br><br><b><a href='myadopts.php?act=manage&id={$id}'>Click Here to Manage {$name}</a><br>
<a href='myadopts.php?act=bbcode&id={$id}'>Click Here to get BBCodes / HTML Codes for {$name}</a></b><br><br>
Be sure and <a href='levelup.php?id={$id}'>pet</a> {$name} your Lirie, so that they grow!";
unset($_SESSION["allow"]);
// END the actual adoption process
}
else {
$article_title = "Not enough money.";
$article_content = "You don't have enough {$GLOBALS['settings']['cost']} to buy this adoptable. Earn some money and then try again.";
}
}
else {
$article_title = $accden;
$article_content = $adoptnoper;
}
} // End the if for if $id == $aid
else {
// Adoptable does not exist, show an error.
$article_title = $err_idnoexist;
$article_content = $err_idnoexist_text;
} // End the else for if $id == $aid
} // End the valid ID input else test statement (bulk of code goes above here)
}
} // End the log in check IF
else {
// Guests cannot adopt pets, so why bother...
$article_title = $guesttitleerror;
$article_content = $guesterror;
} // End the log in check ELSE
//***************//
// OUTPUT PAGE //
//***************//
echo showpage($article_title, $article_content, $date);
?>
Code:
<?php
include("inc/functions.php");
//***************//
// START SCRIPT //
//***************//
$id = $_GET["id"];
$act = $_GET["act"];
$more = $_GET["more"];
if($isloggedin == "yes")
{
if($act == "")
{
$article_title = "Your Adoptables";
$article_content = "<table>
<tr>
<th></th><th>Name and Type</th><th>Image</th><th>Clicks</th>
</tr>";
// We need to get all of the user's adoptables from the database and display them...
$query = "SELECT * FROM {$prefix}owned_adoptables,
{$prefix}adoptables,
{$prefix}levels WHERE {$prefix}owned_adoptables.owner = '{$loggedinname}'
AND {$prefix}adoptables.type = {$prefix}owned_adoptables.type
AND {$prefix}levels.thisislevel = {$prefix}owned_adoptables.currentlevel
AND {$prefix}levels.adoptiename = {$prefix}adoptables.type
ORDER BY {$prefix}owned_adoptables.totalclicks";
$result = runquery($query);
while($row = mysql_fetch_array($result))
{
if($row['usealternates'] =='yes')
{
$image = $row['alternateimage'];
}
else
{
$image = $row['primaryimage'];
}
if($row['currentlevel'] == 0)
{
$image = $row['eggimage'];
}
if($image=='')
{
$image = $row['primaryimage'];
}
$article_content .= "<tr>
<td><img src='picuploads/{$row['gender']}.png'></td>
<td><em>{$row['name']}</em> the {$row['type']}</td>
<td><a href='myadopts.php?act=manage&id={$row['aid']}'><img src='{$image}'></a></td>
<td>{$row['totalclicks']}</td>
</tr>";
}
$article_content .= "</table>";
}
elseif($act == "manage")
{
// We are managing a specific adoptable
if(!is_numeric($id))
{
$article_title = $err_idnoexist;
$article_content = $err_idnoexist_text;
}
else
{
// See if the adoptable actually exists...
$query = "SELECT * FROM {$prefix}owned_adoptables WHERE owner='{$loggedinname}' and aid='{$id}'";
$result = runquery($query);
$row = mysql_fetch_array($result);
// Check that the adoptable exists for real, or show an error...
if($row['aid'] == $id)
{
// The adoptable does exist, so we show the image and junk to the user...
$image = getcurrentimage($id);
$article_title = "Managing {$row['name']}";
$article_content = "<img src='{$image}'><br /><br />This page allows you to manage {$row['name']}. Click on an option below to change settings.<br /><br />
<b><a href='levelup.php?id={$id}'><img src='templates/icons/add.gif' border=0> Level Up {$row['name']}</a><br />
<a href='myadopts.php?act=stats&id={$id}'><img src='templates/icons/stats.gif' border=0> Get Stats for {$row['name']}</a><br />
<a href='myadopts.php?act=bbcode&id={$id}'><img src='templates/icons/bbcodes.gif' border=0> Get BBCodes / HTML Codes for {$row['name']}</a><br />
<a href='myadopts.php?act=rename&id={$id}'><img src='templates/icons/title.gif' border=0> Rename {$row['name']}</a><br />
<a href='myadopts.php?act=trade&id={$id}'><img src='templates/icons/trade.gif' border=0> Change Trade Status {$row['name']}</a><br />
<a href='myadopts.php?act=freeze&id={$id}'><img src='templates/icons/freeze.gif' border=0> Freeze or Unfreeze {$row['name']}</a><br />
<a href='myadopts.php?act=pound&id={$id}'><img src='templates/icons/delete.gif' border=0> Pound {$row['name']}</a></b>";
}
else
{
$article_title = $err_idnoexist;
$article_content = $err_idnoexist_text;
}
}
} // End the MANAGE action code
elseif($act == "stats")
{
// We are getting the stats for the adoptable
// Check that an ID was submitted...
if(is_numeric($id))
{
// Now we see if the adoptable actually exists...
$query = "SELECT * FROM {$prefix}owned_adoptables WHERE owner='{$loggedinname}' and aid='{$id}'";
$result = runquery($query);
$row = mysql_fetch_array($result);
if($row['aid'] == $id)
{
// The adoptable exists, so we show the stats for it...
$image = getcurrentimage($id);
$nextlevelexists = getnextlevelexists($type, $currentlevel);
// If a higher level exists, get that level's information...
if($nextlevelexists == "true")
{
$nextlevel = $currentlevel + 1;
$query = "SELECT * FROM {$prefix}levels WHERE adoptiename='{$type}' and thisislevel='{$nextlevel}'";
$result = runquery($query);
$requiredclicks=@mysql_result($result,0,"requiredclicks"); //The adoptable's ID
} // End grab next level info...
// Determine what to show for next level:
if($nextlevelexists == "true" and $nextlevel != "")
{
// See how many more clicks to go
$ctg = $requiredclicks - $row['totalclicks'];
$nloutput = "{$nextlevel}<br />Clicks Required for Level Increase: {$ctg}";
}
else
{
$nloutput = "This adoptable is at its maximum level";
}
$article_title = "{$row['name']}'s Statistics:";
$article_content = "<img src='{$image}'><br /><br />
<b>Total Clicks: {$row['totalclicks']}<br />
Gender: <img src='picuploads/{$row['gender']}.png'><br />
Trade Status: {$row['tradestatus']}<br />
Current Level: {$row['currentlevel']}<br />
Next Level: {$nloutput}<br /></b>";
// Voters Information...
$article_content .= "<h2>{$row['name']}'s Voters:</h2><br />
{$lang_voters_explain}<br /><br />
<table width='450' border='1'>
<tr>
<td width='129'><strong>Username:</strong></td>
<td width='156'><strong>Date Voted: </strong></td>
<td width='82'><strong>Profile:</strong></td>
<td width='55'><strong>PM:</strong></td>
</tr>";
// Select the voters from the DB
$query = "SELECT * FROM {$prefix}vote_voters WHERE adoptableid='{$id}' ORDER BY date DESC LIMIT 10";
$result = runquery($query);
while ($row = mysql_fetch_array($result))
{
if($row['username'] == "")
{
$row['username'] = "Guest";
}
if($row['username'] == "Guest")
{
$article_content .= "
<tr>
<td><div align='left'>Guest</div></td>
<td><div align='left'>{$row['date']}</div></td>
<td><div align='center'></div></td>
<td><div align='center'></div></td>
</tr>";
}
else
{
$article_content .= "
<tr>
<td><div align='left'>{$row['username']}</div></td>
<td><div align='left'>{$row['date']}</div></td>
<td><div align='center'><a href='profile.php?user={$row['username']}' target='_blank'><img src='templates/buttons/profile.gif' border=0></a></div></td>
<td><div align='center'><a href='messages.php?act=newpm&user={$row['username']}' target='_blank'><img src='templates/buttons/pm.gif' border=0></a></div></td>
</tr>";
}
}
$article_content .= "</table><br />";
}
else
{
$article_title = $err_idnoexist;
$article_content = $err_idnoexist_text;
}
}
else
{
$article_title = $err_idnoexist;
$article_content = $err_idnoexist_text;
}
} // End the STATS code
elseif($act == "bbcode")
{
if(is_numeric($id))
{
// Now we see if the adoptable actually exists...
$query = "SELECT * FROM {$prefix}owned_adoptables WHERE owner='{$loggedinname}' and aid='{$id}'";
$result = runquery($query);
$row = mysql_fetch_array($result);
if($row['aid'] == $id)
{
$altbb = grabanysetting("usealtbbcode");
// Adoptable exists, so show the BBCode:
$article_title = "Codes for {$name}";
$article_content = "{$lang_bbcode_explain}<br />
<p><u>Forum Codes / BBCode: </u></p>
<p>
<textarea name='textarea' cols='50' rows='4'>
}]
__________________
My Mods Site (1.3.4, 2020 Mods) Last edited by Abronsyth; 09-10-2011 at 06:19 PM. |
|
|
What's New? |
What's Hot? |
What's Popular? |