Mysidia Adoptables Support Forum

Mysidia Adoptables Support Forum (http://www.mysidiaadoptables.com/forum/index.php)
-   Questions and Supports (http://www.mysidiaadoptables.com/forum/forumdisplay.php?f=18)
-   -   How can I do these things? (http://www.mysidiaadoptables.com/forum/showthread.php?t=2021)

AlexC 03-18-2011 03:45 PM

How can I do these things?
 
Okay, I hope nobody minds the bulk post, but I'm struggling a little, and the more I stare at the php, the more confusing it looks... xD

First off, how can I edit how the myadopts page is arranged? I REALLY love the way it's displayed now, but I was wondering of adding some stuff. How can I do this?

I wanted to make it look something like this;

Gender
Name/Breed
Picture
Level/Current Clicks/Clicks until Next Level
Trade Status/Frozen Status?
Feed Link (since nobody likes going through the middle step)

Can someone point out where I need to edit this?

Second, I'm not sure if this is a glitch or not, but the pound is only showing one rat at a time? I know there is multiple rats owned by the system since I abandoned them with the sole purpose of testing it, and for some reason, only one is showing up. The first one to be abandoned is there, and then once it's adopted, the next one shows up. Can I change this so the users can view all of the pets in the pound?

Third; table bbc - I know I could probably go through the cpanel, but I like editing through the site, less tabs open. I wanted to do a table on the news page, since that's how I was displaying it on my MA site and I liked that way. I know it's simple to add bbc, I did this with a small script someone had for adopts, but I'm not sure how to make it.

EDIT: Fourth - I am having trouble when I do things like Rat's or something. It turns out Rat\'s. This is happening everywhere, can I stop it, or do I have to go back and edit everything? (don't think I can, I did some in the descriptions of rats...)

EDIT AGAIN: Gah, sorry, but I forgot one more thing - how do I remove a skin? I don't want to have the element one, and it doesn't appear to be working as a default one.

I'm sorry for all the questions, I've never done this before!

fadillzzz 03-19-2011 12:27 AM

-- First
PHP 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>Level</th><th>Clicks</th><th>Next Level</th><th>Frozen/Trade</th><th>Feed</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);
    
$num mysql_numrows($result);
    
//Loop out code
    
$i=0;
    while (
$i $num) {
        
$aid=@mysql_result($result,$i$prefix."owned_adoptables.aid");
        
$currentlevel=@mysql_result($result,$i$prefix."owned_adoptables.currentlevel");
        
$gender=@mysql_result($result,$i$prefix."owned_adoptables.gender");
        
$type=@mysql_result($result,$i$prefix."owned_adoptables.type");
        
$name=@mysql_result($result,$i$prefix."owned_adoptables.name");
        
$eggimage=@mysql_result($result,$i$prefix."adoptables.eggimage");
        
$usealternates=@mysql_result($result,$i$prefix."owned_adoptables.usealternates");
        
$totalclicks=@mysql_result($result,$i$prefix."owned_adoptables.totalclicks");
        
$primaryimage=@mysql_result($result,$i$prefix."levels.primaryimage");
        
$alternateimage=@mysql_result($result,$i$prefix."levels.alternateimage");
        
$currentlevel=@mysql_result($result$i$prefix."owned_adoptables.currentlevel");
        
$isfrozen=@mysql_result($result$i$prefix."owned_adoptables.isfrozen");
        
$tradestatus=@mysql_result($result$i$prefix."owned_adoptables.tradestatus");
        
        if(
getnextlevelexists($type$currentlevel) == "true")
        {
            
$res mysql_query("SELECT * FROM ".$prefix."levels WHERE thisislevel = {$currentlevel} +1");
            
$reqClicks = @mysql_result($res0"requiredclicks");
            
$reqClicks $currentlevel +" / " $reqClicks " Clicks";
        }
        else
        {
            
$reqClicks "Max level reached";
        }
        
        if (
$usealternates=='yes') { $image $alternateimage; }
        else { 
$image $primaryimage; }
        if (
$currentlevel==0) { $image $eggimage; }
        if (
$image=='') { $image $primaryimage; }
        
$article_content .= "<tr><td><img src='picuploads/{$gender}.png'></td><td><em>{$name}</em> the {$type}</td><td><a href='myadopts.php?act=manage&id={$aid}'><img src='{$image}'></a></td><td>{$currentlevel}</td><td>{$totalclicks}</td><td>{$reqClicks}</td><td>{$isfrozen} / {$tradestatus}</td><td><a href='levelup.php?id={$aid}'>Feed {$name}</a></tr>";
        
$i++;
    }
    
$article_content .= "</table>";

}
else if(
$act == "manage"){

// We are managing a specific adoptable

if($id == "" or !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);
$num mysql_numrows($result);

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

$aid=@mysql_result($result,$i,"aid"); //The adoptable's ID
$currentlevel=@mysql_result($result,$i,"currentlevel");
$type=@mysql_result($result,$i,"type");
$name=@mysql_result($result,$i,"name");
$tradestatus=@mysql_result($result,$i,"tradestatus");

$i++;
}

