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
  #11  
Old 04-07-2011, 05:24 PM
AlexC's Avatar
AlexC AlexC is offline
Moderator
 
Join Date: Dec 2009
Location: Canada
Posts: 753
Gender: Unknown/Other
Credits: 89,755
AlexC is an unknown quantity at this point
Default

Code:
<?php

include("inc/functions.php");

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

$id = $_GET["id"];
$promocode = $_GET["promocode"];
$name = $_GET["name"];

if($isloggedin == "yes"){
	if($_SESSION["allow"] != 1){
	
		$article_title = $err_idnoexist;
		$article_content = $err_idnoexist_text;
	}
	elseif($_SESSION["allow"] == 1){
	
		// I guess the first thing to do is see if we have a valid adoptable ID submitted...
		if($id == "" or !is_numeric($id)){
			$article_title = $err_idnoexist;
			$article_content = $err_idnoexist_text;
		}
		else{
			// The adoptable ID appears to be valid, so we need to double check that it is valid by pulling up the adoptable in the DB

			$query = "SELECT * FROM ".$prefix."adoptables WHERE id='$id'";
			$result = runquery($query);

			//$result = runquery($query); HoF, this should be removed.
			$row = mysql_fetch_array($result);

			$aid = $row['id'];
			$type=$row['type'];
			$description=$row['description'];
			$eggimage=$row['eggimage'];

			if($id == $aid){
				// The ID submitted matches an existing adoptable type
				$canadopt = canadopt($aid, "adopting", $promocode, $row);

				// If we can adopt this creature, do the adoption
				if($canadopt == "yes") {
					if (changecash(-$row['cost'], $GLOBALS['loggedinname'], $GLOBALS['money'])==true) {				
						// BEGIN the actual adoption process

						// First we see if we have a custom name; if not, we use the default name
						if($name == ""){
							$name = $type;
						}

						// Now we determine if we are using alternate images or not

						$alts = getaltstatus($id, 0, 0);

						// We need a unique code for the adoptable so we can show it to the user when we're done here...

						$code = rand(1, 20000);
						$genders = array('f', 'm');
						$rand = rand(0,1);
						
						runquery("INSERT INTO ".$prefix."owned_adoptables VALUES ('', '$type', '$name','$loggedinname','0','0', '$code', '','$alts','fortrade','no', '$genders[$rand]','0')");

						// Adoption complete, show the user a confirmation screen...

						$query = "SELECT * FROM ".$prefix."owned_adoptables WHERE code='$code' and owner='$loggedinname'";
						$result = runquery($query);
						$num = mysql_numrows($result);
						 
						$id=@mysql_result($result,0,"aid"); 

						$article_title = $name." adopted successfully";
						$article_content = "<img src='".$eggimage."'><br>".$congrats1." ".$name.".  You can now manage ".$name." on the 
						<a href='myadopts.php'>My Adopts</a> page.<br><br><b><a href='myadopts.php?act=manage&id=".$id."'>Click Here to Manage ".$name."</a><br>
						<a href='myadopts.php?act=bbcode&id=".$id."'>Click Here to get BBCodes / HTML Codes for ".$name."</a></b><br><br>
						Be sure and <a href='levelup.php?id=".$id."'>feed</a> ".$name." with clicks so that they grow!";
						unset($_SESSION["allow"]);
						// END the actual adoption process
					}
					else {
						$article_title = "Not enough money.";
						$article_content = "You don't have enough {$GLOBALS['settings']['cost']} to buy this adoptable. Earn some money and then try again.";
					}
				}
				else {
					$article_title = $accden;
					$article_content = $adoptnoper;
				}
			} // End the if for if $id == $aid
			else {
				// Adoptable does not exist, show an error.

				$article_title = $err_idnoexist;
				$article_content = $err_idnoexist_text;
			} // End the else for if $id == $aid
		} // End the valid ID input else test statement (bulk of code goes above here)
	}
} // End the log in check IF
else {
	// Guests cannot adopt pets, so why bother...
	$article_title = $guesttitleerror;
	$article_content = $guesterror;
} // End the log in check ELSE 

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

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

?>
Here you go.
Reply With Quote
 


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
Images not showing? katsRme Feedback and Suggestions 15 08-19-2012 06:08 PM
I'm showing up more then once AlkseeyaKC Questions and Supports 21 08-28-2011 02:52 AM
images not showing dragonqueen Questions and Supports 7 05-22-2010 10:11 PM
Not Showing Name SJC Questions and Supports 4 04-21-2009 05:03 AM
Certain adoptables not showing Killgore Questions and Supports 5 02-22-2009 04:58 PM


All times are GMT -5. The time now is 11:10 AM.

Currently Active Users: 1890 (0 members and 1890 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