Mysidia Adoptables Support Forum  

Home Community Mys-Script Creative Off-Topic
Go Back   Mysidia Adoptables Support Forum > Mysidia Adoptables > Addons and Modifications > Mys v1.3.x Mods

Notices

Reply
 
Thread Tools Display Modes
  #11  
Old 05-05-2012, 11:21 AM
StarGirl's Avatar
StarGirl StarGirl is offline
Member
 
Join Date: Feb 2012
Posts: 45
Gender: Female
Credits: 9,776
StarGirl is on a distinguished road
Default

Quote:
Originally Posted by Aasixx View Post
When you say "leave them in public_html" do you mean create a new file for each one? So, like for "creategroup" after I downloaded and opened it, it gave me this code:

Code:
<?php

include("functions/functions.php");
include("functions/functions_users.php");
include("functions/functions_adopts.php");
include("inc/lang.php");

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

$name = $_GET["name"];
$submit = $_GET["submit"];

if($isloggedin == "yes"){
if($submit == "Create"){
		$count = $GLOBALS['adopts']->select("pet_groups", array(), "user='{$loggedinname}'")->fetchAll();
		if(count($count) > 4) {
		$article_title = "Sorry";
		$article_content = "You have too many groups. <br><br>
		<a href='mygroups.php'>Go back to the group center</a>";
		}
		else{
		// Create group!
                $adopts->insert("pet_groups", array("id" => NULL, "user" => $loggedinname, "name" => $name));
                $group = $adopts->select("pet_groups", array(), "name='{$name}' and user='{$loggedinname}'")->fetchObject();	
                $id = $group->id;
        $article_title = "New Group!";
	$article_content = "You have just created a new group - {$name}!<br><br>
	<a href='groups.php?id={$id}'>Click here to see it.</a>";
		}
}
		else{
	$article_title = "";
	$article_content = "";
		}
} // End the log in check IF
else {
	$article_title = "Login";
	$article_content = "You must login to create a group.";
} // End the log in check ELSE 

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

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

?>
Would I need to create a new file and put that code in it for creategroup?
Well, you could create a creategroup.php in file manager and put that code in it, and repeat for each download. Or, just download each file here, and upload it to public_html.
Reply With Quote
  #12  
Old 05-05-2012, 11:35 AM
Aasixx's Avatar
Aasixx Aasixx is offline
.. your friendly geek. c:
 
Join Date: Nov 2011
Location: somewhere ur not.
Posts: 191
Gender: Female
Credits: 31,857
Aasixx is on a distinguished road
Default

I'll do the first one. XD Much more easier for my slow-processing brain. Thanks a ton, Star. :)

Um, this is what I get when I'm trying to view a group:
Fatal error: Call to a member function fetchObject() on a non-object in /home/albisian/public_html/adopts/groups.php on line 58

Do you think you might know the problem? :| It also takes me to your site (MyxiPlanet) when I click to view a group..

and now I'm getting this when I'm trying to go to myadopts.php:
Parse error: syntax error, unexpected T_ELSEIF in /home/albisian/public_html/adopts/myadopts.php on line 434
__________________

Last edited by Aasixx; 05-05-2012 at 11:44 AM.
Reply With Quote
  #13  
Old 05-05-2012, 11:58 AM
StarGirl's Avatar
StarGirl StarGirl is offline
Member
 
Join Date: Feb 2012
Posts: 45
Gender: Female
Credits: 9,776
StarGirl is on a distinguished road
Default

Quote:
Originally Posted by Aasixx View Post
I'll do the first one. XD Much more easier for my slow-processing brain. Thanks a ton, Star. :)

Um, this is what I get when I'm trying to view a group:
Fatal error: Call to a member function fetchObject() on a non-object in /home/albisian/public_html/adopts/groups.php on line 58

Do you think you might know the problem? :| It also takes me to your site (MyxiPlanet) when I click to view a group..

and now I'm getting this when I'm trying to go to myadopts.php:
Parse error: syntax error, unexpected T_ELSEIF in /home/albisian/public_html/adopts/myadopts.php on line 434
Oh, oops.. I forgot to take out the first bit which makes it lead to my site. -.- And can you post your myadopts.php? Maybe some if's got caught up or something. It works fine on my site.. And can you delete mygroups.php and do it again, because I've fixed the leading to my site.

Last edited by StarGirl; 05-05-2012 at 12:10 PM.
Reply With Quote
  #14  
Old 05-05-2012, 03:36 PM
Hall of Famer's Avatar
Hall of Famer Hall of Famer is offline
Administrator, Lead Coder
 
Join Date: Dec 2008
Location: South Brunswick
Posts: 4,448
Gender: Male
Credits: 486,989
Hall of Famer is on a distinguished road
Default

Well you can just download the attachment and upload them to your server through ftp, this way there is no need to create empty files and copy/paste the code.
__________________


Mysidia Adoptables, a free and ever-improving script for aspiring adoptables/pets site.
Reply With Quote
  #15  
Old 05-05-2012, 04:26 PM
StarGirl's Avatar
StarGirl StarGirl is offline
Member
 
Join Date: Feb 2012
Posts: 45
Gender: Female
Credits: 9,776
StarGirl is on a distinguished road
Default

Quote:
Originally Posted by Hall of Famer View Post
Well you can just download the attachment and upload them to your server through ftp, this way there is no need to create empty files and copy/paste the code.
Ah.. you see my terrible coding.. xP
Reply With Quote
  #16  
Old 05-05-2012, 09:10 PM
Aasixx's Avatar
Aasixx Aasixx is offline
.. your friendly geek. c:
 