// Check that the adoptable exists for real, or show an error...

if($aid == $id){

// The adoptable does exist, so we show the image and junk to the user...

$image getcurrentimage($id);

$article_title "Managing ".$name;
$article_content "<img src='".$image."'><br><br>This page allows you to manage ".$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 ".$name."</a><br>
<a href='myadopts.php?act=stats&id="
.$id."'><img src='templates/icons/stats.gif' border=0> Get Stats for ".$name."</a><br>
<a href='myadopts.php?act=bbcode&id="
.$id."'><img src='templates/icons/bbcodes.gif' border=0> Get BBCodes / HTML Codes for ".$name."</a><br>
<a href='myadopts.php?act=rename&id="
.$id."'><img src='templates/icons/title.gif' border=0> Rename ".$name."</a><br>
<a href='myadopts.php?act=trade&id="
.$id."'><img src='templates/icons/trade.gif' border=0> Change Trade Status ".$name."</a><br>
<a href='myadopts.php?act=freeze&id="
.$id."'><img src='templates/icons/freeze.gif' border=0> Freeze or Unfreeze ".$name."</a><br>
<a href='myadopts.php?act=pound&id="
.$id."'><img src='templates/icons/delete.gif' border=0> Pound ".$name."</a></b>";

}
else{

$article_title $err_idnoexist;
$article_content $err_idnoexist_text;

}

}

// End the MANAGE action code
else if($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);
$num mysql_numrows($result);

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

$aid=@mysql_result($result,$i,"aid"); //The adoptable's ID
$currentlevel=@mysql_result($result,$i,"currentlevel");
$type=@mysql_result($result,$i,"type");
$name=@mysql_result($result,$i,"name");
$totalclicks=@mysql_result($result,$i,"totalclicks");
$gender=@mysql_result($result,$i,"gender");
$tradestatus=@mysql_result($result,$i,"tradestatus");

$i++;
}

if(
$aid == $id){

// The adoptable exists, so we show the stats for it...


$image getcurrentimage($id);
$nextlevelexists getnextlevelexists($type$currentlevel);

$nextlevel "";

// 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);
$num mysql_numrows($result);

$i=0;
while (
$i 1) {

$requiredclicks=@mysql_result($result,$i,"requiredclicks"); //The adoptable's ID


$i++;
}


// 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 totalclicks;

$nloutput $nextlevel."<br>Clicks Required for Level Increase: ".$ctg;

}
else{

$nloutput "This adoptable is at its maximum level";

}


$article_title $name."'s Statistics:";
$article_content "<img src='".$image."'><br><br>
<b>Total Clicks: "
.$totalclicks."<br>
Gender: <img src='picuploads/
{$gender}.png'><br>
Trade Status: "
.$tradestatus."<br>
Current Level: "
.$currentlevel."<br>
Next Level: "
.$nloutput."<br></b>";

// Voters Information...

$article_content $article_content."<h2>".$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);
$num mysql_numrows($result);

