Mysidia Adoptables Support Forum  

Home Community Mys-Script Creative Off-Topic
Go Back   Mysidia Adoptables Support Forum > Mysidia Adoptables > Questions and Supports

Notices

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #16  
Old 09-17-2011, 06:44 PM
AlexC's Avatar
AlexC AlexC is offline
Moderator
 
Join Date: Dec 2009
Location: Canada
Posts: 753
Gender: Unknown/Other
Credits: 97,105
AlexC is an unknown quantity at this point
Default

Code:
<?php

include("inc/functions.php");

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

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

if($isloggedin == "yes")
{
	if($act == "")
	{
		$article_title = "Your Adoptables";
		$article_content = "<table>
								<tr>
									<th></th><th>Name and Type</th><th>Image</th><th>Clicks</th>
								</tr>";
		// We need to get all of the user's adoptables from the database and display them...
		$query = "SELECT * FROM {$prefix}owned_adoptables, 
								{$prefix}adoptables, 
								{$prefix}levels WHERE 	{$prefix}owned_adoptables.owner = '{$loggedinname}' 
														AND {$prefix}adoptables.type = {$prefix}owned_adoptables.type 
														AND {$prefix}levels.thisislevel = {$prefix}owned_adoptables.currentlevel 
														AND {$prefix}levels.adoptiename = {$prefix}adoptables.type 
														ORDER BY {$prefix}owned_adoptables.totalclicks";
		$result = runquery($query);

		while($row = mysql_fetch_array($result)) 
		{
			if($row['usealternates'] =='yes')
			{ 
				$image = $row['alternateimage']; 
			}
			else
			{ 
				$image = $row['primaryimage']; 
			}
			if($row['currentlevel'] == 0)
			{ 
				$image = $row['eggimage']; 
			}
			if($image=='')
			{ 
				$image = $row['primaryimage']; 
			}
			$article_content .= "<tr>
									<td><img src='picuploads/{$row['gender']}.png'></td>
									<td><em>{$row['name']}</em> the {$row['type']}</td>
									<td><a href='myadopts.php?act=manage&id={$row['aid']}'><img src='{$image}'></a></td>
									<td>{$row['totalclicks']}</td>
								</tr>";
		}
		$article_content .= "</table>";
	}
	elseif($act == "manage")
	{
		// We are managing a specific adoptable
		
		if(!is_numeric($id))
		{
			$article_title = $err_idnoexist;
			$article_content = $err_idnoexist_text;
		}
		else
		{
			// See if the adoptable actually exists...

			$query = "SELECT * FROM {$prefix}owned_adoptables WHERE owner='{$loggedinname}' and aid='{$id}'";
			$result = runquery($query);
			$row = mysql_fetch_array($result);

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

			if($row['aid'] == $id)
			{
				// The adoptable does exist, so we show the image and junk to the user...

				$image = getcurrentimage($id);

				$article_title = "Managing {$row['name']}";
				$article_content = "<img src='{$image}'><br /><br />This page allows you to manage {$row['name']}.  Click on an option below to change settings.<br /><br />
									<b><a href='levelup.php?id={$id}'><img src='templates/icons/add.gif' border=0> Level Up {$row['name']}</a><br />
									<a href='myadopts.php?act=stats&id={$id}'><img src='templates/icons/stats.gif' border=0> Get Stats for {$row['name']}</a><br />
									<a href='myadopts.php?act=bbcode&id={$id}'><img src='templates/icons/bbcodes.gif' border=0> Get BBCodes / HTML Codes for {$row['name']}</a><br />
									<a href='myadopts.php?act=rename&id={$id}'><img src='templates/icons/title.gif' border=0> Rename {$row['name']}</a><br />
									<a href='myadopts.php?act=trade&id={$id}'><img src='templates/icons/trade.gif' border=0> Change Trade Status {$row['name']}</a><br />
									<a href='myadopts.php?act=freeze&id={$id}'><img src='templates/icons/freeze.gif' border=0> Freeze or Unfreeze {$row['name']}</a><br />
									<a href='myadopts.php?act=pound&id={$id}'><img src='templates/icons/delete.gif' border=0> Pound {$row['name']}</a></b>";
			}
			else
			{
				$article_title = $err_idnoexist;
				$article_content = $err_idnoexist_text;
			}
		}
	} // End the MANAGE action code
	elseif($act == "stats")
	{
		// We are getting the stats for the adoptable
		// Check that an ID was submitted...
		if(is_numeric($id))
		{
			// Now we see if the adoptable actually exists...

			$query = "SELECT * FROM {$prefix}owned_adoptables WHERE owner='{$loggedinname}' and aid='{$id}'";
			$result = runquery($query);
			$row = mysql_fetch_array($result);
			
			if($row['aid'] == $id)
			{
				// The adoptable exists, so we show the stats for it...

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

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

				if($nextlevelexists == "true")
				{
					$nextlevel = $currentlevel + 1;

					$query = "SELECT * FROM {$prefix}levels WHERE adoptiename='{$type}' and thisislevel='{$nextlevel}'";
					$result = runquery($query);
					$requiredclicks=@mysql_result($result,0,"requiredclicks"); //The adoptable's ID

				} // End grab next level info...

				// Determine what to show for next level:

				if($nextlevelexists == "true" and $nextlevel != "")
				{
					// See how many more clicks to go

					$ctg = $requiredclicks - $row['totalclicks'];

					$nloutput = "{$nextlevel}<br />Clicks Required for Level Increase: {$ctg}";
				}
				else
				{
					$nloutput = "This adoptable is at its maximum level";
				}

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

				// Voters Information...

				$article_content .= "<h2>{$row['name']}'s Voters:</h2><br />
									{$lang_voters_explain}<br /><br />
									<table width='450' border='1'>
										<tr>
											<td width='129'><strong>Username:</strong></td>
											<td width='156'><strong>Date Voted: </strong></td>
											<td width='82'><strong>Profile:</strong></td>
											<td width='55'><strong>PM:</strong></td>
										</tr>";

				// Select the voters from the DB

				$query = "SELECT * FROM {$prefix}vote_voters WHERE adoptableid='{$id}' ORDER BY date DESC LIMIT 10";
				$result = runquery($query);

				while ($row = mysql_fetch_array($result)) 
				{
					if($row['username'] == "")
					{

						$row['username'] = "Guest";

					}
					if($row['username'] == "Guest")
					{
						$article_content .= "
										<tr>
											<td><div align='left'>Guest</div></td>
											<td><div align='left'>{$row['date']}</div></td>
											<td><div align='center'></div></td>
											<td><div align='center'></div></td>
										</tr>";
					}
					else
					{
						$article_content .= "
										<tr>
											<td><div align='left'>{$row['username']}</div></td>
											<td><div align='left'>{$row['date']}</div></td>
											<td><div align='center'><a href='profile.php?user={$row['username']}' target='_blank'><img src='templates/buttons/profile.gif' border=0></a></div></td>
											<td><div align='center'><a href='messages.php?act=newpm&user={$row['username']}' target='_blank'><img src='templates/buttons/pm.gif' border=0></a></div></td>
										</tr>";
					}
				}
				$article_content .= "</table><br />";
			}
			else
			{
				$article_title = $err_idnoexist;
				$article_content = $err_idnoexist_text;
			}
		}
		else
		{
			$article_title = $err_idnoexist;
			$article_content = $err_idnoexist_text;
		}
	} // End the STATS code
	elseif($act == "bbcode")
	{
		if(is_numeric($id))
		{
			// Now we see if the adoptable actually exists...

			$query = "SELECT * FROM {$prefix}owned_adoptables WHERE owner='{$loggedinname}' and aid='{$id}'";
			$result = runquery($query);
			$row = mysql_fetch_array($result);
			
			if($row['aid'] == $id)
			{
				$altbb = grabanysetting("usealtbbcode");

				// Adoptable exists, so show the BBCode:

				$article_title = "Codes for {$name}";
				$article_content = "{$lang_bbcode_explain}<br />
									<p><u>Forum Codes / BBCode: </u></p>
									<p>
										<textarea name='textarea' cols='50' rows='4'>
											}]
										</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.{$domain}{$scriptpath}/levelup.php?id={$row['aid']}\" target=\"_blank\">
												<img src=\"http://www.{$domain}{$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...

			$query = "SELECT * FROM {$prefix}owned_adoptables WHERE owner='{$loggedinname}' and aid='{$id}'";
			$result = runquery($query);
			$row = mysql_fetch_array($result);

			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

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

	}
	elseif($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);
			$row = mysql_fetch_array($result);

			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")
					{
						$query = "UPDATE {$prefix}owned_adoptables SET tradestatus='notfortrade' WHERE aid='{$id}' and owner='{$loggedinname}'";
						runquery($query);
						$article_content = "The adoptable's trade status is now Not for Trade";
					}                
					elseif($row['tradestatus'] == "notfortrade")
					{
						$query = "UPDATE {$prefix}owned_adoptables SET tradestatus='fortrade' WHERE aid='{$id}' and owner='{$loggedinname}'";
						runquery($query);
						$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...

			$query = "SELECT * FROM {$prefix}owned_adoptables WHERE owner='{$loggedinname}' and aid='{$id}'";
			$result = runquery($query);
			$row = mysql_fetch_array($result);

			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";
					}

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

					$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...

			$query = "SELECT * FROM {$prefix}owned_adoptables WHERE owner='$loggedinname' and aid='$id'";
			$result = runquery($query);
			$row = mysql_fetch_array($result);

			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 {$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 />";
				}
				elseif($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);

?>
myadopts.php~ sorry if I'm a little slow to reply, I'm watching Star Trek, doing my homework and working on a list for the help page on the site.
__________________
Reply With Quote
 

Thread Tools
Display Modes

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
Help Making Stats Page = Click Page & Lineages? squiggler Questions and Supports 2 02-22-2014 04:42 AM
Adopt Page & Pound Page change? tahbikat Questions and Supports 3 02-14-2014 03:19 PM
pets dradar Questions and Supports 5 08-06-2010 05:48 PM
Page that will display a user's pets (non layout destroying update) kisazeky Addons/Mods Graveyard 12 11-05-2009 08:27 PM
I don't see my pets...help sdsmith64 Questions and Supports 8 07-27-2009 06:03 PM


All times are GMT -5. The time now is 06:07 PM.

Currently Active Users: 9271 (0 members and 9271 guests)
Threads: 4,081, Posts: 32,032, 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 - 2025, vBulletin Solutions Inc.
vBCommerce I v2.0.0 Gold ©2010, PixelFX Studios
vBCredits I v2.0.0 Gold ©2010, PixelFX Studios
Emoticons by darkmoon3636