Join Date: Nov 2011
Location: somewhere ur not.
Posts: 191
Gender: Female
Credits: 31,857
Aasixx is on a distinguished road
Default

Alright, here's myadopts.php
Code:
<?php

include("functions/functions.php");
include("functions/functions_users.php");
include("functions/functions_adopts.php");
include("css/pagination.css");
include("inc/lang.php");

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

$id = $_GET["id"];
$act = $_GET["act"];
$more = $_GET["more"];
$page = $_GET["page"];

if($isloggedin == "yes"){
	if($act == ""){
		$article_title = "Your Adoptables";
		// We need to get all of the user's adoptables from the database and display them...
 		$query = "SELECT * FROM ".constant("PREFIX")."owned_adoptables, 
								".constant("PREFIX")."adoptables, 
								".constant("PREFIX")."levels WHERE 	".constant("PREFIX")."owned_adoptables.owner = '{$loggedinname}' 
														AND ".constant("PREFIX")."adoptables.type = ".constant("PREFIX")."owned_adoptables.type 
														AND ".constant("PREFIX")."levels.thisislevel = ".constant("PREFIX")."owned_adoptables.currentlevel 
														AND ".constant("PREFIX")."levels.adoptiename = ".constant("PREFIX")."adoptables.type 
														ORDER BY ".constant("PREFIX")."owned_adoptables.totalclicks";
	    $rowsperpage = 10;
        $pagination = new Pagination($adopts, $query, $rowsperpage, "http://www.".constant("DOMAIN").constant("SCRIPTPATH")."/myadopts.php");
        $pagination->setPage($_GET[page]);
	    $query = "SELECT * FROM ".constant("PREFIX")."owned_adoptables, 
								".constant("PREFIX")."adoptables, 
								".constant("PREFIX")."levels WHERE 	".constant("PREFIX")."owned_adoptables.owner = '{$loggedinname}' 
														AND ".constant("PREFIX")."adoptables.type = ".constant("PREFIX")."owned_adoptables.type 
														AND ".constant("PREFIX")."levels.thisislevel = ".constant("PREFIX")."owned_adoptables.currentlevel 
														AND ".constant("PREFIX")."levels.adoptiename = ".constant("PREFIX")."adoptables.type 
														ORDER BY ".constant("PREFIX")."owned_adoptables.totalclicks LIMIT {$pagination->getLimit()},{$rowsperpage}";
		$stmt = $adopts->query($query);

		$article_content = "<table>
								<tr>
									<th></th><th>Name and Type</th><th>Image</th><th>Clicks</th>
								</tr>";

		while($row = $stmt->fetchObject()){
			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><center><img src='picuploads/{$row->gender}.png'></center></td>
									<td><center><em>{$row->name}</em> the {$row->type}</center></td>
									<td><center><a href='myadopts.php?act=manage&id={$row->aid}'><img src='{$image}'></a></center></td>
									<td><center>{$row->totalclicks}</center></td>
								</tr>";
		}
		$article_content .= "</table><br /><br />{$pagination->showPage()}</div>";
	}
	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...

			$row = $adopts->select("owned_adoptables", array(), "owner='{$loggedinname}' and aid='{$id}'")->fetchObject();	

			// 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=group&id={$id}'> Group {$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...

			$row = $adopts->select("owned_adoptables", array(), "owner='{$loggedinname}' and aid='{$id}'")->fetchObject();				
			if($row->aid == $id){
				// The adoptable exists, so we show the stats for it...

				$image = getcurrentimage($id);
				$nextlevelexists = getnextlevelexists($row->type, $row->currentlevel);

				// If a higher level exists, get that level's information...

				if($nextlevelexists == TRUE){
					$nextlevel = $row->currentlevel + 1;

					$levels = $adopts->select("levels", array(), "adoptiename='{$row->type}' and thisislevel='{$nextlevel}'")->fetchObject();	
					$requiredclicks= $levels->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

				$stmt = $adopts->select("vote_voters", array(), "adoptableid='{$id}' ORDER BY date DESC LIMIT 10");
				while($row = $stmt->fetchObject()) {
					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...

			$row = $adopts->select("owned_adoptables", array(), "owner='{$loggedinname}' and aid='{$id}'")->fetchObject();				
			if($row->aid == $id){
				$altbb = grabanysetting("usealtbbcode");

				// Adoptable exists, so show the BBCode:
				$article_title = "Codes for {$row->name}";
				$article_content = "{$lang_bbcode_explain}<br />
									<p><u>Forum Codes / BBCode: </u></p>
									<p>
										<textarea name='textarea' cols='50' rows='4'>
											
										</textarea>
									</p>";

				if($altbb == "yes"){
				
					// Use the seo friendly alternate bbcodes...
					$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'>
											
										</textarea>
									</p>";
				}				
				$article_content .= "<p><u>HTML Code</u>:</p>
									<p>
										<textarea name='textarea' cols='50' rows='4'>
											<a href=\"http://www.".constant("DOMAIN").constant("SCRIPTPATH")."/levelup.php?id={$row->aid}\" target=\"_blank\">
												<img src=\"http://www.".constant("DOMAIN").constant("SCRIPTPATH")."/siggy.php?id={$row->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...
	elseif($act == "rename"){
		// We are renaming an adoptable

		if(is_numeric($id)){
		
			// Now we see if the adoptable actually exists...
			$row = $adopts->select("owned_adoptables", array(), "owner='{$loggedinname}' and aid='{$id}'")->fetchObject();	

			if($row->aid == $id){
			
				$image = getcurrentimage($id);
				if($row->isfrozen != "yes"){
					if($more == ""){
						$article_title = "Rename {$row->name}";
						$article_content = "<img src='{$image}'><br />{$lang_rename}{$row->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, lets first check if the user is its original owner.
                        $row = $adopts->select("pounds", array(), "aid='{$id}'")->fetchObject();
	                    if(!empty($row->firstowner) and $loggedinname != $row->firstowner){
                            $article_title = "Cannot rename";
                            $article_content = "The site admin has specified that only original owners can rename their adoptables.";                     
                        }
                        else{						
					   	    $adopts->update("owned_adoptables", array("name" => $more), "aid='{$id}' and owner='{$loggedinname}'");
						    $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;
		}
	}
	elseif($act == "trade"){
		// We are setting the trade status for an adoptable...

		if(is_numeric($id)){
			// Now we see if the adoptable actually exists...

			$row = $adopts->select("owned_adoptables", array(), "owner='{$loggedinname}' and aid='{$id}'")->fetchObject();	
			if($row->aid == $id){
				$image = getcurrentimage($id); // Get the image for the adopt...

				if($more == ""){
					$article_title = "Setting trade status for {$row->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 />";
				}
				elseif($more == "confirm"){ 			
					$article_title = "Change trade status successfully";
					if($row->tradestatus == "fortrade"){
						$adopts->update("owned_adoptables", array("tradestatus" => 'notfortrade'), "aid='{$id}' and owner='{$loggedinname}'");
						$article_content = "The adoptable's trade status is now Not for Trade";
					}                
					elseif($row->tradestatus == "notfortrade"){
					    $adopts->update("owned_adoptables", array("tradestatus" => 'fortrade'), "aid='{$id}' and owner='{$loggedinname}'");
						$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;
		}
	}
	elseif($act == "freeze"){
		// We are freezing an adoptable here...

		if(is_numeric($id)){
			// Now we see if the adoptable actually exists...

			$row = $adopts->select("owned_adoptables", array(), "owner='{$loggedinname}' and aid='{$id}'")->fetchObject();	
			if($row->aid == $id){
			
				$image = getcurrentimage($id); // Get the image for the adopt...
				if($more == ""){
					if($row->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>{$row->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...

					if($more == "freeze"){
						$frz = "yes";
						$article_title = "{$row->name} Frozen Successfully";
					}
					elseif($more == "unfreeze"){
						$frz = "no";
						$article_title = "{$row->name} Unfrozen Successfully";
					}

					$adopts->update("owned_adoptables", array("isfrozen" => $frz), "aid='{$id}' and owner='{$loggedinname}'");
					$article_content = "Action Complete. You may now manage {$row->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;
		}
	}
	elseif($act == "pound"){
		if(is_numeric($id)){
		
			// Now we see if the adoptable actually exists...
			$row = $adopts->select("owned_adoptables", array(), "owner='{$loggedinname}' and aid='{$id}'")->fetchObject();	
			if($row->aid == $id){
				$image = getcurrentimage($id); // Get the image for the adopt...
				if($more == ""){
					$article_title = "Pound {$row->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 {$row->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 {$row->name}! <img src='templates/icons/yes.gif' border=0></a></b></center><br />";
				}
				elseif($more == "confirm"){
					// Validate the pet can be pounded
					$adopt = new Pound($row->aid, "pound");
                    if($adopt->settings->system->active == "no"){
   	                   $article_title = "Invalid Action";
		               $article_content = "The admin has turned off pound feature, please contact him/her for further explanation.";                    
                    }
                    elseif($adopt->validate() == TRUE){
	                   $adopt->dopound();
	                   $article_title = $lang_pound_title_complete;
		               $article_content = $adopt->message;
	                }
	                else{
	                   $article_title = "An error has occurred";
                       $article_content = $adopt->message;	 
	                }
				}
				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;
		}
	elseif($act == "group"){
            if(is_numeric($id)){
        
            // Now we see if the adoptable actually exists...
            $row = $adopts->select("owned_adoptables", array(), "owner='{$loggedinname}' and aid='{$id}'")->fetchObject();    
            $petname = $row->name;
            if($row->aid == $id){
$row = $adopts->select("owned_adoptables", array(), "owner='{$loggedinname}' and aid='{$id}'")->fetchObject();
        $article_title = "Group {$row->name}";
         if($row->group == 0){
        $article_content = "{$row->name} is not in a group. ";
         }
         else{
         $groupname = $row->group;
         $row = $adopts->select("pet_groups", array(), "user='{$loggedinname}' and id='{$groupname}'")->fetchObject();
         $groupname = $row->name;
         $article_content = "{$row->name} is in the group '{$groupname}'.";
         }
      $article_content .= "Select a group to move {$petname} into:<br><br>";
$stmt = $adopts->select("pet_groups", array(), "user='{$loggedinname}'");
while($row = $stmt->fetchObject()) {
  $groupid=$row->id;
  $name=$row->name;
  $code .= "<option value='{$groupid}'>{$name}</option>";
}

$article_content .= "  <form name='form' method='get' action='hatchery.php?'>
<input name='id' type='hidden' id='id' value='{$id}'>
<input name='act' type='hidden' id='act' value='changegroup'>
    <select name='group' id='group'>
      <option value='none' selected> </option>
    {$code}
    </select><br>
 <input type='submit' name='submit' value='Move'>
    </form>";
           }
     }
}
elseif($act == "changegroup"){
// Check if form was submitted
  if($submit == "Move"){
  // Check group exists
        $row = $adopts->select("pet_groups", array(), "user='{$loggedinname}' and id='{$group}'")->fetchObject();    
    if($row->id == $group and $row->user == $loggedinname){
    // Check if pet exists
        $row = $adopts->select("owned_adoptables", array(), "owner='{$loggedinname}' and aid='{$id}'")->fetchObject();    
        if($row->aid == $id){
        // Move it
         $adopts->update("owned_adoptables", array("group" => $group), "aid='{$id}' and owner='{$loggedinname}'");
            $article_title = "Moved {$row->name}";
                        $article_content = "{$row->name} was moved to a new group.<br><br>
                        <a href='groups.php?id={$group}'>Check out the new group</a>";
        }
        else{
        $article_title = "Invalid ID";
                $article_content = "This pet doesn't exist.";
        }
    }
    else{
    $article_title = "Invalid Group";
        $article_content = "This group doesn't exist.";
    }
  }
  else{
  $article_title = "";
  $article_content = "";
  }
}
    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);

?>
__________________
Reply With Quote
  #17  
Old 05-06-2012, 04:22 AM
StarGirl's Avatar
StarGirl StarGirl is offline
Member
 
Join Date: Feb 2012
Posts: 45
Gender: Female
Credits: 9,776
StarGirl is on a distinguished road
Default

Quote:
Originally Posted by Aasixx View Post
Alright, here's myadopts.php
Code:
<?php

include("functions/functions.php");
include("functions/functions_users.php");
include("functions/functions_adopts.php");
include("css/pagination.css");
include("inc/lang.php");

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

$id = $_GET["id"];
$act = $_GET["act"];
$more = $_GET["more"];
$page = $_GET["page"];

if($isloggedin == "yes"){
	if($act == ""){
		$article_title = "Your Adoptables";
		// We need to get all of the user's adoptables from the database and display them...
 		$query = "SELECT * FROM ".constant("PREFIX")."owned_adoptables, 
								".constant("PREFIX")."adoptables, 
								".constant("PREFIX")."levels WHERE 	".constant("PREFIX")."owned_adoptables.owner = '{$loggedinname}' 
														AND ".constant("PREFIX")."adoptables.type = ".constant("PREFIX")."owned_adoptables.type 
														AND ".constant("PREFIX")."levels.thisislevel = ".constant("PREFIX")."owned_adoptables.currentlevel 
														AND ".constant("PREFIX")."levels.adoptiename = ".constant("PREFIX")."adoptables.type 
														ORDER BY ".constant("PREFIX")."owned_adoptables.totalclicks";
	    $rowsperpage = 10;
        $pagination = new Pagination($adopts, $query, $rowsperpage, "http://www.".constant("DOMAIN").constant("SCRIPTPATH")."/myadopts.php");
        $pagination->setPage($_GET[page]);
	    $query = "SELECT * FROM ".constant("PREFIX")."owned_adoptables, 
								".constant("PREFIX")."adoptables, 
								".constant("PREFIX")."levels WHERE 	".constant("PREFIX")."owned_adoptables.owner = '{$loggedinname}' 
														AND ".constant("PREFIX")."adoptables.type = ".constant("PREFIX")."owned_adoptables.type 
														AND ".constant("PREFIX")."levels.thisislevel = ".constant("PREFIX")."owned_adoptables.currentlevel 
														AND ".constant("PREFIX")."levels.adoptiename = ".constant("PREFIX")."adoptables.type 
														ORDER BY ".constant("PREFIX")."owned_adoptables.totalclicks LIMIT {$pagination->getLimit()},{$rowsperpage}";
		$stmt = $adopts->query($query);

		$article_content = "<table>
								<tr>
									<th></th><th>Name and Type</th><th>Image</th><th>Clicks</th>
								</tr>";

		while($row = $stmt->fetchObject()){
			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><center><img src='picuploads/{$row->gender}.png'></center></td>
									<td><center><em>{$row->name}</em> the {$row->type}</center></td>
									<td><center><a href='myadopts.php?act=manage&id={$row->aid}'><img src='{$image}'></a></center></td>
									<td><center>{$row->totalclicks}</center></td>
								</tr>";
		}
		$article_content .= "</table><br /><br />{$pagination->showPage()}</div>";
	}
	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...

			$row = $adopts->select("owned_adoptables", array(), "owner='{$loggedinname}' and aid='{$id}'")->fetchObject();	

			// 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=group&id={$id}'> Group {$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...

			$row = $adopts->select("owned_adoptables", array(), "owner='{$loggedinname}' and aid='{$id}'")->fetchObject();				
			if($row->aid == $id){
				// The adoptable exists, so we show the stats for it...

				$image = getcurrentimage($id);
				$nextlevelexists = getnextlevelexists($row->type, $row->currentlevel);

				// If a higher level exists, get that level's information...

				if($nextlevelexists == TRUE){
					$nextlevel = $row->currentlevel + 1;

					$levels = $adopts->select("levels", array(), "adoptiename='{$row->type}' and thisislevel='{$nextlevel}'")->fetchObject();	
					$requiredclicks= $levels->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

				$stmt = $adopts->select("vote_voters", array(), "adoptableid='{$id}' ORDER BY date DESC LIMIT 10");
				while($row = $stmt->fetchObject()) {
					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...

			$row = $adopts->select("owned_adoptables", array(), "owner='{$loggedinname}' and aid='{$id}'")->fetchObject();				
			if($row->aid == $id){
				$altbb = grabanysetting("usealtbbcode");

				// Adoptable exists, so show the BBCode:
				$article_title = "Codes for {$row->name}";
				$article_content = "{$lang_bbcode_explain}<br />
									<p><u>Forum Codes / BBCode: </u></p>
									<p>
										<textarea name='textarea' cols='50' rows='4'>
											
										</textarea>
									</p>";

				if($altbb == "yes"){
				
					// Use the seo friendly alternate bbcodes...
					$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'>
											
										</textarea>
									</p>";
				}				
				$article_content .= "<p><u>HTML Code</u>:</p>
									<p>
										<textarea name='textarea' cols='50' rows='4'>
											<a href=\"http://www.".constant("DOMAIN").constant("SCRIPTPATH")."/levelup.php?id={$row->aid}\" target=\"_blank\">
												<img src=\"http://www.".constant("DOMAIN").constant("SCRIPTPATH")."/siggy.php?id={$row->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...
	elseif($act == "rename"){
		// We are renaming an adoptable

		if(is_numeric($id)){
		
			// Now we see if the adoptable actually exists...
			$row = $adopts->select("owned_adoptables", array(), "owner='{$loggedinname}' and aid='{$id}'")->fetchObject();	

			if($row->aid == $id){
			
				$image = getcurrentimage($id);
				if($row->isfrozen != "yes"){
					if($more == ""){
						$article_title = "Rename {$row->name}";
						$article_content = "<img src='{$image}'><br />{$lang_rename}{$row->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, lets first check if the user is its original owner.
                        $row = $adopts->select("pounds", array(), "aid='{$id}'")->fetchObject();
	                    if(!empty($row->firstowner) and $loggedinname != $row->firstowner){
                            $article_title = "Cannot rename";
                            $article_content = "The site admin has specified that only original owners can rename their adoptables.";                     
                        }
                        else{						
					   	    $adopts->update("owned_adoptables", array("name" => $more), "aid='{$id}' and owner='{$loggedinname}'");
						    $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;
		}
	}
	elseif($act == "trade"){
		// We are setting the trade status for an adoptable...

		if(is_numeric($id)){
			// Now we see if the adoptable actually exists...

			$row = $adopts->select("owned_adoptables", array(), "owner='{$loggedinname}' and aid='{$id}'")->fetchObject();	
			if($row->aid == $id){
				$image = getcurrentimage($id); // Get the image for the adopt...

				if($more == ""){
					$article_title = "Setting trade status for {$row->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 />";
				}
				elseif($more == "confirm"){ 			
					$article_title = "Change trade status successfully";
					if($row->tradestatus == "fortrade"){
						$adopts->update("owned_adoptables", array("tradestatus" => 'notfortrade'), "aid='{$id}' and owner='{$loggedinname}'");
						$article_content = "The adoptable's trade status is now Not for Trade";
					}                
					elseif($row->tradestatus == "notfortrade"){
					    $adopts->update("owned_adoptables", array("tradestatus" => 'fortrade'), "aid='{$id}' and owner='{$loggedinname}'");
						$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;
		}
	}
	elseif($act == "freeze"){
		// We are freezing an adoptable here...

		if(is_numeric($id)){
			// Now we see if the adoptable actually exists...

			$row = $adopts->select("owned_adoptables", array(), "owner='{$loggedinname}' and aid='{$id}'")->fetchObject();	
			if($row->aid == $id){
			
				$image = getcurrentimage($id); // Get the image for the adopt...
				if($more == ""){
					if($row->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>{$row->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...

					if($more == "freeze"){
						$frz = "yes";
						$article_title = "{$row->name} Frozen Successfully";
					}
					elseif($more == "unfreeze"){
						$frz = "no";
						$article_title = "{$row->name} Unfrozen Successfully";
					}

					$adopts->update("owned_adoptables", array("isfrozen" => $frz), "aid='{$id}' and owner='{$loggedinname}'");
					$article_content = "Action Complete. You may now manage {$row->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;
		}
	}
	elseif($act == "pound"){
		if(is_numeric($id)){
		
			// Now we see if the adoptable actually exists...
			$row = $adopts->select("owned_adoptables", array(), "owner='{$loggedinname}' and aid='{$id}'")->fetchObject();	
			if($row->aid == $id){
				$image = getcurrentimage($id); // Get the image for the adopt...
				if($more == ""){
					$article_title = "Pound {$row->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 {$row->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 {$row->name}! <img src='templates/icons/yes.gif' border=0></a></b></center><br />";
				}
				elseif($more == "confirm"){
					// Validate the pet can be pounded
					$adopt = new Pound($row->aid, "pound");
                    if($adopt->settings->system->active == "no"){
   	                   $article_title = "Invalid Action";
		               $article_content = "The admin has turned off pound feature, please contact him/her for further explanation.";                    
                    }
                    elseif($adopt->validate() == TRUE){
	                   $adopt->dopound();
	                   $article_title = $lang_pound_title_complete;
		               $article_content = $adopt->message;
	                }
	                else{
	                   $article_title = "An error has occurred";
                       $article_content = $adopt->message;	 
	                }
				}
				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;
		}
	elseif($act == "group"){
            if(is_numeric($id)){
        
            // Now we see if the adoptable actually exists...
            $row = $adopts->select("owned_adoptables", array(), "owner='{$loggedinname}' and aid='{$id}'")->fetchObject();    
            $petname = $row->name;
            if($row->aid == $id){
$row = $adopts->select("owned_adoptables", array(), "owner='{$loggedinname}' and aid='{$id}'")->fetchObject();
        $article_title = "Group {$row->name}";
         if($row->group == 0){
        $article_content = "{$row->name} is not in a group. ";
         }
         else{
         $groupname = $row->group;
         $row = $adopts->select("pet_groups", array(), "user='{$loggedinname}' and id='{$groupname}'")->fetchObject();
         $groupname = $row->name;
         $article_content = "{$row->name} is in the group '{$groupname}'.";
         }
      $article_content .= "Select a group to move {$petname} into:<br><br>";
$stmt = $adopts->select("pet_groups", array(), "user='{$loggedinname}'");
while($row = $stmt->fetchObject()) {
  $groupid=$row->id;
  $name=$row->name;
  $code .= "<option value='{$groupid}'>{$name}</option>";
}

$article_content .= "  <form name='form' method='get' action='hatchery.php?'>
<input name='id' type='hidden' id='id' value='{$id}'>
<input name='act' type='hidden' id='act' value='changegroup'>
    <select name='group' id='group'>
      <option value='none' selected> </option>
    {$code}
    </select><br>
 <input type='submit' name='submit' value='Move'>
    </form>";
           }
     }
}
elseif($act == "changegroup"){
// Check if form was submitted
  if($submit == "Move"){
  // Check group exists
        $row = $adopts->select("pet_groups", array(), "user='{$loggedinname}' and id='{$group}'")->fetchObject();    
    if($row->id == $group and $row->user == $loggedinname){
    // Check if pet exists
        $row = $adopts->select("owned_adoptables", array(), "owner='{$loggedinname}' and aid='{$id}'")->fetchObject();    
        if($row->aid == $id){
        // Move it
         $adopts->update("owned_adoptables", array("group" => $group), "aid='{$id}' and owner='{$loggedinname}'");
            $article_title = "Moved {$row->name}";
                        $article_content = "{$row->name} was moved to a new group.<br><br>
                        <a href='groups.php?id={$group}'>Check out the new group</a>";
        }
        else{
        $article_title = "Invalid ID";
                $article_content = "This pet doesn't exist.";
        }
    }
    else{
    $article_title = "Invalid Group";
        $article_content = "This group doesn't exist.";
    }
  }
  else{
  $article_title = "";
  $article_content = "";
  }
}
    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);

?>
Yeah, the if's got caught up somewhere. Try replacing it all with:
PHP Code:
<?php

include("functions/functions.php");
include(
"functions/functions_users.php");
include(
"functions/functions_adopts.php");
include(
"css/pagination.css");
include(
"inc/lang.php");

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

$id $_GET["id"];
$act $_GET["act"];
$more $_GET["more"];
$page $_GET["page"];

if(
$isloggedin == "yes"){
    if(
$act == ""){
        
$article_title "Your Adoptables";
        
// We need to get all of the user's adoptables from the database and display them...
         
$query "SELECT * FROM ".constant("PREFIX")."owned_adoptables, 
                                "
.constant("PREFIX")."adoptables, 
                                "
.constant("PREFIX")."levels WHERE     ".constant("PREFIX")."owned_adoptables.owner = '{$loggedinname}
                                                        AND "
.constant("PREFIX")."adoptables.type = ".constant("PREFIX")."owned_adoptables.type 
                                                        AND "
.constant("PREFIX")."levels.thisislevel = ".constant("PREFIX")."owned_adoptables.currentlevel 
                                                        AND "
.constant("PREFIX")."levels.adoptiename = ".constant("PREFIX")."adoptables.type 
                                                        ORDER BY "
.constant("PREFIX")."owned_adoptables.totalclicks";
        
$rowsperpage 10;
        
$pagination = new Pagination($adopts$query$rowsperpage"http://www.".constant("DOMAIN").constant("SCRIPTPATH")."/myadopts.php");
        
$pagination->setPage($_GET[page]);
        
$query "SELECT * FROM ".constant("PREFIX")."owned_adoptables, 
                                "
.constant("PREFIX")."adoptables, 
                                "
.constant("PREFIX")."levels WHERE     ".constant("PREFIX")."owned_adoptables.owner = '{$loggedinname}
                                                        AND "
.constant("PREFIX")."adoptables.type = ".constant("PREFIX")."owned_adoptables.type 
                                                        AND "
.constant("PREFIX")."levels.thisislevel = ".constant("PREFIX")."owned_adoptables.currentlevel 
                                                        AND "
.constant("PREFIX")."levels.adoptiename = ".constant("PREFIX")."adoptables.type 
                                                        ORDER BY "
.constant("PREFIX")."owned_adoptables.totalclicks LIMIT {$pagination->getLimit()},{$rowsperpage}";
        
$stmt $adopts->query($query);

        
$article_content "<table>
                                <tr>
                                    <th></th><th>Name and Type</th><th>Image</th><th>Clicks</th>
                                </tr>"
;

        while(
$row $stmt->fetchObject()){
            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><center><img src='picuploads/
{$row->gender}.png'></center></td>
                                    <td><center><em>
{$row->name}</em> the {$row->type}</center></td>
                                    <td><center><a href='myadopts.php?act=manage&id=
{$row->aid}'><img src='{$image}'></a></center></td>
                                    <td><center>
{$row->totalclicks}</center></td>
                                </tr>"
;
        }
        
$article_content .= "</table><br /><br />{$pagination->showPage()}</div>";
    }
    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...

            
$row $adopts->select("owned_adoptables", array(), "owner='{$loggedinname}' and aid='{$id}'")->fetchObject();    

            
// 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=group&id=
{$id}'> Group {$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...

            
$row $adopts->select("owned_adoptables", array(), "owner='{$loggedinname}' and aid='{$id}'")->fetchObject();                
            if(
$row->aid == $id){
                
// The adoptable exists, so we show the stats for it...

                
$image getcurrentimage($id);
                
$nextlevelexists getnextlevelexists($row->type$row->currentlevel);

                
// If a higher level exists, get that level's information...

                
if($nextlevelexists == TRUE){
                    
$nextlevel $row->currentlevel 1;

                    
$levels $adopts->select("levels", array(), "adoptiename='{$row->type}' and thisislevel='{$nextlevel}'")->fetchObject();    
                    
$requiredclicks$levels->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

                
$stmt $adopts->select("vote_voters", array(), "adoptableid='{$id}' ORDER BY date DESC LIMIT 10");
                while(
$row $stmt->fetchObject()) {
                    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...

            
$row $adopts->select("owned_adoptables", array(), "owner='{$loggedinname}' and aid='{$id}'")->fetchObject();                
            if(
$row->aid == $id){
                
$altbb grabanysetting("usealtbbcode");

                
// Adoptable exists, so show the BBCode:
                
$article_title "Codes for {$row->name}";
                
$article_content "{$lang_bbcode_explain}<br />
                                    <p><u>Forum Codes / BBCode: </u></p>
                                    <p>
                                        <textarea name='textarea' cols='50' rows='4'>
                                            
                                        </textarea>
                                    </p>"
;

                if(
$altbb == "yes"){
                
                    
// Use the seo friendly alternate bbcodes...
                    
$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'>
                                            
                                        </textarea>
                                    </p>"
;
                }                
                
$article_content .= "<p><u>HTML Code</u>:</p>
                                    <p>
                                        <textarea name='textarea' cols='50' rows='4'>
                                            <a href=\"http://www."
.constant("DOMAIN").constant("SCRIPTPATH")."/levelup.php?id={$row->aid}\" target=\"_blank\">
                                                <img src=\"http://www."
.constant("DOMAIN").constant("SCRIPTPATH")."/siggy.php?id={$row->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...
    
elseif($act == "rename"){
        
// We are renaming an adoptable

        
if(is_numeric($id)){
        
            
// Now we see if the adoptable actually exists...
            
$row $adopts->select("owned_adoptables", array(), "owner='{$loggedinname}' and aid='{$id}'")->fetchObject();    

            if(
$row->aid == $id){
            
                
$image getcurrentimage($id);
                if(
$row->isfrozen != "yes"){
                    if(
$more == ""){
                        
$article_title "Rename {$row->name}";
                        
$article_content "<img src='{$image}'><br />{$lang_rename}{$row->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, lets first check if the user is its original owner.
                        
$row $adopts->select("pounds", array(), "aid='{$id}'")->fetchObject();
                        if(!empty(
$row->firstowner) and $loggedinname != $row->firstowner){
                            
$article_title "Cannot rename";
                            
$article_content "The site admin has specified that only original owners can rename their adoptables.";                     
                        }
                        else{                        
                               
$adopts->update("owned_adoptables", array("name" => $more), "aid='{$id}' and owner='{$loggedinname}'");
                            
$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;
        }
    }
    elseif(
$act == "trade"){
        
// We are setting the trade status for an adoptable...

        
if(is_numeric($id)){
            
// Now we see if the adoptable actually exists...

            
$row $adopts->select("owned_adoptables", array(), "owner='{$loggedinname}' and aid='{$id}'")->fetchObject();    
            if(
$row->aid == $id){
                
$image getcurrentimage($id); // Get the image for the adopt...

                
if($more == ""){
                    
$article_title "Setting trade status for {$row->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 />"
;
                }
                elseif(
$more == "confirm"){             
                    
$article_title "Change trade status successfully";
                    if(
$row->tradestatus == "fortrade"){
                        
$adopts->update("owned_adoptables", array("tradestatus" => 'notfortrade'), "aid='{$id}' and owner='{$loggedinname}'");
                        
$article_content "The adoptable's trade status is now Not for Trade";
                    }                
                    elseif(
$row->tradestatus == "notfortrade"){
                        
$adopts->update("owned_adoptables", array("tradestatus" => 'fortrade'), "aid='{$id}' and owner='{$loggedinname}'");
                        
$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;
        }
    }
    elseif(
$act == "freeze"){
        
// We are freezing an adoptable here...

        
if(is_numeric($id)){
            
// Now we see if the adoptable actually exists...

            
$row $adopts->select("owned_adoptables", array(), "owner='{$loggedinname}' and aid='{$id}'")->fetchObject();    
            if(
$row->aid == $id){
            
                
$image getcurrentimage($id); // Get the image for the adopt...
                
if($more == ""){
                    if(
$row->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>{$row->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...

                    
if($more == "freeze"){
                        
$frz "yes";
                        
$article_title "{$row->name} Frozen Successfully";
                    }
                    elseif(
$more == "unfreeze"){
                        
$frz "no";
                        
$article_title "{$row->name} Unfrozen Successfully";
                    }

                    
$adopts->update("owned_adoptables", array("isfrozen" => $frz), "aid='{$id}' and owner='{$loggedinname}'");
                    
$article_content "Action Complete. You may now manage {$row->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;
        }
    }
    elseif(
$act == "pound"){
        if(
is_numeric($id)){
        
            
// Now we see if the adoptable actually exists...
            
$row $adopts->select("owned_adoptables", array(), "owner='{$loggedinname}' and aid='{$id}'")->fetchObject();    
            if(
$row->aid == $id){
                
$image getcurrentimage($id); // Get the image for the adopt...
                
if($more == ""){
                    
$article_title "Pound {$row->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 
{$row->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 
{$row->name}! <img src='templates/icons/yes.gif' border=0></a></b></center><br />";
                }
                elseif(
$more == "confirm"){
                    
// Validate the pet can be pounded
                    
$adopt = new Pound($row->aid"pound");
                    if(
$adopt->settings->system->active == "no"){
                          
$article_title "Invalid Action";
                       
$article_content "The admin has turned off pound feature, please contact him/her for further explanation.";                    
                    }
                    elseif(
$adopt->validate() == TRUE){
                       
$adopt->dopound();
                       
$article_title $lang_pound_title_complete;
                       
$article_content $adopt->message;
                    }
                    else{
                       
$article_title "An error has occurred";
                       
$article_content $adopt->message;     
                    }
                }
                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;
        }
        }
    elseif(
$act == "group"){
            if(
is_numeric($id)){
        
            
// Now we see if the adoptable actually exists...
            
$row $adopts->select("owned_adoptables", array(), "owner='{$loggedinname}' and aid='{$id}'")->fetchObject();    
            
$petname $row->name;
            if(
$row->aid == $id){
$row $adopts->select("owned_adoptables", array(), "owner='{$loggedinname}' and aid='{$id}'")->fetchObject();
        
$article_title "Group {$row->name}";
         if(
$row->group == 0){
        
$article_content "{$row->name} is not in a group. ";
         }
         else{
         
$groupname $row->group;
         
$row $adopts->select("pet_groups", array(), "user='{$loggedinname}' and id='{$groupname}'")->fetchObject();
         
$groupname $row->name;
         
$article_content "{$row->name} is in the group '{$groupname}'.";
         }
      
$article_content .= "Select a group to move {$petname} into:<br><br>";
$stmt $adopts->select("pet_groups", array(), "user='{$loggedinname}'");
while(
$row $stmt->fetchObject()) {
  
$groupid=$row->id;
  
$name=$row->name;
  
$code .= "<option value='{$groupid}'>{$name}</option>";
}

$article_content .= "  <form name='form' method='get' action='hatchery.php?'>
<input name='id' type='hidden' id='id' value='
{$id}'>
<input name='act' type='hidden' id='act' value='changegroup'>
    <select name='group' id='group'>
      <option value='none' selected> </option>
    
{$code}
    </select><br>
 <input type='submit' name='submit' value='Move'>
    </form>"
;
           }
     }
}
elseif(
$act == "changegroup"){
// Check if form was submitted
  
if($submit == "Move"){
  
// Check group exists
        
$row $adopts->select("pet_groups", array(), "user='{$loggedinname}' and id='{$group}'")->fetchObject();    
    if(
$row->id == $group and $row->user == $loggedinname){
    
// Check if pet exists
        
$row $adopts->select("owned_adoptables", array(), "owner='{$loggedinname}' and aid='{$id}'")->fetchObject();    
        if(
$row->aid == $id){
        
// Move it
         
$adopts->update("owned_adoptables", array("group" => $group), "aid='{$id}' and owner='{$loggedinname}'");
            
$article_title "Moved {$row->name}";
                        
$article_content "{$row->name} was moved to a new group.<br><br>
                        <a href='groups.php?id=
{$group}'>Check out the new group</a>";
        }
        else{
        
$article_title "Invalid ID";
                
$article_content "This pet doesn't exist.";
        }
    }
    else{
    
$article_title "Invalid Group";
        
$article_content "This group doesn't exist.";
    }
  }
  else{
  
$article_title "";
  
$article_content "";
  }
}
    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);

?>
And can you also re-download groups.php, there's something I put in that made it so that only you can see your own groups and nobody else. Sorry ^^
Reply With Quote
  #18  
Old 05-07-2012, 02:42 AM
Hall of Famer's Avatar
Hall of Famer Hall of Famer is offline
Administrator, Lead Coder
 
Join Date: Dec 2008
Location: South Brunswick
Posts: 4,448
Gender: Male
Credits: 486,989
Hall of Famer is on a distinguished road
Default

Quote:
Originally Posted by StarGirl View Post
Ah.. you see my terrible coding.. xP
Well I wasnt really referring to your script. I was just saying that users may as well download the attachment you provided and it would make things much easier. Of course it wont work for those with highly customized sites.
__________________


Mysidia Adoptables, a free and ever-improving script for aspiring adoptables/pets site.
Reply With Quote
  #19  
Old 05-07-2012, 11:21 PM
kristhasirah's Avatar
kristhasirah kristhasirah is offline
Member
 
Join Date: Jan 2010
Location: In middle of the nothingness
Posts: 196
Gender: Female
Credits: 32,749
kristhasirah
Default

Hi, just installed the mod.... but it show me an error page.... and redirects me to a Hatchery page??
__________________
Reply With Quote
  #20  
Old 05-07-2012, 11:41 PM
Aasixx's Avatar
Aasixx Aasixx is offline
.. your friendly geek. c:
 
Join Date: Nov 2011
Location: somewhere ur not.
Posts: 191
Gender: Female
Credits: 31,857
Aasixx is on a distinguished road
Default

Kris: You're probably getting an error because this mod is for Mys 1.3 and your site is currently using Mys 1.2.4. That's my thought, though. :T
__________________
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
What age group do you belong to? Hall of Famer Other Chat 19 09-28-2017 09:37 AM
1.3.4 - group sort draugluin Questions and Supports 6 01-16-2017 01:02 PM
sort adoptables Blackmagic Questions and Supports 3 12-01-2009 04:05 PM
group zhiichiro Questions and Supports 7 05-30-2009 08:21 PM
Adding new user group mugwumpr Questions and Supports 2 04-19-2009 08:02 PM


All times are GMT -5. The time now is 02:19 AM.

Currently Active Users: 795 (0 members and 795 guests)
Threads: 4,081, Posts: 32,029, Members: 2,016
Welcome to our newest members, jolob.
BETA





What's New?

What's Hot?

What's Popular?


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
vBCommerce I v2.0.0 Gold ©2010, PixelFX Studios
vBCredits I v2.0.0 Gold ©2010, PixelFX Studios
Emoticons by darkmoon3636