$i=0;
while (
$i $num) {

$date=@mysql_result($result,$i,"date"); 
$username=@mysql_result($result,$i,"username"); 

if(
$username == ""){

$username "Guest";

}

if(
$username == "Guest"){

$article_content $article_content."<tr>
    <td><div align='left'>Guest</div></td>
    <td><div align='left'>"
.$date."</div></td>
    <td><div align='center'></div></td>
    <td><div align='center'></div></td>
  </tr>"
;

}
else{

$article_content $article_content."<tr>
    <td><div align='left'>"
.$username."</div></td>
    <td><div align='left'>"
.$date."</div></td>
    <td><div align='center'><a href='profile.php?user="
.$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="
.$username."' target='_blank'><img src='templates/buttons/pm.gif' border=0></a></div></td>
  </tr>"
;


}



$i++;
}

$article_content $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
else if($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);
$num mysql_numrows($result);

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

$aid=@mysql_result($result,$i,"aid"); //The adoptable's ID
$currentlevel=@mysql_result($result,$i,"currentlevel");
$type=@mysql_result($result,$i,"type");
$name=@mysql_result($result,$i,"name");
$totalclicks=@mysql_result($result,$i,"totalclicks");
$isfrozen=@mysql_result($result,$i,"isfrozen");

$i++;
}

if(
$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'>[url=http://www."
.$domain."".$scriptpath."/levelup.php?id=".$aid."][img]http://www.".$domain."".$scriptpath."/siggy.php?id=".$aid."[/img][/url]
</textarea>
</p>"
;

if(
$altbb == "yes"){

// Use the seo friendly alternate bbcodes...

$article_content $article_content."<p><u>Alternate BBCodes (Use if the above do not work on a forum): </u></p>
<p>
  <textarea name='textarea' cols='50' rows='4'>[url=http://www."
.$domain."".$scriptpath."/levelup.php?id=".$aid."][img]http://www.".$domain."".$scriptpath."/get/".$aid.".gif\"[/img][/url]
</textarea>
</p>"
;

}



$article_content $article_content."<p><u>HTML Code</u>:</p>
<p>
<textarea name='textarea' cols='50' rows='4'><a href=\"http://www."
.$domain."".$scriptpath."/levelup.php?id=".$aid."\" target=\"_blank\">
<img src=\"http://www."
.$domain."".$scriptpath."/siggy.php?id=".$aid."\" border=0></a>
  </textarea>
   
</p>"
;

}
else{

$article_title $err_idnoexist;
$article_content $err_idnoexist_text;

}


}
else{

$article_title $err_idnoexist;
$article_content $err_idnoexist_text;

}




// End the BBCODE generation for the adoptable...
else if($act == "rename"){

// We are renaming an adoptable

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);
$num mysql_numrows($result);

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

$aid=@mysql_result($result,$i,"aid"); //The adoptable's ID
$currentlevel=@mysql_result($result,$i,"currentlevel");
$type=@mysql_result($result,$i,"type");
$name=@mysql_result($result,$i,"name");
$totalclicks=@mysql_result($result,$i,"totalclicks");
$isfrozen=@mysql_result($result,$i,"isfrozen");

$i++;
}

if(
$aid == $id){

$image getcurrentimage($id);

if(
$isfrozen != "yes"){

if(
$more == ""){

$article_title "Rename ".$name;
$article_content "<img src='".$image."'><br>".$lang_rename."".$name."".$lang_rename2."<br>
<form name='form1' method='get' action='myadopts.php'>
  <p>Adoptable Name: 
    <input name='more' type='text' id='more'>
    <input name='id' type='hidden' id='id' value='"
.$id."'>
    <input name='act' type='hidden' id='act' value='rename'>
</p>
  <p>
    <input type='submit' name='Submit' value='Rename Adoptable'>
</p>
</form>"
;

}
else{

// We are renaming the adoptable

// The adoptable exists, so now we can rename it...

$query "UPDATE ".$prefix."owned_adoptables SET name='".$more."' WHERE aid='".$id."' and owner='".$loggedinname."'";
runquery($query);


$article_title $lang_rename_success_title;
$article_content "<img src='".$image."'><br>".$lang_rename_success."".$more.".  You can now manage ".$more." on the <a href='myadopts.php?act=manage&id=".$id."'>My Adopts</a> page.";

}
}
else{

// We cannot rename a frozen adoptable...

$article_title $lang_frozen_title;
$article_content $lang_frozen."<a href='manage.php?act=freeze&id=".$id."&more=unfreeze'>unfreeze</a> ".$lang_frozen2;

}


}
else{

$article_title $err_idnoexist;
$article_content $err_idnoexist_text;

}
}
else{

$article_title $err_idnoexist;
$article_content $err_idnoexist_text;

}

}

else if(
$act == "trade"){

// We are setting the trade status for an adoptable...


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 mysql_query($query);
$num mysql_numrows($result);

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

$aid=@mysql_result($result,$i,"aid"); //The adoptable's ID
$tradestatus=@mysql_result($result,$i,"tradestatus");

$i++;
}

if(
$aid == $id){

$image getcurrentimage($id); // Get the image for the adopt...

if($more == ""){

$article_title "Setting trade status for ".$name;
$article_content "Are you sure you wish to change the trade status of this adoptable?<center><b><a href='myadopts.php?act=trade&id=".$id."&more=confirm'>Yes I'd like to change its trade status</a></b><br><br>
<b><a href='myadopts.php'>Nope I change my mind!  Go back to the previous page.</a></b></center><br>"
;

}

else if(
$more == "confirm"){  
  if(
$tradestatus == "fortrade"){
  
$newtradestatus "notfortrade";
  
$query "UPDATE ".$prefix."owned_adoptables SET tradestatus='".$newtradestatus."' WHERE aid='".$id."' and owner='".$loggedinname."'";
  
runquery($query);
  
$article_title "Change trade status successfully";
  
$article_content "The adoptable's trade status is now Not for Trade";
  }                
  else if(
$tradestatus == "notfortrade"){
  
$newtradestatus "fortrade";
  
$query "UPDATE ".$prefix."owned_adoptables SET tradestatus='".$newtradestatus."' WHERE aid='".$id."' and owner='".$loggedinname."'";
  
runquery($query);
  
$article_title "Change trade status successfully";
  
$article_content "The adoptable's trade status is now For Trade";
  }
  else{
  
$article_title "Something is very very wrong";
  
$article_content "Please check phpmyadmin to see if the settings are correct, or report your issue to Mysidia Adoptables support forum";
  }
}

else{

$article_title "Invalid Action";
$article_content "Invalid Action Specified";

}
}

else{

$article_title $err_idnoexist;
$article_content $err_idnoexist;

}
}
else{

$article_title $err_idnoexist;
$article_content $err_idnoexist_text;

}

}

else if(
$act == "freeze"){

// We are freezing an adoptable here...

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);
$num mysql_numrows($result);

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

$aid=@mysql_result($result,$i,"aid"); //The adoptable's ID
$currentlevel=@mysql_result($result,$i,"currentlevel");
$type=@mysql_result($result,$i,"type");
$name=@mysql_result($result,$i,"name");
$totalclicks=@mysql_result($result,$i,"totalclicks");
$isfrozen=@mysql_result($result,$i,"isfrozen");

$i++;
}

if(
$aid == $id){

$image getcurrentimage($id); // Get the image for the adopt...

if($more == ""){

if(
$isfrozen == "yes"){
$status "<img src='templates/icons/freeze.gif'> Frozen<br>";
$go "<a href='myadopts.php?act=freeze&id=".$id."&more=unfreeze'><img src='templates/icons/unfreeze.gif' border=0> Unfreeze This Adoptable</a>";
}
else{
$status "<img src='templates/icons/unfreeze.gif'> Not Frozen<br>";
$go "<a href='myadopts.php?act=freeze&id=".$id."&more=freeze'><img src='templates/icons/freeze.gif' border=0> Freeze This Adoptable</a>";
}

$article_title $lang_freeze_title;
$article_content "<img src='".$image."'><br><b>".$name."'s Current Status: ".$status."</b><br>".$lang_freeze."<br><br><b>".$go."</b><br><br>
"
.$lang_freeze_warning."";



}
else{

// We are actually freezing or unfreezing the adopt...

$frz "no";

if(
$more == "freeze"){

$frz "yes";

}

$query "UPDATE ".$prefix."owned_adoptables SET isfrozen='".$frz."' WHERE aid='".$id."' and owner='".$loggedinname."'";
runquery($query);

if(
$frz == "yes"){
$article_title $name." Frozen Successfully";
}
else{
$article_title $name." Unfrozen Successfully";
}

$article_content "Action Complete.  You may now manage ".$name." on the <a href='myadopts.php?act=manage&id=".$id."'>My Adopts</a> page.";





}

}
else{

$article_title $err_idnoexist;
$article_content $err_idnoexist_text;

}
}
else{

$article_title $err_idnoexist;
$article_content $err_idnoexist_text;

}


}

else if(
$act == "pound"){


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);
$num mysql_numrows($result);

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

$aid=@mysql_result($result,$i,"aid"); //The adoptable's ID
$currentlevel=@mysql_result($result,$i,"currentlevel");
$type=@mysql_result($result,$i,"type");
$name=@mysql_result($result,$i,"name");
$totalclicks=@mysql_result($result,$i,"totalclicks");
$isfrozen=@mysql_result($result,$i,"isfrozen");

$i++;
}

if(
$aid == $id){

$image getcurrentimage($id); // Get the image for the adopt...

if($more == ""){

$article_title "Pound ".$name;
$article_content "<img src='".$image."'><br>".$lang_pound."<br><br>".$lang_pound_warning."<br><br>
<center><b><a href='myadopts.php?act=pound&id="
.$id."&more=confirm'><img src='templates/icons/delete.gif' border=0> Pound ".$name." - I dont want it anymore! <img src='templates/icons/delete.gif' border=0></a></b><br><br>
<b><a href='myadopts.php'><img src='templates/icons/yes.gif' border=0> DO NOT Pound "
.$name."! <img src='templates/icons/yes.gif' border=0></a></b></center><br>";

}
else if(
$more == "confirm"){

// Actually run the execution

$query "UPDATE ".$prefix."owned_adoptables SET owner='SYSTEM' WHERE aid='".$id."'";
runquery($query); 

$article_title $lang_pound_title_complete;
$article_content $lang_pound_complete;

}
else{

$article_title "Invalid Action";
$article_content "Invalid Action Specified";

}


}
else{

$article_title $err_idnoexist;
$article_content $err_idnoexist_text;

}
}
else{

$article_title $err_idnoexist;
$article_content $err_idnoexist_text;

}

}
else{

// No valid action specified :: show an error

$article_title $lang_invalid_action_title;
$article_content $lang_invalid_action;

}



}
else{

$article_title $accden;
$article_content $reqlogin;

// End is logged in check else


//***************//
//  OUTPUT PAGE  //
//***************//

echo showpage($article_title$article_content$date);

?>

Make sure your layout is wide enough to display all the data and backup your file before using the code above.

-- Second
It shouldn't do that. Maybe you've edited the code before. Post it here, I'll take a look and see what's wrong.

-- Third
I'm not sure about this one, but please do try it.
Put it inside the inc/bbcode.php
PHP Code:

        $text preg_replace('|\[table\](.+?)\[\/table\]|i''<table>$1</table>'$text);
        
$text preg_replace('|\[th\](.+?)\[\/th\]|i''<th>$1</th>'$text);
        
$text preg_replace('|\[tr\](.+?)\[\/tr\]|i''<tr>$1</tr>'$text);
        
$text preg_replace('|\[td\](.+?)\[\/td\]|i''<td>$1</td>'$text); 

-- Fourth
The backslash is to escape the character to prevent SQL injection

-- Last?
You have to edit the database manually and then remove the theme folder from the templates folder.
For the database, you'll have to delete the corresponding row to the theme in adopts_themes table.

AlexC 03-19-2011 07:57 AM

Thanks very much for posting! I do not have access to my computer for the weekend, so I shall test this all on Monday - thanks so much though!

~ ipod

AlexC 03-21-2011 09:44 AM

Thank you for the myadopts page edit, I edited the page to my liking and it works wonderfully!

Here is my pound page.

Code:

<?php

include("inc/functions.php");

//***************//
//  START SCRIPT //
//***************//

$id = $_GET["id"];
$aid = $_GET["aid"];
$type = $_GET["type"];
$name = $_GET["name"];
$currentlevel = $_GET["currentlevel"];

// Here we check if we have an ID that has been submitted or no

if($aid == "" or !is_numeric($id)) {
        // We did not enter in an id, or it is not a number
        $article_title = $poundtitle;
        $article_content = $poundcontent;

        // If we are a guest, show a message that lets them know that they cannot adopt...
        if($isloggedin != "yes"){
                $article_content = $article_content.$poundguestcontent;
        }

        // Begin the output of all the adoptables to the user...
        $query = "SELECT * FROM ".$prefix."owned_adoptables WHERE owner='SYSTEM'";
        $result = runquery($query);
       
        $article_content .= "<form name='form1' method='get' action='poundpost.php'>
        <h3>The Rat Rescue</h3><table>";

        while($row = mysql_fetch_array($result)) {
                $aid=$row['aid'];
                $type=$row['type'];
                $name=$row['name'];
                $currentlevel=$row['currentlevel'];
                $gender=$row['gender'];
        $adoptimage=getcurrentimage($aid);

        $query = "SELECT * FROM ".$prefix."adoptables WHERE type='$type'";
        $result = runquery($query);
        $num = @mysql_numrows($result);

        $i=0;
        while ($i < 1) {

        $cost=@mysql_result($result,$i,"cost"); //The cost of adoption

        $i++;
        }
 
        $totalcost = $cost * $currentlevel;

                // Call a function to check if we have the proper privledge level to adopt this pet

                        $article_content .= "<tr>
                        <td><input type='radio' name='aid' id='aid' value='{$aid}' /></td>
                        <td style='text-align: center'><img src='".$adoptimage."' /></td>
                        <td><strong>{$name}</strong> <br> Cost: $totalcost
            <td>level: $currentlevel <br> Gender: <img src='picuploads/{$gender}.png'> </td></tr>";

        } // End the looping out of all adoptables...
       
        $article_content .= "</table>
        <h3>Care to adopt an abandoned rat?</h3>
                          <p>
                <input name='aid' type='hidden' id='aid' value='".$aid."'/>
                <input name='type' type='hidden' id='type' value='".$type."'/>
                <input name='name' type='hidden' id='name' value='".$name."'/>
                                <input name='currentlevel' type='hidden' id='currentlevel' value='".$currentlevel."'>
                          </p>
                          <p>
                                <input type='submit' name='Submit' value='Adopt Me'>
                        </p>
        </form>";
} // This bracket ends the IF check for whether or not an ID was entered
else{
        // We have specified an ID of an adoptable we wish to adopt

        $query = "SELECT * FROM ".$prefix."owned_adoptables WHERE aid='$aid' LIMIT 1";
        $result = runquery($query);
        $row = mysql_fetch_array($result);

        $id=$row['aid'];
        $type=$row['type'];
        $name=$row['name'];
        $currentlevel=$row['currentlevel'];
        $gender=$row['gender'];
    $adoptimage=getcurrentimage($aid);

        if($aid == $id){
                //The adoptable exists and is valid

                if($canadopt == "yes"){

                        $article_title = "Adopting abandoned rat named ".$name;
                        $article_content = $langa1."".$name.$langa2;

                        $article_content = $article_content."<br><img src='".$adoptimage."' border='0'><br>
                        <form name='form1' method='get' action='poundpost.php'>
                          <p>
                                <input name='aid' type='hidden' id='aid' value='".$aid."'>
                                <input name='type' type='hidden' id='type' value='".$type."'>
                                <input name='name' type='hidden' id='name' value='".$name."'>
                                <input name='currentlevel' type='hidden' id='currentlevel' value='".$currentlevel."'>
                          </p>
                          <p>
                                <input type='submit' name='Submit' value='Adopt Me'>
                        </p>
                        </form>";
                }
                else{
                        $article_title = $accden;
                        $article_content = $adoptnoper;
                } // End Can Adopt ELSE
        }
        else {
                //The adoptable does not exist, nothing we can do...
                $article_title = $err_idnoexist;
                $article_content = $err_idnoexist_text;
        } // End adoptable does not exist ELSE
} // This bracket ends the else statements for whether or not an ID was entered


//***************//
//  OUTPUT PAGE  //
//***************//

echo showpage($article_title, $article_content, $date);

?>

I only edited it to change some of the words.

I tried the table and it worked wonderfully!

I tried removing the theme, it worked fine, but once I logged out, I got this message!


Warning: file_get_contents(templates/elements/template.html) [function.file-get-contents]: failed to open stream: No such file or directory in /home/gloometh/public_html/inc/functions.php on line 819

I think this is because it kept thinking elements was the default theme - can I set it to simple through my file manager?

RoconzaArt 03-21-2011 10:00 AM

I think your have to go in to the batabase and edit it or at least that's what I had to do.

AlexC 03-21-2011 10:07 AM

which database area? I'm not good with phpadmin. D:

RoconzaArt 03-21-2011 10:39 AM

_settings


http://www.mysidiaadoptables.com/for...4&pictureid=71

AlexC 03-21-2011 10:41 AM

thank you very much, that fixed it! :D

Now I just need to figure out the pound page...

ChibiMaestro 03-21-2011 11:19 AM

I have no idea about the pound page but:

Quote:

EDIT: Fourth - I am having trouble when I do things like Rat's or something. It turns out Rat\'s. This is happening everywhere, can I stop it, or do I have to go back and edit everything? (don't think I can, I did some in the descriptions of rats...)
Where does it show that? o-o I fixed mine :)

What you do is put this code in:
Code:

$article_content = stripslashes($article_content);
E.g. place that code under
Code:

$article_content = bbconvert($article_content); // BBCODE conversion

$article_content = nl2br($article_content); // New line breaks

in pages.php, and then you may want to add that code to index.php & tos.php too :)

AlexC 03-21-2011 11:36 AM

alright, I shall try that.

It worked everywhere, as far as I can tell. ^.^ However, it's still showing up in the descriptions?

Stuff like "It\'s got a cute little black hood and cape, and it won\'t stop bouncing around either. How odd. Full name is Black Hooded Rat.". But the page is working fine?

ChibiMaestro 03-21-2011 12:07 PM

Put:
Code:

$description = stripslashes($description);
in adopt.php :)
I'm not sure it will work because I am just beginning to learn PHP :) so yeah xD

AlexC 03-21-2011 12:40 PM

erm.... where do I add that? xD I feel stupid.

ChibiMaestro 03-21-2011 01:16 PM

I actually have no idea o-o
But try placing it under:
Code:

                $description=$row['description'];
??? :el:

AlexC 03-21-2011 01:30 PM

yay, that worked, thank you!

ChibiMaestro 03-21-2011 01:38 PM

You're welcome :) *runs off to learn more PHP >:3 My first stage of learning is observing the Mys script :3*

AlexC 03-21-2011 01:40 PM

I'm learning a tiny bit by working with the script as well. xD Not enough though.

ChibiMaestro 03-21-2011 01:42 PM

D'aww, you'll soon get used to it :)
I remember when I first joined RA, I had no clue what PHP even was xD but once you observe and then begin to make small changes (like copying a section of a script & modifying it), then you'll get better xD I made my first fix to the Mys script yesterday (that was to the profile.php if you haven't got an avatar :3... I need to learn more though xD)

AlexC 03-21-2011 01:45 PM

I've been coding basic stuff for a while, but this is my first time with php. I've made some basic modifications, like rearranging the myadopts.php page and so on. I want to try making some codes for people and some mods myself, once I'm good enough. I like doing stuff like that.

ChibiMaestro 03-21-2011 02:47 PM

:3 Epic-sauce xD
I also want to make codes too >:3

Also, the pound glitch happens to me too, wait... I'm going to try something else...
EDIT: Okay, maybe not >.< I thought that maybe if you have 2 abandoned adoptables of the same type, it wouldn't show all of them, but if you had 2 different types of abandoned adoptables, then they'd show.. but nahhh :3

AlexC 03-21-2011 02:57 PM

The rats I had abandoned were of different types... D: The pound seemed to be working in the test thing I looked at....

oh, do you thinkyou could look at a gltich i'm having with the inventory script?

ChibiMaestro 03-21-2011 03:08 PM

Actually, on the demo site: http://www.mysidiaadoptables.com/mys120a/ the pound is exactly the same. I just test pounded 2 adoptables, and readopted them.

Also, I'll try check out the inventory :) *goes to test on my site*

AlexC 03-21-2011 03:11 PM

hmm, that's not good. D: Is that how it's suppose to be displayed then?

it keeps telling me it can't find the file on line 113.

ChibiMaestro 03-21-2011 03:24 PM

I think the inventory script was for 1.1.X and I think you're using 1.2.0
And the furthest editing I got for the inventory script was:
Code:

<?php

include("inc/functions.php");
include("inc/config.php");

//***************//
//  START SCRIPT //
//***************//

$themeurl = grabanysetting("themeurl");
$links = getlinks();
$ads = getads("any");
$pagecontent = getsitecontent("index");
$article_title = $pagecontent[title];
$article_content = $pagecontent[content];
$article_content = nl2br($article_content);

$article_title = "Your Inventory";

if ($isloggedin == "yes") {
$article_content = "Here you can see a list of items that you have collected.<table width='500' border='2'>
<tr>
    <td width='200'><strong>Picture:</strong></td>
    <td width='230'><strong>Item Type: </strong></td>
    <td width='70'><strong>ID Number:</strong></td>
</tr>";
 
$query = "SELECT * FROM ".$prefix."useritems WHERE Owner = '$loggedinname'";
$result = mysql_query($query);
$num = mysql_numrows($result);

$i=0;
while ($i < $num) {

$iid=@mysql_result($result,$i,"ID");
$object=@mysql_result($result,$i,"Item");
$url=@mysql_result($result,$i,"imageurl");


$article_content = $article_content."<tr>
    <td><center><img src='".$url."'></center></td>
    <td><center>".$object."</center></td>
    <td><center>".$iid."</center></td>
  </tr>";

unset($iid);
unset($object);

$i = $i + 1;
}
$article_content = $article_content."</table>";

}
else {

$article_content = "You must be logged in to view items.";

}
//***************//
//  OUTPUT PAGE  //
//***************//

echo showpage($article_title, $article_content, $date);

?>

I couldn't continue because I have no idea how to insert a new table, and it's required to insert a table which is:
Code:

id, int(11), not null, auto_increment
owner, varchar(40), latin1_general_ci, yes (NULL)       
itemtype, varchar(40), latin1_general_ci, yes (NULL)
imgurl, varchar(120), latin1_general_ci, yes (NULL)

But yeah :P

AlexC 03-21-2011 03:30 PM

i noticed that the person didn't actually say WHERE to add the tables, I know howto otherwise

http://ratties.x10.mx/inventory.php this was the result of adding the script. D: and yeah, I am using 2.0. Darn, I really wanted it to work. ;-; I've been promising items for ages.

ChibiMaestro 03-21-2011 03:38 PM

Gahhh, yes, TCK needs (well, it'd be epic if he did) to update the thread :P

So how do you actually ADD tables? o-o

AlexC 03-21-2011 03:43 PM

You go through to phpadmin or whatever, then you click whatever area you want to add it to. like, adoptables or something. then I clicked structure or something (one of the tabs along the top) and at the very bottom there was an option to another field. At least, I think that was what it was. It had all of the options that everyone wanted me to add, and it worked fine.

ChibiMaestro 03-21-2011 03:47 PM

Ohhh, I meant isn't there a way to kinda copy and paste the code? o-o

AlexC 03-21-2011 03:58 PM

I'm not sure. I'm rather hungry and thus confused at the moment, lol. Not a good place to be coding from.


All times are GMT -5. The time now is 02:35 PM.

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