View Full Version : [Updated] AJAX Sortable Adoptables on "myadopts.php" Page
fadillzzz
08-29-2011, 12:59 PM
--- Unimportant Stuff ---
It's been a while since the last time I made a mod. So, forgive me if this mod is a bit buggy.
I made this mod regarding to this thread (http://www.mysidiaadoptables.com/forum/showthread.php?t=2355). I've been wanted to make this mod actually, it's just that for some reason I don't think it's going to worth the time.
Anyway, this mod is far from perfect. Especially in the javascript part. Those of you who knows javascript and jQuery very well, do not hesitate to suggest me better code. (The same thing goes for PHP XD)
I hope you'll find this mod very useful and nice. Otherwise, I'd probably shoots myself.
Bug fixed:
Fixed a bug where the $_POST variable keys are modified. (http://www.mysidiaadoptables.com/forum/showpost.php?p=18304&postcount=14)
Trading adoptables can cause duplicate entries in the sorting tables. (http://www.mysidiaadoptables.com/forum/showthread.php?p=18533#post18533)
--- /Unimportant Stuff ---
--- The REAL Stuff ---
MySQL
1. Make a new table in the database.
This should make your life easier
CREATE TABLE IF NOT EXISTS `adopts_sort_adoptables` (
`user_id` int(11) NOT NULL,
`adoptable_id` int(11) NOT NULL,
`sorting_id` int(11) NOT NULL,
PRIMARY KEY (`adoptable_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
PHP
1. Open inc/functions.php
Go to line 46 and find this code
$_POST = array_map('secure',$_POST);
And replace it with
array_map('secure', $_POST, array_keys($_POST)); // Values are assigned back in secure()
After that, find the secure() function. It's on line 159, and it look something like this
function secure($data) {
//This function performs security checks on all incoming form data
if(is_array($data)) {
die("Hacking Attempt!");
}
$data = htmlentities($data);
$data = mysql_real_escape_string($data);
$data = strip_tags($data, '');
return $data;
}
Now let's modify that function by replacing it with this new one
function secure($data, $key = NULL) {
//This function performs security checks on all incoming form data
if ($key === 'orderaid')
{
//var_dump($data); var_dump($key); die;
foreach($data as $dataKey => $dataVal)
{
$data[$dataKey] = abs(intval($dataVal));
}
//var_dump($data);die;
return $data;
}
if(is_array($data)) {
die("Hacking Attempt!");
}
$data = htmlentities($data);
$data = mysql_real_escape_string($data);
$data = strip_tags($data, '');
if ($key === NULL)
{
return $data;
}
$GLOBALS['_POST'][$key] = $data;
}
2. Open myadopts.phpGo to line 18, and we'll do a little bit of modifying the HTML here. Feel free to modify the HTML to your liking if you know what you're doing. I suggest that you modify it later when you're finished installing this mod.
Find the following code
$article_content = "<table>
<tr>
<th></th><th>Name and Type</th><th>Image</th><th>Clicks</th>
</tr>";
Replace that code with
$article_content = "<p id='activate_sort'>
Click here to sort your adoptables
</p>
<table>
<tr>
<th></th><th>Name and Type</th><th>Image</th><th>Clicks</th>
</tr>
</table>
<table id='sortable_adoptables'>";
On line 28, find a query that look like this
$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";
Replace that whole code with this one
/*
$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";
*/
$query = " SELECT *
FROM {$prefix}owned_adoptables
LEFT JOIN {$prefix}sort_adoptables
ON {$prefix}owned_adoptables.aid = {$prefix}sort_adoptables.adoptable_id
INNER JOIN {$prefix}levels
ON {$prefix}levels.thisislevel = {$prefix}owned_adoptables.currentlevel
INNER JOIN {$prefix}adoptables
ON {$prefix}owned_adoptables.type = {$prefix}adoptables.type
WHERE {$prefix}owned_adoptables.owner = '{$loggedinname}'
AND {$prefix}levels.adoptiename = {$prefix}adoptables.type
ORDER BY {$prefix}sort_adoptables.sorting_id";
Go to line 70 or something and look for this code
$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>";
Replace it with this
$article_content .= "<tr id='orderaid_{$row['aid']}'>
<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>";
3. Upload ajax_sort.php (file is attached)
HTML and Javascript
1. Open your HTML template file. (The default one is template/elements/template.html)Now, for this part, there are a few choices of doing it. But first, make sure that you have jQuery and jQuery UI running in your page.
Either by downloading them and uploading them to your server or just use the CDN service.
In this tutorial I'll be using the CDN hosted jQuery and jQuery UI.
So anyway, in the HTML template, inside the <head> tag put code
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$('body').undelegate('click').delegate('p#activate _sort', 'click', function(){
var realBg = $('table#sortable_adoptables').css('background-color');
var submitForm = '<form name="submit_order" id="submit_order" action="" method="post"><fieldset><label for="submit">Submit Changes</label><input type="submit" id="submit" value="Submit"></fieldset></form>';
$('table#sortable_adoptables').css('background-color', '#FFFF66').animate({ backgroundColor: realBg }, 'slow' ).find('tbody').sortable({ cursor: 'pointer' });
$(submitForm).insertAfter('p#activate_sort').hide( ).slideDown();
$('p#activate_sort').attr('id', 'deactivate_sort');
});
$('body').undelegate('submit').delegate('form#subm it_order', 'submit', function(event){
event.preventDefault();
var data = $('table#sortable_adoptables tbody').sortable('serialize');
$.post('ajax_sort.php', data, function(result){
$('form#submit_order').html(result).delay(5000).fa deOut('slow', function(){
$(this).remove();
});
});
$('table#sortable_adoptables tbody').sortable('destroy');
$('p#deactivate_sort').attr('id', 'activate_sort');
});
});
</script>
That's it! You can now go to your myadopts.php page and then click on 'Click here to sort your adoptables', after that the adoptables list will be sortable. I hope I didn't miss anything while writing this.
Also, I've attached the files I used in my development environment. If you haven't modified ANY file (i.e. fresh installation) you can just download all the files attached to this post
P.S: You can take advantage of this mod to order the adoptables in other pages such as profile page with some modification to the query.
--- /The REAL Stuff ---
Hall of Famer
08-29-2011, 01:41 PM
This is amazing, I have to say. Glad to see you create a script with both PHP and Javascript, the code looks quite professional and I am sure people will like it.
SilverDragonTears
08-29-2011, 01:51 PM
My sort your adoptables link isn't clickable....
fadillzzz
08-29-2011, 01:53 PM
@HoF
Thanks. I actually have a plan to make more mods that take will take the advantages of AJAX.
@SilverDragonTears
Post your javascript code and myadopts.php here. Also, be sure to remember that you've included the jQuery and jQuery UI .js file in the page.
SilverDragonTears
08-29-2011, 01:55 PM
template.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>SilvAdopts</title>
<link rel="icon" href="http://silvadopts.com/forums/favicon.ico" type="image/x-icon">
<link href="http://silvadopts.com/templates/chibi-blue/chibi-blue-css.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$('body').undelegate('click').delegate('p#activate _sort', 'click', function(){
var realBg = $('tbody').css('background-color');
var submitForm = '<form name="submit_order" id="submit_order" action="" method="post"><fieldset><label for="submit">Submit Changes</label><input type="submit" id="submit" value="Submit"></fieldset></form>';
$('table#sortable_adoptables tbody').css('background-color', '#FFFF66').animate({ backgroundColor: realBg }, 'slow' ).sortable({ cursor: 'pointer' });
$(submitForm).insertAfter('p#activate_sort').hide( ).slideDown();
$('p#activate_sort').attr('id', 'deactivate_sort');
});
$('body').undelegate('submit').delegate('form#subm it_order', 'submit', function(event){
event.preventDefault();
var data = $('table#sortable_adoptables tbody').sortable('serialize');
$.post('ajax_sort.php', data, function(result){
$('form#submit_order').html(result).delay(5000).fa deOut('slow', function(){
$(this).remove();
});
});
$('table#sortable_adoptables tbody').sortable('destroy');
$('p#deactivate_sort').attr('id', 'activate_sort');
});
});
</script>
</head>
<body>
<div id="wrapper">
<div id="main">
<div id="space">
<div id="title">
<a href="index.php"><img src="/images/sabanner.png"></a>
<h2><a href="index.php"><small>:SLOGAN:</small></a></h2>
</div>
<div id="nav">
:LINKSBAR:
</div>
<div id="sidebar">
:SIDEFEED:</div>
<div id="content" style="min-height:400px;">
<h1>:ARTICLETITLE:</h1>
<p>:ARTICLECONTENT:</p>
<div style="clear: both"></div>
<div style="height:15px; width: 100%"></div>
<div style="clear: both"></div>
</div>
<div style="height:15px; width: 100%"></div>
<div id="content_top"></div>
<div id="bottom">
<div id="b_col1">
<p>Powered by <a href="http://www.mysidiaadoptables.com/forum/">Mysidia Adoptables</a> | Copyright © <script type="text/javascript">
var d = new Date();
document.write(d.getFullYear());
</script> <a href="index.php">SilvAdopts</a> | CSS base by <a href="http://www.mysidiaadoptables.com/forum/member.php?u=10536" target="_blank">ChibiKawaii</a>, modified by SilverDragonTears</p>
</div>
<div style="clear: both; height:1px;"></div>
</div>
<div id="content_bot"></div><br />
</body>
</html>
myadopts.php
<?php
include("inc/functions.php");
//***************//
// START SCRIPT //
//***************//
$id = $_GET["id"];
$act = $_GET["act"];
$more = $_GET["more"];
if($isloggedin == "yes"){
if($act == ""){
$article_content .= "
<div style='width: 100%; float:left; padding:5px;'><img src='http://www.v-adoptables.com/core/images/icons/small/coins.png'> {$GLOBALS['money']}</div><br>";
$article_content .="<br>
<center>
<div style='width: 32%; float: left;'><a href='trade.php'>Trade</a><br>
<a href='breeding.php'>Breed</a><br>
<a href='embed.php'>Embed All</a></div>
<div style='width: 32%; float: left;'><a href='account.php'>Account Settings</a><br>
<a href='profile.php'>Members List</a><br>
<a href='logout.php'>Log Out</a></div>
<div style='width: 32%; float: left;'><a href='donate.php'>Donate to Friends</a><br>
<a href='sort.php'>Sort Adopts</a></div></center>
<p id='activate_sort'>
Click here to sort your adoptables
</p>
<table id='sortable_adoptables'></table>
<br>
<br>
<br>
<br>
Share this link with others to show them your Den<br>
<input type='text' size='100' value='http://silvadopts.com/profile.php?user=$loggedinname'><br>
<a href='http://silvadopts.com/profile.php?user=$loggedinname'>http://silvadopts.com/profile.php?user=$loggedinname</a><br>";
$article_content .= "<div style='height:100%; background: #1f1f1f url(http://silvadopts.com/forums/public/style_images/animate/box_pattern.png) repeat;
color: #fff;
border: 1px solid #282828;
border-top: 1px solid #363636;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
padding: 5px;'><center>Your Den</center><br><br><table style='width: 100%;' class='vamid'><tbody>
<tr><th>SilvA Fox</th><th>Name</th><th>Level</th><th>Manage</th><th>Get Codes</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."levels WHERE ".$prefix."owned_adoptables.owner = '{$loggedinname}'"
." AND ".$prefix."owned_adoptables.type = ".$prefix."owned_adoptables.type AND ".$prefix."levels.thisislevel = ".$prefix."owned_adoptables.currentlevel AND ".$prefix."levels.adoptiename = "
.$prefix."owned_adoptables.type ORDER BY ".$prefix."owned_adoptables.sort, ".$prefix."owned_adoptables.totalclicks";
*/
$query = " SELECT *
FROM {$prefix}owned_adoptables
LEFT JOIN {$prefix}sort_adoptables
ON {$prefix}owned_adoptables.aid = {$prefix}sort_adoptables.adoptable_id
INNER JOIN {$prefix}levels
ON {$prefix}levels.thisislevel = {$prefix}owned_adoptables.currentlevel
INNER JOIN {$prefix}adoptables
ON {$prefix}owned_adoptables.type = {$prefix}adoptables.type
WHERE {$prefix}owned_adoptables.owner = '{$loggedinname}'
AND {$prefix}levels.adoptiename = {$prefix}adoptables.type
ORDER BY {$prefix}sort_adoptables.sorting_id";
$result = runquery($query);
$num = mysql_numrows($result);
//Loop out code
$i=0;
while ($i < $num) {
$aid=@mysql_result($result,$i, $prefix."owned_adoptables.aid");
$currentlevel=@mysql_result($result,$i, $prefix."owned_adoptables.currentlevel");
$gender=@mysql_result($result,$i, $prefix."owned_adoptables.gender");
$isfrozen=@mysql_result($result,$i, $prefix."owned_adoptables.isfrozen");
$type=@mysql_result($result,$i, $prefix."owned_adoptables.type");
$name=@mysql_result($result,$i, $prefix."owned_adoptables.name");
$eggimage=@mysql_result($result,$i, $prefix."adoptables.eggimage");
$usealternates=@mysql_result($result,$i, $prefix."owned_adoptables.usealternates");
$totalclicks=@mysql_result($result,$i, $prefix."owned_adoptables.totalclicks");
$primaryimage=@mysql_result($result,$i, $prefix."levels.primaryimage");
$alternateimage=@mysql_result($result,$i, $prefix."levels.alternateimage");
if ($usealternates=='yes') { $image = $alternateimage; }
else { $image = $primaryimage; }
if ($currentlevel==0) { $image = $eggimage; }
if ($image=='') { $image = $primaryimage; }
$article_content .= "<tr><td><a href='myadopts.php?act=stats&id=".$aid."'><img src='$image'></a></td><td>";
if($isfrozen == 'no') {
$article_content .= '';
} else {
$article_content .= '<img src=\'http://inky.org/rpg/agents-maps/snowflake.png\'>';
}
$article_content .= "<img src='picuploads/{$gender}.png'> <em><em>".stripslashes($name)."</em></em></td><td>{$currentlevel}</td><td><a href='myadopts.php?act=manage&id={$aid}'>Actions</a></td><td><a href='myadopts.php?act=bbcode&id={$aid}'>Get Codes</a></td><td>{$totalclicks}</td></tr>";
$i++;
}
$article_content .= "</tbody></table></div>";
}
else if($act == "manage"){
// We are managing a specific adoptable
if($id == "" or !is_numeric($id)){
$article_title = $err_idnoexist;
$article_content = $err_idnoexist_text;
}
else{
// See if the adoptable actually exists...
$query = "SELECT * FROM ".$prefix."owned_adoptables WHERE owner='$loggedinname' and aid='$id'";
$result = runquery($query);
$num = mysql_numrows($result);
//Loop out code
$i=0;
while ($i < 1) {
$aid=@mysql_result($result,$i,"aid"); //The adoptable's ID
$currentlevel=@mysql_result($result,$i,"currentlevel");
$type=@mysql_result($result,$i,"type");
$name=@mysql_result($result,$i,"name");
$tradestatus=@mysql_result($result,$i,"tradestatus");
$father=@mysql_result($result,$i,"father");
$mother=@mysql_result($result,$i,"mother");
$lastbred=@mysql_result($result,$i,"lastbred");
$adultdescription=@mysql_result($result,$i,"adultdescription");
$i++;
}
// Check that the adoptable exists for real, or show an error...
if($aid == $id){
// The adoptable does exist, so we show the image and junk to the user...
$image = getcurrentimage($id);
$article_title = "Managing " . stripslashes($name);
$article_content = "
<div id='top' style='position: relative;'></div>
<div id='middle' style='position: relative;'><img src='".$image."'><br>
This page allows you to manage ".stripslashes($name).". Click on an option below to change settings.<br><br>
<b><a href='levelup.php?id=".$id."'>Level Up</a> Level up this creature to help it reach the next stage.<br>
<a href='myadopts.php?act=stats&id=".$id."'>Stats</a> Stats for your creature.<br>
<a href='myadopts.php?act=bbcode&id=".$id."'>Get BBCodes / HTML Codes</a> Use these codes to place ".stripslashes($name)." on other forums.<br>
<a href='myadopts.php?act=rename&id=".$id."'>Rename</a> Rename ".stripslashes($name).".<br>
<a href='myadopts.php?act=trade&id=".$id."'>Change Trade Status</a> Change ".stripslashes($name)."'s trade status to notfortrade or fortrade.<br>";
if($currentlevel == '0') {
$article_content .= "Freeze (You can not freeze eggs.)<br>";
} else if($currentlevel == '1') {
$article_content .= "Freeze (You can not freeze eggs.)<br>";
} else if($currentlevel == '2') {
$article_content .= "Freeze (You can not freeze eggs.)<br>";
} else if($currentlevel == '3') {
$article_content .= "Freeze (You can not freeze eggs.)<br>";
} else if($currentlevel == '5') {
$article_content .= "Freeze (You can not freeze adults.)<br>";
} else {
$article_content .= "<a href='myadopts.php?act=freeze&id=".$id."'>Freeze</a> This action can NOT be undone.<br>";
}
$article_content .= "<a href='myadopts.php?act=pound&id=".$id."'>Abandon</a> Abandon ".stripslashes($name)." and allow it to fend for itself.</b><br></div>";
}
else{
$article_title = $err_idnoexist;
$article_content = $err_idnoexist_text;
}
}
} // End the MANAGE action code
else if($act == "stats"){
// We are getting the stats for the adoptable
// Check that an ID was submitted...
if(is_numeric($id)){
// Now we see if the adoptable actually exists...
$query = "SELECT * FROM ".$prefix."owned_adoptables as o LEFT JOIN ".$prefix."adoptables as a on o.type=a.type WHERE owner='$loggedinname' and aid='$id'";
$result = runquery($query);
$num = mysql_numrows($result);
//Loop out code
$i=0;
while ($i < 1) {
$aid=@mysql_result($result,$i,"aid"); //The adoptable's ID
$currentlevel=@mysql_result($result,$i,"currentlevel");
$type=@mysql_result($result,$i,"type");
$owner=@mysql_result($result,$i,"owner");
$name=@mysql_result($result,$i,"name");
$totalclicks=@mysql_result($result,$i,"totalclicks");
$gender=@mysql_result($result,$i,"gender");
$lastbred=@mysql_result($result,$i,"lastbred");
$isfrozen=@mysql_result($result,$i,"isfrozen");
$tradestatus=@mysql_result($result,$i,"tradestatus");
$father=@mysql_result($result,$i,"father");
$mother=@mysql_result($result,$i,"mother");
$getFather = mysql_query('SELECT `name`
FROM ' . $prefix . 'owned_adoptables
WHERE `aid` = ' . $father
);
$getMother = mysql_query('SELECT `name`
FROM ' . $prefix . 'owned_adoptables
WHERE `aid` = ' . $mother
);
$nFather = mysql_fetch_assoc($getFather);
$nFather = $nFather['name'];
$nMother = mysql_fetch_assoc($getMother);
$nMother = $nMother['name'];
$adultdescription=@mysql_result($result,$i,"adultdescription");
$eggdesc=@mysql_result($result,$i,"eggdesc");
$foxdesc=@mysql_result($result,$i,"foxdesc");
$date=@mysql_result($result,$i,"date");
$i++;
}
if($aid == $id){
// The adoptable exists, so we show the stats for it...
$image = getcurrentimage($id);
$nextlevelexists = getnextlevelexists($type, $currentlevel);
$nextlevel = "";
// If a higher level exists, get that level's information...
if($nextlevelexists == "true"){
$nextlevel = $currentlevel + 1;
$query = "SELECT * FROM ".$prefix."levels WHERE adoptiename='$type' and thisislevel='$nextlevel'";
$result = runquery($query);
$num = mysql_numrows($result);
$i=0;
while ($i < 1) {
$requiredclicks=@mysql_result($result,$i,"requiredclicks"); //The adoptable's ID
$i++;
}
} // End grab next level info...
// Determine what to show for next level:
if($nextlevelexists == "true" and $nextlevel != ""){
// See how many more clicks to go
$ctg = $requiredclicks - totalclicks;
$nloutput = $nextlevel."<br>Clicks Required for Level Increase: ".$ctg;
}
else{
$nloutput = "This adoptable is at its maximum level";
}
$article_content = "
<div style='height:100%; background: #1f1f1f url(http://silvadopts.com/forums/public/style_images/animate/box_pattern.png) repeat;
color: #fff;
border: 1px solid #282828;
border-top: 1px solid #363636;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
padding: 5px;'>Click the adopt to level it up!<table class='den' width='100%'><tr><td>
<br>
<a href='levelup.php?id=".$id."'><img src='".$image."' style='margin: 0px auto; display: block'></a><br>
<div class='vgroup'>
<a href='myadopts.php?act=manage&id=".$id."'>Actions</a><br>
Name: ".stripslashes($name)."<br>";
if($father == "0") {
$article_content .= 'Caught On:';
} else {
$article_content .= 'Laid On:';
}
$article_content .= "
$date<br>
For Trade: ".$tradestatus."<br>
Current Level: ".$currentlevel."<br>
Next Level: ".$nloutput."<br>
<b>Total Clicks: ".$totalclicks."</b><br></div>
<div class='vgroup'>
Owner: <a href='http://silvadopts.com/profile.php?user=".$owner."'>$owner</a><br>
Gender: ";
if($gender == 'm') {
$article_content .= 'Male ';
} else {
$article_content .= 'Female ';
}
if($isfrozen == 'no') {
$article_content .= '<br>';
} else {
$article_content .= '<img src=\'http://inky.org/rpg/agents-maps/snowflake.png\'><br> ';
}
if($nFather == '' && $nMother == '') {
$article_content .= '';
} else {
$article_content .= 'Father: ' . $nFather . '<br>
Mother: ' . $nMother . '<br>';
}
$article_content .= '
<a href="http://silvadopts.com/familytree.php?aid='.$aid.'">View Lineage</a><br>';
if($lastbred == '') {
$article_content .= '';
}
else if($lastbred == '0') {
$article_content .= '';
} else {
$article_content .= 'Last bred: '.date('M j, Y', $lastbred).'<br>
Children: (<i>This feature is not yet available</i>)<br>';
}
$article_content .= "<br><br><br><br><br><br></div>";
if($currentlevel == '0') {
$article_content .= "$eggdesc";
}
elseif($currentlevel == '1') {
$article_content .= "$eggdesc";
}
elseif($currentlevel == '2') {
$article_content .= "$eggdesc";
}
elseif($currentlevel == '3') {
$article_content .= "$eggdesc";
}
elseif($currentlevel == '4') {
$article_content .= "$foxdesc";
}
elseif($currentlevel >= '5') {
$article_content .= "$adultdescription";
}
$article_content .="<br><br>";
if($type == 'Red Stitch Silvfox') {
$article_content .='Artist: Switch';
} else if($type == 'Eventide Silvfox') {
$article_content .='Artist: Switch';
} else if($type == 'White Stitch Silvfox') {
$article_content .='Artist: Switch';
} else if($type == 'The Noctis Silvfox') {
$article_content .='Artist: Switch';
} else if($type == 'Gold Silvfox') {
$article_content .='Artist: Switch, Roconza';
} else if($type == 'Inferno Silvfox') {
$article_content .='Artist: Switch, Roconza';
} else if($type == 'The Marauder Silvfox') {
$article_content .='Artist: Switch';
} else if($type == 'Switch Silvfox') {
$article_content .='Artist: Switch';
} else if($type == 'Arctic Silvfox') {
$article_content .='Artist: Switch';
} else if($type == 'Zebra Silvfox') {
$article_content .='Artist: Isura';
} else if($type == 'Tiger Silvfox') {
$article_content .='Artist: Isura';
} else if($type == 'Heat Element Silvfox') {
$article_content .='Artist: Isura';
} else if($type == 'Magic Element Silvfox') {
$article_content .='Artist: Isura';
} else if($type == 'Grass Element Silvfox') {
$article_content .='Artist: Isura';
} else if($type == 'Water Element Silvfox') {
$article_content .='Artist: Isura';
} else if($type == 'Yellow Winged Silvfox') {
$article_content .='Artist: Isura';
} else if($type == 'Blue Winged Silvfox') {
$article_content .='Artist: Isura';
} else if($type == 'Teal Winged Silvfox') {
$article_content .='Artist: Isura';
} else if($type == 'Orange Winged Silvfox') {
$article_content .='Artist: Isura';
} else if($type == 'Dark Winged Silvfox') {
$article_content .='Artist: Isura';
} else if($type == 'The Forest Silvfox') {
$article_content .='Artist: Switch, Roconza, SilverDragonTears';
} else if($type == 'The Gremlin Silvfox') {
$article_content .='Artist: Switch, Roconza, Beachbeagle';
} else if($type == 'Rainbow Silvfox') {
$article_content .='Artist: Switch, SilverDragonTears';
} else if($type == 'Redd Silvfox') {
$article_content .='Artist: Duzlla';
} else if($type == 'Graven Silvfox') {
$article_content .='Artist: Duzlla';
} else if($type == 'Fairie Silvfox') {
$article_content .='Artist: Duzlla';
} else if($type == 'GreenTipped Silvfox') {
$article_content .='Artist: GoldenShadowFire';
} else if($type == 'Marauder Red Silvfox') {
$article_content .='Artist: Switch, SilverDragonTears';
} else if($type == 'Snow Owl') {
$article_content .='Artist: elfhome';
} else if($type == 'The Lichen Silvfox') {
$article_content .='Artist: albinosilver';
} else if($type == 'Day Dream Silvfox') {
$article_content .='Artist: SilverDragonTears';
} else if($type == 'Sapphire Golem Silvfox') {
$article_content .='Artist: Isura';
} else if($type == 'Brass Golem Silvfox') {
$article_content .='Artist: Isura';
} else if($type == 'Hellfire Golem Silvfox') {
$article_content .='Artist: Isura';
} else if($type == 'Raven') {
$article_content .='Artist: SilverDragonTears, albinosilver';
}
$article_content .="
</td></tr></table></div>";
}
else{
$article_title = $err_idnoexist;
$article_content = $err_idnoexist_text;
}
}
else{
$article_title = $err_idnoexist;
$article_content = $err_idnoexist_text;
}
}
// End the STATS code
else if($act == "bbcode"){
if(is_numeric($id)){
// Now we see if the adoptable actually exists...
$query = "SELECT * FROM ".$prefix."owned_adoptables WHERE owner='$loggedinname' and aid='$id'";
$result = runquery($query);
$num = mysql_numrows($result);
//Loop out code
$i=0;
while ($i < 1) {
$aid=@mysql_result($result,$i,"aid"); //The adoptable's ID
$currentlevel=@mysql_result($result,$i,"currentlevel");
$type=@mysql_result($result,$i,"type");
$name=@mysql_result($result,$i,"name");
$totalclicks=@mysql_result($result,$i,"totalclicks");
$isfrozen=@mysql_result($result,$i,"isfrozen");
$i++;
}
if($aid == $id){
$altbb = grabanysetting("usealtbbcode");
// Adoptable exists, so show the BBCode:
$article_title = "Codes for ".stripslashes($name);
$article_content = $lang_bbcode_explain."<br>
<p><u>Forum Codes / BBCode: </u></p>
<p>
<textarea name='textarea' cols='50' rows='4'>http://www.".$domain."".$scriptpath."/siggy.php?id=".$aid." (http://www.".$domain."".$scriptpath."/levelup.php?id=".$aid.")
</textarea>
</p>";
if($altbb == "yes"){
// Use the seo friendly alternate bbcodes...
$article_content = $article_content."<p><u>Alternate BBCodes (Use if the above do not work on a forum): </u></p>
<p>
<textarea name='textarea' cols='50' rows='4'>http://www.".$domain."".$scriptpath."/get/".$aid.".gif (http://www.".$domain."".$scriptpath."/levelup.php?id=".$aid.")
</textarea>
</p>";
}
$article_content = $article_content."<p><u>HTML Code</u>:</p>
<p>
<textarea name='textarea' cols='50' rows='4'><a href=\"http://www.".$domain."".$scriptpath."/levelup.php?id=".$aid."\" target=\"_blank\">
<img src=\"http://www.".$domain."".$scriptpath."/siggy.php?id=".$aid."\" border=0></a>
</textarea>
</p>";
}
else{
$article_title = $err_idnoexist;
$article_content = $err_idnoexist_text;
}
}
else{
$article_title = $err_idnoexist;
$article_content = $err_idnoexist_text;
}
} // End the BBCODE generation for the adoptable...
else if($act == "rename"){
// We are renaming an adoptable
if(is_numeric($id)){
// Now we see if the adoptable actually exists...
$query = "SELECT * FROM ".$prefix."owned_adoptables WHERE owner='$loggedinname' and aid='$id'";
$result = runquery($query);
$num = mysql_numrows($result);
//Loop out code
$i=0;
while ($i < 1) {
$aid=@mysql_result($result,$i,"aid"); //The adoptable's ID
$currentlevel=@mysql_result($result,$i,"currentlevel");
$type=@mysql_result($result,$i,"type");
$name=@mysql_result($result,$i,"name");
$totalclicks=@mysql_result($result,$i,"totalclicks");
$isfrozen=@mysql_result($result,$i,"isfrozen");
$i++;
}
if($aid == $id){
$image = getcurrentimage($id);
if($more == ""){
$article_title = "Rename ".stripslashes($name);
$article_content = "<img src='".$image."'><br>".$lang_rename."".stripslashes($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{
$article_title = $err_idnoexist;
$article_content = $err_idnoexist_text;
}
}
else{
$article_title = $err_idnoexist;
$article_content = $err_idnoexist_text;
}
}
else if($act == "trade"){
// We are setting the trade status for an adoptable...
if(is_numeric($id)){
// Now we see if the adoptable actually exists...
$query = "SELECT * FROM ".$prefix."owned_adoptables WHERE owner='$loggedinname' and aid='$id'";
$result = mysql_query($query);
$num = mysql_numrows($result);
//Loop out code
$i=0;
while ($i < 1) {
$aid=@mysql_result($result,$i,"aid"); //The adoptable's ID
$tradestatus=@mysql_result($result,$i,"tradestatus");
$i++;
}
if($aid == $id){
$image = getcurrentimage($id); // Get the image for the adopt...
if($more == ""){
$article_title = "Setting trade status for ".stripslashes($name);
$article_content = "Are you sure you wish to change the trade status of this adoptable?<center><b><a href='myadopts.php?act=trade&id=".$id."&more=confirm'>Yes I'd like to change its trade status</a></b><br><br>
<b><a href='myadopts.php'>Nope I change my mind! Go back to the previous page.</a></b></center><br>";
}
else if($more == "confirm"){
if($tradestatus == "fortrade"){
$newtradestatus = "notfortrade";
$query = "UPDATE ".$prefix."owned_adoptables SET tradestatus='".$newtradestatus."' WHERE aid='".$id."' and owner='".$loggedinname."'";
runquery($query);
$article_title = "Change trade status successfully";
$article_content = "The adoptable's trade status is now Not for Trade";
}
else if($tradestatus == "notfortrade"){
$newtradestatus = "fortrade";
$query = "UPDATE ".$prefix."owned_adoptables SET tradestatus='".$newtradestatus."' WHERE aid='".$id."' and owner='".$loggedinname."'";
runquery($query);
$article_title = "Change trade status successfully";
$article_content = "The adoptable's trade status is now For Trade";
}
else{
$article_title = "Something is very very wrong";
$article_content = "Please check phpmyadmin to see if the settings are correct, or report your issue to Mysidia Adoptables support forum";
}
}
else{
$article_title = "Invalid Action";
$article_content = "Invalid Action Specified";
}
}
else{
$article_title = $err_idnoexist;
$article_content = $err_idnoexist;
}
}
else{
$article_title = $err_idnoexist;
$article_content = $err_idnoexist_text;
}
}
else if($act == "freeze"){
// We are freezing an adoptable here...
if(is_numeric($id)){
// Now we see if the adoptable actually exists...
$query = "SELECT * FROM ".$prefix."owned_adoptables WHERE owner='$loggedinname' and aid='$id'";
$result = runquery($query);
$num = mysql_numrows($result);
//Loop out code
$i=0;
while ($i < 1) {
$aid=@mysql_result($result,$i,"aid"); //The adoptable's ID
$currentlevel=@mysql_result($result,$i,"currentlevel");
$type=@mysql_result($result,$i,"type");
$name=@mysql_result($result,$i,"name");
$totalclicks=@mysql_result($result,$i,"totalclicks");
$isfrozen=@mysql_result($result,$i,"isfrozen");
$i++;
}
if($aid == $id){
$image = getcurrentimage($id); // Get the image for the adopt...
if($more == ""){
if($isfrozen == "yes"){
$group = getgroup();
$cancp = cancp($group);
if($cancp == "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/freeze.gif'> Frozen<br>";
$go = "You are not allowed to unfreeze this adoptable. <a href='javascript:history.go(-1)'>Click here to go back.</a>";
}
}
else if($isfrozen == "no"){
$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>".stripslashes($name)."'s Current Status: ".$status."</b><br>".$lang_freeze."<br><br><b>".$go."</b><br><br>
".$lang_freeze_warning."";
}
else{
// We are actually freezing or unfreezing the adopt...
$frz = "no";
if($more == "freeze"){
$frz = "yes";
}
$query = "UPDATE ".$prefix."owned_adoptables SET isfrozen='".$frz."' WHERE aid='".$id."' and owner='".$loggedinname."'";
runquery($query);
if($frz == "yes"){
$article_title = stripslashes($name)." Frozen Successfully";
}
else{
$article_title = stripslashes($name)." Unfrozen Successfully";
}
$article_content = stripslashes($name)." is now frozen. You may now manage ".stripslashes($name)." on the <a href='myadopts.php?act=manage&id=".$id."'>My Adopts</a> page.";
}
}
else{
$article_title = $err_idnoexist;
$article_content = $err_idnoexist_text;
}
}
else{
$article_title = $err_idnoexist;
$article_content = $err_idnoexist_text;
}
}
else if($act == "pound"){
if(is_numeric($id)){
// Now we see if the adoptable actually exists...
$query = "SELECT * FROM ".$prefix."owned_adoptables WHERE owner='$loggedinname' and aid='$id'";
$result = runquery($query);
$num = mysql_numrows($result);
//Loop out code
$i=0;
while ($i < 1) {
$aid=@mysql_result($result,$i,"aid"); //The adoptable's ID
$currentlevel=@mysql_result($result,$i,"currentlevel");
$type=@mysql_result($result,$i,"type");
$name=@mysql_result($result,$i,"name");
$totalclicks=@mysql_result($result,$i,"totalclicks");
$isfrozen=@mysql_result($result,$i,"isfrozen");
$i++;
}
if($aid == $id){
$image = getcurrentimage($id); // Get the image for the adopt...
if($more == ""){
$article_title = "Abandon ".stripslashes($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> Abandon ".stripslashes($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 Abandon ".stripslashes($name)."! <img src='templates/icons/yes.gif' border=0></a></b></center><br>";
}
else if($more == "confirm"){
// Actually run the execution
$query = "UPDATE ".$prefix."owned_adoptables SET owner='SYSTEM' WHERE aid='".$id."'";
runquery($query);
$article_title = $lang_pound_title_complete;
$article_content = $lang_pound_complete;
}
else{
$article_title = "Invalid Action";
$article_content = "Invalid Action Specified";
}
}
else{
$article_title = $err_idnoexist;
$article_content = $err_idnoexist_text;
}
}
else{
$article_title = $err_idnoexist;
$article_content = $err_idnoexist_text;
}
}
else{
// No valid action specified :: show an error
$article_title = $lang_invalid_action_title;
$article_content = $lang_invalid_action;
}
}
else{
$article_title = $accden;
$article_content = $reqlogin;
} // End is logged in check else
//***************//
// OUTPUT PAGE //
//***************//
echo showpage($article_title, $article_content, $date);
?>
fadillzzz
08-29-2011, 02:01 PM
Try this for your myadopts.php
<?php
include("inc/functions.php");
//***************//
// START SCRIPT //
//***************//
$id = $_GET["id"];
$act = $_GET["act"];
$more = $_GET["more"];
if($isloggedin == "yes"){
if($act == ""){
$article_content .= "
<div style='width: 100%; float:left; padding:5px;'><img src='http://www.v-adoptables.com/core/images/icons/small/coins.png'> {$GLOBALS['money']}</div><br>";
$article_content .="<br>
<center>
<div style='width: 32%; float: left;'><a href='trade.php'>Trade</a><br>
<a href='breeding.php'>Breed</a><br>
<a href='embed.php'>Embed All</a></div>
<div style='width: 32%; float: left;'><a href='account.php'>Account Settings</a><br>
<a href='profile.php'>Members List</a><br>
<a href='logout.php'>Log Out</a></div>
<div style='width: 32%; float: left;'><a href='donate.php'>Donate to Friends</a><br>
<a href='sort.php'>Sort Adopts</a></div></center>
<p id='activate_sort'>
Click here to sort your adoptables
</p>
<br>
<br>
<br>
<br>
Share this link with others to show them your Den<br>
<input type='text' size='100' value='http://silvadopts.com/profile.php?user=$loggedinname'><br>
<a href='http://silvadopts.com/profile.php?user=$loggedinname'>http://silvadopts.com/profile.php?user=$loggedinname</a><br>";
$article_content .= "<div style='height:100%; background: #1f1f1f url(http://silvadopts.com/forums/public/style_images/animate/box_pattern.png) repeat;
color: #fff;
border: 1px solid #282828;
border-top: 1px solid #363636;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
padding: 5px;'><center>Your Den</center><br><br><table style='width: 100%;' class='vamid'><tbody>
<tr><th>SilvA Fox</th><th>Name</th><th>Level</th><th>Manage</th><th>Get Codes</th><th>Clicks</th></tr></table><table id='sortable_adoptables>'";
// We need to get all of the user's adoptables from the database and display them...
/* $query = "SELECT * FROM ".$prefix."owned_adoptables, ".$prefix."levels WHERE ".$prefix."owned_adoptables.owner = '{$loggedinname}'"
." AND ".$prefix."owned_adoptables.type = ".$prefix."owned_adoptables.type AND ".$prefix."levels.thisislevel = ".$prefix."owned_adoptables.currentlevel AND ".$prefix."levels.adoptiename = "
.$prefix."owned_adoptables.type ORDER BY ".$prefix."owned_adoptables.sort, ".$prefix."owned_adoptables.totalclicks";
*/
$query = " SELECT *
FROM {$prefix}owned_adoptables
LEFT JOIN {$prefix}sort_adoptables
ON {$prefix}owned_adoptables.aid = {$prefix}sort_adoptables.adoptable_id
INNER JOIN {$prefix}levels
ON {$prefix}levels.thisislevel = {$prefix}owned_adoptables.currentlevel
INNER JOIN {$prefix}adoptables
ON {$prefix}owned_adoptables.type = {$prefix}adoptables.type
WHERE {$prefix}owned_adoptables.owner = '{$loggedinname}'
AND {$prefix}levels.adoptiename = {$prefix}adoptables.type
ORDER BY {$prefix}sort_adoptables.sorting_id";
$result = runquery($query);
$num = mysql_numrows($result);
//Loop out code
$i=0;
while ($i < $num) {
$aid=@mysql_result($result,$i, $prefix."owned_adoptables.aid");
$currentlevel=@mysql_result($result,$i, $prefix."owned_adoptables.currentlevel");
$gender=@mysql_result($result,$i, $prefix."owned_adoptables.gender");
$isfrozen=@mysql_result($result,$i, $prefix."owned_adoptables.isfrozen");
$type=@mysql_result($result,$i, $prefix."owned_adoptables.type");
$name=@mysql_result($result,$i, $prefix."owned_adoptables.name");
$eggimage=@mysql_result($result,$i, $prefix."adoptables.eggimage");
$usealternates=@mysql_result($result,$i, $prefix."owned_adoptables.usealternates");
$totalclicks=@mysql_result($result,$i, $prefix."owned_adoptables.totalclicks");
$primaryimage=@mysql_result($result,$i, $prefix."levels.primaryimage");
$alternateimage=@mysql_result($result,$i, $prefix."levels.alternateimage");
if ($usealternates=='yes') { $image = $alternateimage; }
else { $image = $primaryimage; }
if ($currentlevel==0) { $image = $eggimage; }
if ($image=='') { $image = $primaryimage; }
$article_content .= "<tr><td><a href='myadopts.php?act=stats&id=".$aid."'><img src='$image'></a></td><td>";
if($isfrozen == 'no') {
$article_content .= '';
} else {
$article_content .= '<img src=\'http://inky.org/rpg/agents-maps/snowflake.png\'>';
}
$article_content .= "<img src='picuploads/{$gender}.png'> <em><em>".stripslashes($name)."</em></em></td><td>{$currentlevel}</td><td><a href='myadopts.php?act=manage&id={$aid}'>Actions</a></td><td><a href='myadopts.php?act=bbcode&id={$aid}'>Get Codes</a></td><td>{$totalclicks}</td></tr>";
$i++;
}
$article_content .= "</tbody></table></div>";
}
else if($act == "manage"){
// We are managing a specific adoptable
if($id == "" or !is_numeric($id)){
$article_title = $err_idnoexist;
$article_content = $err_idnoexist_text;
}
else{
// See if the adoptable actually exists...
$query = "SELECT * FROM ".$prefix."owned_adoptables WHERE owner='$loggedinname' and aid='$id'";
$result = runquery($query);
$num = mysql_numrows($result);
//Loop out code
$i=0;
while ($i < 1) {
$aid=@mysql_result($result,$i,"aid"); //The adoptable's ID
$currentlevel=@mysql_result($result,$i,"currentlevel");
$type=@mysql_result($result,$i,"type");
$name=@mysql_result($result,$i,"name");
$tradestatus=@mysql_result($result,$i,"tradestatus");
$father=@mysql_result($result,$i,"father");
$mother=@mysql_result($result,$i,"mother");
$lastbred=@mysql_result($result,$i,"lastbred");
$adultdescription=@mysql_result($result,$i,"adultdescription");
$i++;
}
// Check that the adoptable exists for real, or show an error...
if($aid == $id){
// The adoptable does exist, so we show the image and junk to the user...
$image = getcurrentimage($id);
$article_title = "Managing " . stripslashes($name);
$article_content = "
<div id='top' style='position: relative;'></div>
<div id='middle' style='position: relative;'><img src='".$image."'><br>
This page allows you to manage ".stripslashes($name).". Click on an option below to change settings.<br><br>
<b><a href='levelup.php?id=".$id."'>Level Up</a> Level up this creature to help it reach the next stage.<br>
<a href='myadopts.php?act=stats&id=".$id."'>Stats</a> Stats for your creature.<br>
<a href='myadopts.php?act=bbcode&id=".$id."'>Get BBCodes / HTML Codes</a> Use these codes to place ".stripslashes($name)." on other forums.<br>
<a href='myadopts.php?act=rename&id=".$id."'>Rename</a> Rename ".stripslashes($name).".<br>
<a href='myadopts.php?act=trade&id=".$id."'>Change Trade Status</a> Change ".stripslashes($name)."'s trade status to notfortrade or fortrade.<br>";
if($currentlevel == '0') {
$article_content .= "Freeze (You can not freeze eggs.)<br>";
} else if($currentlevel == '1') {
$article_content .= "Freeze (You can not freeze eggs.)<br>";
} else if($currentlevel == '2') {
$article_content .= "Freeze (You can not freeze eggs.)<br>";
} else if($currentlevel == '3') {
$article_content .= "Freeze (You can not freeze eggs.)<br>";
} else if($currentlevel == '5') {
$article_content .= "Freeze (You can not freeze adults.)<br>";
} else {
$article_content .= "<a href='myadopts.php?act=freeze&id=".$id."'>Freeze</a> This action can NOT be undone.<br>";
}
$article_content .= "<a href='myadopts.php?act=pound&id=".$id."'>Abandon</a> Abandon ".stripslashes($name)." and allow it to fend for itself.</b><br></div>";
}
else{
$article_title = $err_idnoexist;
$article_content = $err_idnoexist_text;
}
}
} // End the MANAGE action code
else if($act == "stats"){
// We are getting the stats for the adoptable
// Check that an ID was submitted...
if(is_numeric($id)){
// Now we see if the adoptable actually exists...
$query = "SELECT * FROM ".$prefix."owned_adoptables as o LEFT JOIN ".$prefix."adoptables as a on o.type=a.type WHERE owner='$loggedinname' and aid='$id'";
$result = runquery($query);
$num = mysql_numrows($result);
//Loop out code
$i=0;
while ($i < 1) {
$aid=@mysql_result($result,$i,"aid"); //The adoptable's ID
$currentlevel=@mysql_result($result,$i,"currentlevel");
$type=@mysql_result($result,$i,"type");
$owner=@mysql_result($result,$i,"owner");
$name=@mysql_result($result,$i,"name");
$totalclicks=@mysql_result($result,$i,"totalclicks");
$gender=@mysql_result($result,$i,"gender");
$lastbred=@mysql_result($result,$i,"lastbred");
$isfrozen=@mysql_result($result,$i,"isfrozen");
$tradestatus=@mysql_result($result,$i,"tradestatus");
$father=@mysql_result($result,$i,"father");
$mother=@mysql_result($result,$i,"mother");
$getFather = mysql_query('SELECT `name`
FROM ' . $prefix . 'owned_adoptables
WHERE `aid` = ' . $father
);
$getMother = mysql_query('SELECT `name`
FROM ' . $prefix . 'owned_adoptables
WHERE `aid` = ' . $mother
);
$nFather = mysql_fetch_assoc($getFather);
$nFather = $nFather['name'];
$nMother = mysql_fetch_assoc($getMother);
$nMother = $nMother['name'];
$adultdescription=@mysql_result($result,$i,"adultdescription");
$eggdesc=@mysql_result($result,$i,"eggdesc");
$foxdesc=@mysql_result($result,$i,"foxdesc");
$date=@mysql_result($result,$i,"date");
$i++;
}
if($aid == $id){
// The adoptable exists, so we show the stats for it...
$image = getcurrentimage($id);
$nextlevelexists = getnextlevelexists($type, $currentlevel);
$nextlevel = "";
// If a higher level exists, get that level's information...
if($nextlevelexists == "true"){
$nextlevel = $currentlevel + 1;
$query = "SELECT * FROM ".$prefix."levels WHERE adoptiename='$type' and thisislevel='$nextlevel'";
$result = runquery($query);
$num = mysql_numrows($result);
$i=0;
while ($i < 1) {
$requiredclicks=@mysql_result($result,$i,"requiredclicks"); //The adoptable's ID
$i++;
}
} // End grab next level info...
// Determine what to show for next level:
if($nextlevelexists == "true" and $nextlevel != ""){
// See how many more clicks to go
$ctg = $requiredclicks - totalclicks;
$nloutput = $nextlevel."<br>Clicks Required for Level Increase: ".$ctg;
}
else{
$nloutput = "This adoptable is at its maximum level";
}
$article_content = "
<div style='height:100%; background: #1f1f1f url(http://silvadopts.com/forums/public/style_images/animate/box_pattern.png) repeat;
color: #fff;
border: 1px solid #282828;
border-top: 1px solid #363636;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
padding: 5px;'>Click the adopt to level it up!<table class='den' width='100%'><tr><td>
<br>
<a href='levelup.php?id=".$id."'><img src='".$image."' style='margin: 0px auto; display: block'></a><br>
<div class='vgroup'>
<a href='myadopts.php?act=manage&id=".$id."'>Actions</a><br>
Name: ".stripslashes($name)."<br>";
if($father == "0") {
$article_content .= 'Caught On:';
} else {
$article_content .= 'Laid On:';
}
$article_content .= "
$date<br>
For Trade: ".$tradestatus."<br>
Current Level: ".$currentlevel."<br>
Next Level: ".$nloutput."<br>
<b>Total Clicks: ".$totalclicks."</b><br></div>
<div class='vgroup'>
Owner: <a href='http://silvadopts.com/profile.php?user=".$owner."'>$owner</a><br>
Gender: ";
if($gender == 'm') {
$article_content .= 'Male ';
} else {
$article_content .= 'Female ';
}
if($isfrozen == 'no') {
$article_content .= '<br>';
} else {
$article_content .= '<img src=\'http://inky.org/rpg/agents-maps/snowflake.png\'><br> ';
}
if($nFather == '' && $nMother == '') {
$article_content .= '';
} else {
$article_content .= 'Father: ' . $nFather . '<br>
Mother: ' . $nMother . '<br>';
}
$article_content .= '
<a href="http://silvadopts.com/familytree.php?aid='.$aid.'">View Lineage</a><br>';
if($lastbred == '') {
$article_content .= '';
}
else if($lastbred == '0') {
$article_content .= '';
} else {
$article_content .= 'Last bred: '.date('M j, Y', $lastbred).'<br>
Children: (<i>This feature is not yet available</i>)<br>';
}
$article_content .= "<br><br><br><br><br><br></div>";
if($currentlevel == '0') {
$article_content .= "$eggdesc";
}
elseif($currentlevel == '1') {
$article_content .= "$eggdesc";
}
elseif($currentlevel == '2') {
$article_content .= "$eggdesc";
}
elseif($currentlevel == '3') {
$article_content .= "$eggdesc";
}
elseif($currentlevel == '4') {
$article_content .= "$foxdesc";
}
elseif($currentlevel >= '5') {
$article_content .= "$adultdescription";
}
$article_content .="<br><br>";
if($type == 'Red Stitch Silvfox') {
$article_content .='Artist: Switch';
} else if($type == 'Eventide Silvfox') {
$article_content .='Artist: Switch';
} else if($type == 'White Stitch Silvfox') {
$article_content .='Artist: Switch';
} else if($type == 'The Noctis Silvfox') {
$article_content .='Artist: Switch';
} else if($type == 'Gold Silvfox') {
$article_content .='Artist: Switch, Roconza';
} else if($type == 'Inferno Silvfox') {
$article_content .='Artist: Switch, Roconza';
} else if($type == 'The Marauder Silvfox') {
$article_content .='Artist: Switch';
} else if($type == 'Switch Silvfox') {
$article_content .='Artist: Switch';
} else if($type == 'Arctic Silvfox') {
$article_content .='Artist: Switch';
} else if($type == 'Zebra Silvfox') {
$article_content .='Artist: Isura';
} else if($type == 'Tiger Silvfox') {
$article_content .='Artist: Isura';
} else if($type == 'Heat Element Silvfox') {
$article_content .='Artist: Isura';
} else if($type == 'Magic Element Silvfox') {
$article_content .='Artist: Isura';
} else if($type == 'Grass Element Silvfox') {
$article_content .='Artist: Isura';
} else if($type == 'Water Element Silvfox') {
$article_content .='Artist: Isura';
} else if($type == 'Yellow Winged Silvfox') {
$article_content .='Artist: Isura';
} else if($type == 'Blue Winged Silvfox') {
$article_content .='Artist: Isura';
} else if($type == 'Teal Winged Silvfox') {
$article_content .='Artist: Isura';
} else if($type == 'Orange Winged Silvfox') {
$article_content .='Artist: Isura';
} else if($type == 'Dark Winged Silvfox') {
$article_content .='Artist: Isura';
} else if($type == 'The Forest Silvfox') {
$article_content .='Artist: Switch, Roconza, SilverDragonTears';
} else if($type == 'The Gremlin Silvfox') {
$article_content .='Artist: Switch, Roconza, Beachbeagle';
} else if($type == 'Rainbow Silvfox') {
$article_content .='Artist: Switch, SilverDragonTears';
} else if($type == 'Redd Silvfox') {
$article_content .='Artist: Duzlla';
} else if($type == 'Graven Silvfox') {
$article_content .='Artist: Duzlla';
} else if($type == 'Fairie Silvfox') {
$article_content .='Artist: Duzlla';
} else if($type == 'GreenTipped Silvfox') {
$article_content .='Artist: GoldenShadowFire';
} else if($type == 'Marauder Red Silvfox') {
$article_content .='Artist: Switch, SilverDragonTears';
} else if($type == 'Snow Owl') {
$article_content .='Artist: elfhome';
} else if($type == 'The Lichen Silvfox') {
$article_content .='Artist: albinosilver';
} else if($type == 'Day Dream Silvfox') {
$article_content .='Artist: SilverDragonTears';
} else if($type == 'Sapphire Golem Silvfox') {
$article_content .='Artist: Isura';
} else if($type == 'Brass Golem Silvfox') {
$article_content .='Artist: Isura';
} else if($type == 'Hellfire Golem Silvfox') {
$article_content .='Artist: Isura';
} else if($type == 'Raven') {
$article_content .='Artist: SilverDragonTears, albinosilver';
}
$article_content .="
</td></tr></table></div>";
}
else{
$article_title = $err_idnoexist;
$article_content = $err_idnoexist_text;
}
}
else{
$article_title = $err_idnoexist;
$article_content = $err_idnoexist_text;
}
}
// End the STATS code
else if($act == "bbcode"){
if(is_numeric($id)){
// Now we see if the adoptable actually exists...
$query = "SELECT * FROM ".$prefix."owned_adoptables WHERE owner='$loggedinname' and aid='$id'";
$result = runquery($query);
$num = mysql_numrows($result);
//Loop out code
$i=0;
while ($i < 1) {
$aid=@mysql_result($result,$i,"aid"); //The adoptable's ID
$currentlevel=@mysql_result($result,$i,"currentlevel");
$type=@mysql_result($result,$i,"type");
$name=@mysql_result($result,$i,"name");
$totalclicks=@mysql_result($result,$i,"totalclicks");
$isfrozen=@mysql_result($result,$i,"isfrozen");
$i++;
}
if($aid == $id){
$altbb = grabanysetting("usealtbbcode");
// Adoptable exists, so show the BBCode:
$article_title = "Codes for ".stripslashes($name);
$article_content = $lang_bbcode_explain."<br>
<p><u>Forum Codes / BBCode: </u></p>
<p>
<textarea name='textarea' cols='50' rows='4'>http://www.".$domain."".$scriptpath."/siggy.php?id=".$aid." (http://www.".$domain."".$scriptpath."/levelup.php?id=".$aid.")
</textarea>
</p>";
if($altbb == "yes"){
// Use the seo friendly alternate bbcodes...
$article_content = $article_content."<p><u>Alternate BBCodes (Use if the above do not work on a forum): </u></p>
<p>
<textarea name='textarea' cols='50' rows='4'>http://www.".$domain."".$scriptpath."/get/".$aid.".gif (http://www.".$domain."".$scriptpath."/levelup.php?id=".$aid.")
</textarea>
</p>";
}
$article_content = $article_content."<p><u>HTML Code</u>:</p>
<p>
<textarea name='textarea' cols='50' rows='4'><a href=\"http://www.".$domain."".$scriptpath."/levelup.php?id=".$aid."\" target=\"_blank\">
<img src=\"http://www.".$domain."".$scriptpath."/siggy.php?id=".$aid."\" border=0></a>
</textarea>
</p>";
}
else{
$article_title = $err_idnoexist;
$article_content = $err_idnoexist_text;
}
}
else{
$article_title = $err_idnoexist;
$article_content = $err_idnoexist_text;
}
} // End the BBCODE generation for the adoptable...
else if($act == "rename"){
// We are renaming an adoptable
if(is_numeric($id)){
// Now we see if the adoptable actually exists...
$query = "SELECT * FROM ".$prefix."owned_adoptables WHERE owner='$loggedinname' and aid='$id'";
$result = runquery($query);
$num = mysql_numrows($result);
//Loop out code
$i=0;
while ($i < 1) {
$aid=@mysql_result($result,$i,"aid"); //The adoptable's ID
$currentlevel=@mysql_result($result,$i,"currentlevel");
$type=@mysql_result($result,$i,"type");
$name=@mysql_result($result,$i,"name");
$totalclicks=@mysql_result($result,$i,"totalclicks");
$isfrozen=@mysql_result($result,$i,"isfrozen");
$i++;
}
if($aid == $id){
$image = getcurrentimage($id);
if($more == ""){
$article_title = "Rename ".stripslashes($name);
$article_content = "<img src='".$image."'><br>".$lang_rename."".stripslashes($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{
$article_title = $err_idnoexist;
$article_content = $err_idnoexist_text;
}
}
else{
$article_title = $err_idnoexist;
$article_content = $err_idnoexist_text;
}
}
else if($act == "trade"){
// We are setting the trade status for an adoptable...
if(is_numeric($id)){
// Now we see if the adoptable actually exists...
$query = "SELECT * FROM ".$prefix."owned_adoptables WHERE owner='$loggedinname' and aid='$id'";
$result = mysql_query($query);
$num = mysql_numrows($result);
//Loop out code
$i=0;
while ($i < 1) {
$aid=@mysql_result($result,$i,"aid"); //The adoptable's ID
$tradestatus=@mysql_result($result,$i,"tradestatus");
$i++;
}
if($aid == $id){
$image = getcurrentimage($id); // Get the image for the adopt...
if($more == ""){
$article_title = "Setting trade status for ".stripslashes($name);
$article_content = "Are you sure you wish to change the trade status of this adoptable?<center><b><a href='myadopts.php?act=trade&id=".$id."&more=confirm'>Yes I'd like to change its trade status</a></b><br><br>
<b><a href='myadopts.php'>Nope I change my mind! Go back to the previous page.</a></b></center><br>";
}
else if($more == "confirm"){
if($tradestatus == "fortrade"){
$newtradestatus = "notfortrade";
$query = "UPDATE ".$prefix."owned_adoptables SET tradestatus='".$newtradestatus."' WHERE aid='".$id."' and owner='".$loggedinname."'";
runquery($query);
$article_title = "Change trade status successfully";
$article_content = "The adoptable's trade status is now Not for Trade";
}
else if($tradestatus == "notfortrade"){
$newtradestatus = "fortrade";
$query = "UPDATE ".$prefix."owned_adoptables SET tradestatus='".$newtradestatus."' WHERE aid='".$id."' and owner='".$loggedinname."'";
runquery($query);
$article_title = "Change trade status successfully";
$article_content = "The adoptable's trade status is now For Trade";
}
else{
$article_title = "Something is very very wrong";
$article_content = "Please check phpmyadmin to see if the settings are correct, or report your issue to Mysidia Adoptables support forum";
}
}
else{
$article_title = "Invalid Action";
$article_content = "Invalid Action Specified";
}
}
else{
$article_title = $err_idnoexist;
$article_content = $err_idnoexist;
}
}
else{
$article_title = $err_idnoexist;
$article_content = $err_idnoexist_text;
}
}
else if($act == "freeze"){
// We are freezing an adoptable here...
if(is_numeric($id)){
// Now we see if the adoptable actually exists...
$query = "SELECT * FROM ".$prefix."owned_adoptables WHERE owner='$loggedinname' and aid='$id'";
$result = runquery($query);
$num = mysql_numrows($result);
//Loop out code
$i=0;
while ($i < 1) {
$aid=@mysql_result($result,$i,"aid"); //The adoptable's ID
$currentlevel=@mysql_result($result,$i,"currentlevel");
$type=@mysql_result($result,$i,"type");
$name=@mysql_result($result,$i,"name");
$totalclicks=@mysql_result($result,$i,"totalclicks");
$isfrozen=@mysql_result($result,$i,"isfrozen");
$i++;
}
if($aid == $id){
$image = getcurrentimage($id); // Get the image for the adopt...
if($more == ""){
if($isfrozen == "yes"){
$group = getgroup();
$cancp = cancp($group);
if($cancp == "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/freeze.gif'> Frozen<br>";
$go = "You are not allowed to unfreeze this adoptable. <a href='javascript:history.go(-1)'>Click here to go back.</a>";
}
}
else if($isfrozen == "no"){
$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>".stripslashes($name)."'s Current Status: ".$status."</b><br>".$lang_freeze."<br><br><b>".$go."</b><br><br>
".$lang_freeze_warning."";
}
else{
// We are actually freezing or unfreezing the adopt...
$frz = "no";
if($more == "freeze"){
$frz = "yes";
}
$query = "UPDATE ".$prefix."owned_adoptables SET isfrozen='".$frz."' WHERE aid='".$id."' and owner='".$loggedinname."'";
runquery($query);
if($frz == "yes"){
$article_title = stripslashes($name)." Frozen Successfully";
}
else{
$article_title = stripslashes($name)." Unfrozen Successfully";
}
$article_content = stripslashes($name)." is now frozen. You may now manage ".stripslashes($name)." on the <a href='myadopts.php?act=manage&id=".$id."'>My Adopts</a> page.";
}
}
else{
$article_title = $err_idnoexist;
$article_content = $err_idnoexist_text;
}
}
else{
$article_title = $err_idnoexist;
$article_content = $err_idnoexist_text;
}
}
else if($act == "pound"){
if(is_numeric($id)){
// Now we see if the adoptable actually exists...
$query = "SELECT * FROM ".$prefix."owned_adoptables WHERE owner='$loggedinname' and aid='$id'";
$result = runquery($query);
$num = mysql_numrows($result);
//Loop out code
$i=0;
while ($i < 1) {
$aid=@mysql_result($result,$i,"aid"); //The adoptable's ID
$currentlevel=@mysql_result($result,$i,"currentlevel");
$type=@mysql_result($result,$i,"type");
$name=@mysql_result($result,$i,"name");
$totalclicks=@mysql_result($result,$i,"totalclicks");
$isfrozen=@mysql_result($result,$i,"isfrozen");
$i++;
}
if($aid == $id){
$image = getcurrentimage($id); // Get the image for the adopt...
if($more == ""){
$article_title = "Abandon ".stripslashes($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> Abandon ".stripslashes($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 Abandon ".stripslashes($name)."! <img src='templates/icons/yes.gif' border=0></a></b></center><br>";
}
else if($more == "confirm"){
// Actually run the execution
$query = "UPDATE ".$prefix."owned_adoptables SET owner='SYSTEM' WHERE aid='".$id."'";
runquery($query);
$article_title = $lang_pound_title_complete;
$article_content = $lang_pound_complete;
}
else{
$article_title = "Invalid Action";
$article_content = "Invalid Action Specified";
}
}
else{
$article_title = $err_idnoexist;
$article_content = $err_idnoexist_text;
}
}
else{
$article_title = $err_idnoexist;
$article_content = $err_idnoexist_text;
}
}
else{
// No valid action specified :: show an error
$article_title = $lang_invalid_action_title;
$article_content = $lang_invalid_action;
}
}
else{
$article_title = $accden;
$article_content = $reqlogin;
} // End is logged in check else
//***************//
// OUTPUT PAGE //
//***************//
echo showpage($article_title, $article_content, $date);
?>
SilverDragonTears
08-29-2011, 02:04 PM
no it just turned my table black. link still not clickable =/
fadillzzz
08-29-2011, 02:10 PM
Sorry made a typo
Can you try again?
<?php
include("inc/functions.php");
//***************//
// START SCRIPT //
//***************//
$id = $_GET["id"];
$act = $_GET["act"];
$more = $_GET["more"];
if($isloggedin == "yes"){
if($act == ""){
$article_content .= "
<div style='width: 100%; float:left; padding:5px;'><img src='http://www.v-adoptables.com/core/images/icons/small/coins.png'> {$GLOBALS['money']}</div><br>";
$article_content .="<br>
<center>
<div style='width: 32%; float: left;'><a href='trade.php'>Trade</a><br>
<a href='breeding.php'>Breed</a><br>
<a href='embed.php'>Embed All</a></div>
<div style='width: 32%; float: left;'><a href='account.php'>Account Settings</a><br>
<a href='profile.php'>Members List</a><br>
<a href='logout.php'>Log Out</a></div>
<div style='width: 32%; float: left;'><a href='donate.php'>Donate to Friends</a><br>
<a href='sort.php'>Sort Adopts</a></div></center>
<p id='activate_sort'>
Click here to sort your adoptables
</p>
<br>
<br>
<br>
<br>
Share this link with others to show them your Den<br>
<input type='text' size='100' value='http://silvadopts.com/profile.php?user=$loggedinname'><br>
<a href='http://silvadopts.com/profile.php?user=$loggedinname'>http://silvadopts.com/profile.php?user=$loggedinname</a><br>";
$article_content .= "<div style='height:100%; background: #1f1f1f url(http://silvadopts.com/forums/public/style_images/animate/box_pattern.png) repeat;
color: #fff;
border: 1px solid #282828;
border-top: 1px solid #363636;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
padding: 5px;'><center>Your Den</center><br><br><table style='width: 100%;' class='vamid'><tbody>
<tr><th>SilvA Fox</th><th>Name</th><th>Level</th><th>Manage</th><th>Get Codes</th><th>Clicks</th></tr></tbody></table><table id='sortable_adoptables' class='vamid' style='width: 100%;'><tbody>";
// We need to get all of the user's adoptables from the database and display them...
/* $query = "SELECT * FROM ".$prefix."owned_adoptables, ".$prefix."levels WHERE ".$prefix."owned_adoptables.owner = '{$loggedinname}'"
." AND ".$prefix."owned_adoptables.type = ".$prefix."owned_adoptables.type AND ".$prefix."levels.thisislevel = ".$prefix."owned_adoptables.currentlevel AND ".$prefix."levels.adoptiename = "
.$prefix."owned_adoptables.type ORDER BY ".$prefix."owned_adoptables.sort, ".$prefix."owned_adoptables.totalclicks";
*/
$query = " SELECT *
FROM {$prefix}owned_adoptables
LEFT JOIN {$prefix}sort_adoptables
ON {$prefix}owned_adoptables.aid = {$prefix}sort_adoptables.adoptable_id
INNER JOIN {$prefix}levels
ON {$prefix}levels.thisislevel = {$prefix}owned_adoptables.currentlevel
INNER JOIN {$prefix}adoptables
ON {$prefix}owned_adoptables.type = {$prefix}adoptables.type
WHERE {$prefix}owned_adoptables.owner = '{$loggedinname}'
AND {$prefix}levels.adoptiename = {$prefix}adoptables.type
ORDER BY {$prefix}sort_adoptables.sorting_id";
$result = runquery($query);
$num = mysql_numrows($result);
//Loop out code
$i=0;
while ($i < $num) {
$aid=@mysql_result($result,$i, $prefix."owned_adoptables.aid");
$currentlevel=@mysql_result($result,$i, $prefix."owned_adoptables.currentlevel");
$gender=@mysql_result($result,$i, $prefix."owned_adoptables.gender");
$isfrozen=@mysql_result($result,$i, $prefix."owned_adoptables.isfrozen");
$type=@mysql_result($result,$i, $prefix."owned_adoptables.type");
$name=@mysql_result($result,$i, $prefix."owned_adoptables.name");
$eggimage=@mysql_result($result,$i, $prefix."adoptables.eggimage");
$usealternates=@mysql_result($result,$i, $prefix."owned_adoptables.usealternates");
$totalclicks=@mysql_result($result,$i, $prefix."owned_adoptables.totalclicks");
$primaryimage=@mysql_result($result,$i, $prefix."levels.primaryimage");
$alternateimage=@mysql_result($result,$i, $prefix."levels.alternateimage");
if ($usealternates=='yes') { $image = $alternateimage; }
else { $image = $primaryimage; }
if ($currentlevel==0) { $image = $eggimage; }
if ($image=='') { $image = $primaryimage; }
$article_content .= "<tr><td><a href='myadopts.php?act=stats&id=".$aid."'><img src='$image'></a></td><td>";
if($isfrozen == 'no') {
$article_content .= '';
} else {
$article_content .= '<img src=\'http://inky.org/rpg/agents-maps/snowflake.png\'>';
}
$article_content .= "<img src='picuploads/{$gender}.png'> <em><em>".stripslashes($name)."</em></em></td><td>{$currentlevel}</td><td><a href='myadopts.php?act=manage&id={$aid}'>Actions</a></td><td><a href='myadopts.php?act=bbcode&id={$aid}'>Get Codes</a></td><td>{$totalclicks}</td></tr>";
$i++;
}
$article_content .= "</tbody></table></div>";
}
else if($act == "manage"){
// We are managing a specific adoptable
if($id == "" or !is_numeric($id)){
$article_title = $err_idnoexist;
$article_content = $err_idnoexist_text;
}
else{
// See if the adoptable actually exists...
$query = "SELECT * FROM ".$prefix."owned_adoptables WHERE owner='$loggedinname' and aid='$id'";
$result = runquery($query);
$num = mysql_numrows($result);
//Loop out code
$i=0;
while ($i < 1) {
$aid=@mysql_result($result,$i,"aid"); //The adoptable's ID
$currentlevel=@mysql_result($result,$i,"currentlevel");
$type=@mysql_result($result,$i,"type");
$name=@mysql_result($result,$i,"name");
$tradestatus=@mysql_result($result,$i,"tradestatus");
$father=@mysql_result($result,$i,"father");
$mother=@mysql_result($result,$i,"mother");
$lastbred=@mysql_result($result,$i,"lastbred");
$adultdescription=@mysql_result($result,$i,"adultdescription");
$i++;
}
// Check that the adoptable exists for real, or show an error...
if($aid == $id){
// The adoptable does exist, so we show the image and junk to the user...
$image = getcurrentimage($id);
$article_title = "Managing " . stripslashes($name);
$article_content = "
<div id='top' style='position: relative;'></div>
<div id='middle' style='position: relative;'><img src='".$image."'><br>
This page allows you to manage ".stripslashes($name).". Click on an option below to change settings.<br><br>
<b><a href='levelup.php?id=".$id."'>Level Up</a> Level up this creature to help it reach the next stage.<br>
<a href='myadopts.php?act=stats&id=".$id."'>Stats</a> Stats for your creature.<br>
<a href='myadopts.php?act=bbcode&id=".$id."'>Get BBCodes / HTML Codes</a> Use these codes to place ".stripslashes($name)." on other forums.<br>
<a href='myadopts.php?act=rename&id=".$id."'>Rename</a> Rename ".stripslashes($name).".<br>
<a href='myadopts.php?act=trade&id=".$id."'>Change Trade Status</a> Change ".stripslashes($name)."'s trade status to notfortrade or fortrade.<br>";
if($currentlevel == '0') {
$article_content .= "Freeze (You can not freeze eggs.)<br>";
} else if($currentlevel == '1') {
$article_content .= "Freeze (You can not freeze eggs.)<br>";
} else if($currentlevel == '2') {
$article_content .= "Freeze (You can not freeze eggs.)<br>";
} else if($currentlevel == '3') {
$article_content .= "Freeze (You can not freeze eggs.)<br>";
} else if($currentlevel == '5') {
$article_content .= "Freeze (You can not freeze adults.)<br>";
} else {
$article_content .= "<a href='myadopts.php?act=freeze&id=".$id."'>Freeze</a> This action can NOT be undone.<br>";
}
$article_content .= "<a href='myadopts.php?act=pound&id=".$id."'>Abandon</a> Abandon ".stripslashes($name)." and allow it to fend for itself.</b><br></div>";
}
else{
$article_title = $err_idnoexist;
$article_content = $err_idnoexist_text;
}
}
} // End the MANAGE action code
else if($act == "stats"){
// We are getting the stats for the adoptable
// Check that an ID was submitted...
if(is_numeric($id)){
// Now we see if the adoptable actually exists...
$query = "SELECT * FROM ".$prefix."owned_adoptables as o LEFT JOIN ".$prefix."adoptables as a on o.type=a.type WHERE owner='$loggedinname' and aid='$id'";
$result = runquery($query);
$num = mysql_numrows($result);
//Loop out code
$i=0;
while ($i < 1) {
$aid=@mysql_result($result,$i,"aid"); //The adoptable's ID
$currentlevel=@mysql_result($result,$i,"currentlevel");
$type=@mysql_result($result,$i,"type");
$owner=@mysql_result($result,$i,"owner");
$name=@mysql_result($result,$i,"name");
$totalclicks=@mysql_result($result,$i,"totalclicks");
$gender=@mysql_result($result,$i,"gender");
$lastbred=@mysql_result($result,$i,"lastbred");
$isfrozen=@mysql_result($result,$i,"isfrozen");
$tradestatus=@mysql_result($result,$i,"tradestatus");
$father=@mysql_result($result,$i,"father");
$mother=@mysql_result($result,$i,"mother");
$getFather = mysql_query('SELECT `name`
FROM ' . $prefix . 'owned_adoptables
WHERE `aid` = ' . $father
);
$getMother = mysql_query('SELECT `name`
FROM ' . $prefix . 'owned_adoptables
WHERE `aid` = ' . $mother
);
$nFather = mysql_fetch_assoc($getFather);
$nFather = $nFather['name'];
$nMother = mysql_fetch_assoc($getMother);
$nMother = $nMother['name'];
$adultdescription=@mysql_result($result,$i,"adultdescription");
$eggdesc=@mysql_result($result,$i,"eggdesc");
$foxdesc=@mysql_result($result,$i,"foxdesc");
$date=@mysql_result($result,$i,"date");
$i++;
}
if($aid == $id){
// The adoptable exists, so we show the stats for it...
$image = getcurrentimage($id);
$nextlevelexists = getnextlevelexists($type, $currentlevel);
$nextlevel = "";
// If a higher level exists, get that level's information...
if($nextlevelexists == "true"){
$nextlevel = $currentlevel + 1;
$query = "SELECT * FROM ".$prefix."levels WHERE adoptiename='$type' and thisislevel='$nextlevel'";
$result = runquery($query);
$num = mysql_numrows($result);
$i=0;
while ($i < 1) {
$requiredclicks=@mysql_result($result,$i,"requiredclicks"); //The adoptable's ID
$i++;
}
} // End grab next level info...
// Determine what to show for next level:
if($nextlevelexists == "true" and $nextlevel != ""){
// See how many more clicks to go
$ctg = $requiredclicks - totalclicks;
$nloutput = $nextlevel."<br>Clicks Required for Level Increase: ".$ctg;
}
else{
$nloutput = "This adoptable is at its maximum level";
}
$article_content = "
<div style='height:100%; background: #1f1f1f url(http://silvadopts.com/forums/public/style_images/animate/box_pattern.png) repeat;
color: #fff;
border: 1px solid #282828;
border-top: 1px solid #363636;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
padding: 5px;'>Click the adopt to level it up!<table class='den' width='100%'><tr><td>
<br>
<a href='levelup.php?id=".$id."'><img src='".$image."' style='margin: 0px auto; display: block'></a><br>
<div class='vgroup'>
<a href='myadopts.php?act=manage&id=".$id."'>Actions</a><br>
Name: ".stripslashes($name)."<br>";
if($father == "0") {
$article_content .= 'Caught On:';
} else {
$article_content .= 'Laid On:';
}
$article_content .= "
$date<br>
For Trade: ".$tradestatus."<br>
Current Level: ".$currentlevel."<br>
Next Level: ".$nloutput."<br>
<b>Total Clicks: ".$totalclicks."</b><br></div>
<div class='vgroup'>
Owner: <a href='http://silvadopts.com/profile.php?user=".$owner."'>$owner</a><br>
Gender: ";
if($gender == 'm') {
$article_content .= 'Male ';
} else {
$article_content .= 'Female ';
}
if($isfrozen == 'no') {
$article_content .= '<br>';
} else {
$article_content .= '<img src=\'http://inky.org/rpg/agents-maps/snowflake.png\'><br> ';
}
if($nFather == '' && $nMother == '') {
$article_content .= '';
} else {
$article_content .= 'Father: ' . $nFather . '<br>
Mother: ' . $nMother . '<br>';
}
$article_content .= '
<a href="http://silvadopts.com/familytree.php?aid='.$aid.'">View Lineage</a><br>';
if($lastbred == '') {
$article_content .= '';
}
else if($lastbred == '0') {
$article_content .= '';
} else {
$article_content .= 'Last bred: '.date('M j, Y', $lastbred).'<br>
Children: (<i>This feature is not yet available</i>)<br>';
}
$article_content .= "<br><br><br><br><br><br></div>";
if($currentlevel == '0') {
$article_content .= "$eggdesc";
}
elseif($currentlevel == '1') {
$article_content .= "$eggdesc";
}
elseif($currentlevel == '2') {
$article_content .= "$eggdesc";
}
elseif($currentlevel == '3') {
$article_content .= "$eggdesc";
}
elseif($currentlevel == '4') {
$article_content .= "$foxdesc";
}
elseif($currentlevel >= '5') {
$article_content .= "$adultdescription";
}
$article_content .="<br><br>";
if($type == 'Red Stitch Silvfox') {
$article_content .='Artist: Switch';
} else if($type == 'Eventide Silvfox') {
$article_content .='Artist: Switch';
} else if($type == 'White Stitch Silvfox') {
$article_content .='Artist: Switch';
} else if($type == 'The Noctis Silvfox') {
$article_content .='Artist: Switch';
} else if($type == 'Gold Silvfox') {
$article_content .='Artist: Switch, Roconza';
} else if($type == 'Inferno Silvfox') {
$article_content .='Artist: Switch, Roconza';
} else if($type == 'The Marauder Silvfox') {
$article_content .='Artist: Switch';
} else if($type == 'Switch Silvfox') {
$article_content .='Artist: Switch';
} else if($type == 'Arctic Silvfox') {
$article_content .='Artist: Switch';
} else if($type == 'Zebra Silvfox') {
$article_content .='Artist: Isura';
} else if($type == 'Tiger Silvfox') {
$article_content .='Artist: Isura';
} else if($type == 'Heat Element Silvfox') {
$article_content .='Artist: Isura';
} else if($type == 'Magic Element Silvfox') {
$article_content .='Artist: Isura';
} else if($type == 'Grass Element Silvfox') {
$article_content .='Artist: Isura';
} else if($type == 'Water Element Silvfox') {
$article_content .='Artist: Isura';
} else if($type == 'Yellow Winged Silvfox') {
$article_content .='Artist: Isura';
} else if($type == 'Blue Winged Silvfox') {
$article_content .='Artist: Isura';
} else if($type == 'Teal Winged Silvfox') {
$article_content .='Artist: Isura';
} else if($type == 'Orange Winged Silvfox') {
$article_content .='Artist: Isura';
} else if($type == 'Dark Winged Silvfox') {
$article_content .='Artist: Isura';
} else if($type == 'The Forest Silvfox') {
$article_content .='Artist: Switch, Roconza, SilverDragonTears';
} else if($type == 'The Gremlin Silvfox') {
$article_content .='Artist: Switch, Roconza, Beachbeagle';
} else if($type == 'Rainbow Silvfox') {
$article_content .='Artist: Switch, SilverDragonTears';
} else if($type == 'Redd Silvfox') {
$article_content .='Artist: Duzlla';
} else if($type == 'Graven Silvfox') {
$article_content .='Artist: Duzlla';
} else if($type == 'Fairie Silvfox') {
$article_content .='Artist: Duzlla';
} else if($type == 'GreenTipped Silvfox') {
$article_content .='Artist: GoldenShadowFire';
} else if($type == 'Marauder Red Silvfox') {
$article_content .='Artist: Switch, SilverDragonTears';
} else if($type == 'Snow Owl') {
$article_content .='Artist: elfhome';
} else if($type == 'The Lichen Silvfox') {
$article_content .='Artist: albinosilver';
} else if($type == 'Day Dream Silvfox') {
$article_content .='Artist: SilverDragonTears';
} else if($type == 'Sapphire Golem Silvfox') {
$article_content .='Artist: Isura';
} else if($type == 'Brass Golem Silvfox') {
$article_content .='Artist: Isura';
} else if($type == 'Hellfire Golem Silvfox') {
$article_content .='Artist: Isura';
} else if($type == 'Raven') {
$article_content .='Artist: SilverDragonTears, albinosilver';
}
$article_content .="
</td></tr></table></div>";
}
else{
$article_title = $err_idnoexist;
$article_content = $err_idnoexist_text;
}
}
else{
$article_title = $err_idnoexist;
$article_content = $err_idnoexist_text;
}
}
// End the STATS code
else if($act == "bbcode"){
if(is_numeric($id)){
// Now we see if the adoptable actually exists...
$query = "SELECT * FROM ".$prefix."owned_adoptables WHERE owner='$loggedinname' and aid='$id'";
$result = runquery($query);
$num = mysql_numrows($result);
//Loop out code
$i=0;
while ($i < 1) {
$aid=@mysql_result($result,$i,"aid"); //The adoptable's ID
$currentlevel=@mysql_result($result,$i,"currentlevel");
$type=@mysql_result($result,$i,"type");
$name=@mysql_result($result,$i,"name");
$totalclicks=@mysql_result($result,$i,"totalclicks");
$isfrozen=@mysql_result($result,$i,"isfrozen");
$i++;
}
if($aid == $id){
$altbb = grabanysetting("usealtbbcode");
// Adoptable exists, so show the BBCode:
$article_title = "Codes for ".stripslashes($name);
$article_content = $lang_bbcode_explain."<br>
<p><u>Forum Codes / BBCode: </u></p>
<p>
<textarea name='textarea' cols='50' rows='4'>http://www.".$domain."".$scriptpath."/siggy.php?id=".$aid." (http://www.".$domain."".$scriptpath."/levelup.php?id=".$aid.")
</textarea>
</p>";
if($altbb == "yes"){
// Use the seo friendly alternate bbcodes...
$article_content = $article_content."<p><u>Alternate BBCodes (Use if the above do not work on a forum): </u></p>
<p>
<textarea name='textarea' cols='50' rows='4'>http://www.".$domain."".$scriptpath."/get/".$aid.".gif (http://www.".$domain."".$scriptpath."/levelup.php?id=".$aid.")
</textarea>
</p>";
}
$article_content = $article_content."<p><u>HTML Code</u>:</p>
<p>
<textarea name='textarea' cols='50' rows='4'><a href=\"http://www.".$domain."".$scriptpath."/levelup.php?id=".$aid."\" target=\"_blank\">
<img src=\"http://www.".$domain."".$scriptpath."/siggy.php?id=".$aid."\" border=0></a>
</textarea>
</p>";
}
else{
$article_title = $err_idnoexist;
$article_content = $err_idnoexist_text;
}
}
else{
$article_title = $err_idnoexist;
$article_content = $err_idnoexist_text;
}
} // End the BBCODE generation for the adoptable...
else if($act == "rename"){
// We are renaming an adoptable
if(is_numeric($id)){
// Now we see if the adoptable actually exists...
$query = "SELECT * FROM ".$prefix."owned_adoptables WHERE owner='$loggedinname' and aid='$id'";
$result = runquery($query);
$num = mysql_numrows($result);
//Loop out code
$i=0;
while ($i < 1) {
$aid=@mysql_result($result,$i,"aid"); //The adoptable's ID
$currentlevel=@mysql_result($result,$i,"currentlevel");
$type=@mysql_result($result,$i,"type");
$name=@mysql_result($result,$i,"name");
$totalclicks=@mysql_result($result,$i,"totalclicks");
$isfrozen=@mysql_result($result,$i,"isfrozen");
$i++;
}
if($aid == $id){
$image = getcurrentimage($id);
if($more == ""){
$article_title = "Rename ".stripslashes($name);
$article_content = "<img src='".$image."'><br>".$lang_rename."".stripslashes($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{
$article_title = $err_idnoexist;
$article_content = $err_idnoexist_text;
}
}
else{
$article_title = $err_idnoexist;
$article_content = $err_idnoexist_text;
}
}
else if($act == "trade"){
// We are setting the trade status for an adoptable...
if(is_numeric($id)){
// Now we see if the adoptable actually exists...
$query = "SELECT * FROM ".$prefix."owned_adoptables WHERE owner='$loggedinname' and aid='$id'";
$result = mysql_query($query);
$num = mysql_numrows($result);
//Loop out code
$i=0;
while ($i < 1) {
$aid=@mysql_result($result,$i,"aid"); //The adoptable's ID
$tradestatus=@mysql_result($result,$i,"tradestatus");
$i++;
}
if($aid == $id){
$image = getcurrentimage($id); // Get the image for the adopt...
if($more == ""){
$article_title = "Setting trade status for ".stripslashes($name);
$article_content = "Are you sure you wish to change the trade status of this adoptable?<center><b><a href='myadopts.php?act=trade&id=".$id."&more=confirm'>Yes I'd like to change its trade status</a></b><br><br>
<b><a href='myadopts.php'>Nope I change my mind! Go back to the previous page.</a></b></center><br>";
}
else if($more == "confirm"){
if($tradestatus == "fortrade"){
$newtradestatus = "notfortrade";
$query = "UPDATE ".$prefix."owned_adoptables SET tradestatus='".$newtradestatus."' WHERE aid='".$id."' and owner='".$loggedinname."'";
runquery($query);
$article_title = "Change trade status successfully";
$article_content = "The adoptable's trade status is now Not for Trade";
}
else if($tradestatus == "notfortrade"){
$newtradestatus = "fortrade";
$query = "UPDATE ".$prefix."owned_adoptables SET tradestatus='".$newtradestatus."' WHERE aid='".$id."' and owner='".$loggedinname."'";
runquery($query);
$article_title = "Change trade status successfully";
$article_content = "The adoptable's trade status is now For Trade";
}
else{
$article_title = "Something is very very wrong";
$article_content = "Please check phpmyadmin to see if the settings are correct, or report your issue to Mysidia Adoptables support forum";
}
}
else{
$article_title = "Invalid Action";
$article_content = "Invalid Action Specified";
}
}
else{
$article_title = $err_idnoexist;
$article_content = $err_idnoexist;
}
}
else{
$article_title = $err_idnoexist;
$article_content = $err_idnoexist_text;
}
}
else if($act == "freeze"){
// We are freezing an adoptable here...
if(is_numeric($id)){
// Now we see if the adoptable actually exists...
$query = "SELECT * FROM ".$prefix."owned_adoptables WHERE owner='$loggedinname' and aid='$id'";
$result = runquery($query);
$num = mysql_numrows($result);
//Loop out code
$i=0;
while ($i < 1) {
$aid=@mysql_result($result,$i,"aid"); //The adoptable's ID
$currentlevel=@mysql_result($result,$i,"currentlevel");
$type=@mysql_result($result,$i,"type");
$name=@mysql_result($result,$i,"name");
$totalclicks=@mysql_result($result,$i,"totalclicks");
$isfrozen=@mysql_result($result,$i,"isfrozen");
$i++;
}
if($aid == $id){
$image = getcurrentimage($id); // Get the image for the adopt...
if($more == ""){
if($isfrozen == "yes"){
$group = getgroup();
$cancp = cancp($group);
if($cancp == "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/freeze.gif'> Frozen<br>";
$go = "You are not allowed to unfreeze this adoptable. <a href='javascript:history.go(-1)'>Click here to go back.</a>";
}
}
else if($isfrozen == "no"){
$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>".stripslashes($name)."'s Current Status: ".$status."</b><br>".$lang_freeze."<br><br><b>".$go."</b><br><br>
".$lang_freeze_warning."";
}
else{
// We are actually freezing or unfreezing the adopt...
$frz = "no";
if($more == "freeze"){
$frz = "yes";
}
$query = "UPDATE ".$prefix."owned_adoptables SET isfrozen='".$frz."' WHERE aid='".$id."' and owner='".$loggedinname."'";
runquery($query);
if($frz == "yes"){
$article_title = stripslashes($name)." Frozen Successfully";
}
else{
$article_title = stripslashes($name)." Unfrozen Successfully";
}
$article_content = stripslashes($name)." is now frozen. You may now manage ".stripslashes($name)." on the <a href='myadopts.php?act=manage&id=".$id."'>My Adopts</a> page.";
}
}
else{
$article_title = $err_idnoexist;
$article_content = $err_idnoexist_text;
}
}
else{
$article_title = $err_idnoexist;
$article_content = $err_idnoexist_text;
}
}
else if($act == "pound"){
if(is_numeric($id)){
// Now we see if the adoptable actually exists...
$query = "SELECT * FROM ".$prefix."owned_adoptables WHERE owner='$loggedinname' and aid='$id'";
$result = runquery($query);
$num = mysql_numrows($result);
//Loop out code
$i=0;
while ($i < 1) {
$aid=@mysql_result($result,$i,"aid"); //The adoptable's ID
$currentlevel=@mysql_result($result,$i,"currentlevel");
$type=@mysql_result($result,$i,"type");
$name=@mysql_result($result,$i,"name");
$totalclicks=@mysql_result($result,$i,"totalclicks");
$isfrozen=@mysql_result($result,$i,"isfrozen");
$i++;
}
if($aid == $id){
$image = getcurrentimage($id); // Get the image for the adopt...
if($more == ""){
$article_title = "Abandon ".stripslashes($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> Abandon ".stripslashes($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 Abandon ".stripslashes($name)."! <img src='templates/icons/yes.gif' border=0></a></b></center><br>";
}
else if($more == "confirm"){
// Actually run the execution
$query = "UPDATE ".$prefix."owned_adoptables SET owner='SYSTEM' WHERE aid='".$id."'";
runquery($query);
$article_title = $lang_pound_title_complete;
$article_content = $lang_pound_complete;
}
else{
$article_title = "Invalid Action";
$article_content = "Invalid Action Specified";
}
}
else{
$article_title = $err_idnoexist;
$article_content = $err_idnoexist_text;
}
}
else{
$article_title = $err_idnoexist;
$article_content = $err_idnoexist_text;
}
}
else{
// No valid action specified :: show an error
$article_title = $lang_invalid_action_title;
$article_content = $lang_invalid_action;
}
}
else{
$article_title = $accden;
$article_content = $reqlogin;
} // End is logged in check else
//***************//
// OUTPUT PAGE //
//***************//
echo showpage($article_title, $article_content, $date);
?>
SilverDragonTears
08-29-2011, 02:13 PM
table black, no link. hehe
fadillzzz
08-29-2011, 02:14 PM
LOL...can you give me a test account so that I can try it myself?
I tried registering, but somehow it doesn't let me.
SilverDragonTears
08-29-2011, 02:19 PM
I think your mod glitched my register page... =/
I removed the part in functions.php and registering works now. i'll just leave that part out
fadillzzz
08-29-2011, 02:26 PM
Yeah it seems so...Sorry for that. I'll try to come up with a fix.
SilverDragonTears
08-29-2011, 02:42 PM
It's ok =) Isura is helping me with a tabbed sorting so that will work for now =)
fadillzzz
08-29-2011, 02:55 PM
First post updated:
Fixed a bug where the $_POST variable keys are modified. Files changed: inc/functions.php, ajax_sort.php
SilverDragonTears
08-29-2011, 04:11 PM
I'm getting very flustered. Still not working for me. I don't know what I'm doing wrong.
SilverDragonTears
08-29-2011, 04:26 PM
where is it calling the ajax_sort.php file?
Hall of Famer
08-29-2011, 04:48 PM
Well SDT, why dont you create a new ftp for Fadillzzz for him to test script on your site? You may delete it after he fixes the glitch.
SilverDragonTears
08-29-2011, 04:49 PM
he's gone, i think =(
Hall of Famer
08-29-2011, 04:52 PM
He will be back tomorrow I guess, it is not the time for Europeans to be online at 6pm EST. Send him a PM to discuss your situation if you want to.
fadillzzz
08-29-2011, 05:12 PM
Sorry SDT, it turns out I really did forget something while writing the instructions! Terribly sorry for that :(
I made another changes to your myadopts.php, not sure though if this will solve the problem. The mod kind of relying on the layout page (selecting elements)
<?php
include("inc/functions.php");
//***************//
// START SCRIPT //
//***************//
$id = $_GET["id"];
$act = $_GET["act"];
$more = $_GET["more"];
if($isloggedin == "yes"){
if($act == ""){
$article_content .= "
<div style='width: 100%; float:left; padding:5px;'><img src='http://www.v-adoptables.com/core/images/icons/small/coins.png'> {$GLOBALS['money']}</div><br>";
$article_content .="<br>
<center>
<div style='width: 32%; float: left;'><a href='trade.php'>Trade</a><br>
<a href='breeding.php'>Breed</a><br>
<a href='embed.php'>Embed All</a></div>
<div style='width: 32%; float: left;'><a href='account.php'>Account Settings</a><br>
<a href='profile.php'>Members List</a><br>
<a href='logout.php'>Log Out</a></div>
<div style='width: 32%; float: left;'><a href='donate.php'>Donate to Friends</a><br>
<a href='sort.php'>Sort Adopts</a></div></center>
<p id='activate_sort'>
Click here to sort your adoptables
</p>
<br>
<br>
<br>
<br>
Share this link with others to show them your Den<br>
<input type='text' size='100' value='http://silvadopts.com/profile.php?user=$loggedinname'><br>
<a href='http://silvadopts.com/profile.php?user=$loggedinname'>http://silvadopts.com/profile.php?user=$loggedinname</a><br>";
$article_content .= "<div style='height:100%; background: #1f1f1f url(http://silvadopts.com/forums/public/style_images/animate/box_pattern.png) repeat;
color: #fff;
border: 1px solid #282828;
border-top: 1px solid #363636;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
padding: 5px;'><center>Your Den</center><br><br><table style='width: 100%;' class='vamid'><tbody>
<tr><th>SilvA Fox</th><th>Name</th><th>Level</th><th>Manage</th><th>Get Codes</th><th>Clicks</th></tr></tbody></table><table id='sortable_adoptables' class='vamid' style='width: 100%;'><tbody>";
// We need to get all of the user's adoptables from the database and display them...
/* $query = "SELECT * FROM ".$prefix."owned_adoptables, ".$prefix."levels WHERE ".$prefix."owned_adoptables.owner = '{$loggedinname}'"
." AND ".$prefix."owned_adoptables.type = ".$prefix."owned_adoptables.type AND ".$prefix."levels.thisislevel = ".$prefix."owned_adoptables.currentlevel AND ".$prefix."levels.adoptiename = "
.$prefix."owned_adoptables.type ORDER BY ".$prefix."owned_adoptables.sort, ".$prefix."owned_adoptables.totalclicks";
*/
$query = " SELECT *
FROM {$prefix}owned_adoptables
LEFT JOIN {$prefix}sort_adoptables
ON {$prefix}owned_adoptables.aid = {$prefix}sort_adoptables.adoptable_id
INNER JOIN {$prefix}levels
ON {$prefix}levels.thisislevel = {$prefix}owned_adoptables.currentlevel
INNER JOIN {$prefix}adoptables
ON {$prefix}owned_adoptables.type = {$prefix}adoptables.type
WHERE {$prefix}owned_adoptables.owner = '{$loggedinname}'
AND {$prefix}levels.adoptiename = {$prefix}adoptables.type
ORDER BY {$prefix}sort_adoptables.sorting_id";
$result = runquery($query);
$num = mysql_numrows($result);
//Loop out code
$i=0;
while ($i < $num) {
$aid=@mysql_result($result,$i, $prefix."owned_adoptables.aid");
$currentlevel=@mysql_result($result,$i, $prefix."owned_adoptables.currentlevel");
$gender=@mysql_result($result,$i, $prefix."owned_adoptables.gender");
$isfrozen=@mysql_result($result,$i, $prefix."owned_adoptables.isfrozen");
$type=@mysql_result($result,$i, $prefix."owned_adoptables.type");
$name=@mysql_result($result,$i, $prefix."owned_adoptables.name");
$eggimage=@mysql_result($result,$i, $prefix."adoptables.eggimage");
$usealternates=@mysql_result($result,$i, $prefix."owned_adoptables.usealternates");
$totalclicks=@mysql_result($result,$i, $prefix."owned_adoptables.totalclicks");
$primaryimage=@mysql_result($result,$i, $prefix."levels.primaryimage");
$alternateimage=@mysql_result($result,$i, $prefix."levels.alternateimage");
if ($usealternates=='yes') { $image = $alternateimage; }
else { $image = $primaryimage; }
if ($currentlevel==0) { $image = $eggimage; }
if ($image=='') { $image = $primaryimage; }
$article_content .= "<tr id='orderaid_{$aid}'><td><a href='myadopts.php?act=stats&id=".$aid."'><img src='$image'></a></td><td>";
if($isfrozen == 'no') {
$article_content .= '';
} else {
$article_content .= '<img src=\'http://inky.org/rpg/agents-maps/snowflake.png\'>';
}
$article_content .= "<img src='picuploads/{$gender}.png'> <em><em>".stripslashes($name)."</em></em></td><td>{$currentlevel}</td><td><a href='myadopts.php?act=manage&id={$aid}'>Actions</a></td><td><a href='myadopts.php?act=bbcode&id={$aid}'>Get Codes</a></td><td>{$totalclicks}</td></tr>";
$i++;
}
$article_content .= "</tbody></table></div>";
}
else if($act == "manage"){
// We are managing a specific adoptable
if($id == "" or !is_numeric($id)){
$article_title = $err_idnoexist;
$article_content = $err_idnoexist_text;
}
else{
// See if the adoptable actually exists...
$query = "SELECT * FROM ".$prefix."owned_adoptables WHERE owner='$loggedinname' and aid='$id'";
$result = runquery($query);
$num = mysql_numrows($result);
//Loop out code
$i=0;
while ($i < 1) {
$aid=@mysql_result($result,$i,"aid"); //The adoptable's ID
$currentlevel=@mysql_result($result,$i,"currentlevel");
$type=@mysql_result($result,$i,"type");
$name=@mysql_result($result,$i,"name");
$tradestatus=@mysql_result($result,$i,"tradestatus");
$father=@mysql_result($result,$i,"father");
$mother=@mysql_result($result,$i,"mother");
$lastbred=@mysql_result($result,$i,"lastbred");
$adultdescription=@mysql_result($result,$i,"adultdescription");
$i++;
}
// Check that the adoptable exists for real, or show an error...
if($aid == $id){
// The adoptable does exist, so we show the image and junk to the user...
$image = getcurrentimage($id);
$article_title = "Managing " . stripslashes($name);
$article_content = "
<div id='top' style='position: relative;'></div>
<div id='middle' style='position: relative;'><img src='".$image."'><br>
This page allows you to manage ".stripslashes($name).". Click on an option below to change settings.<br><br>
<b><a href='levelup.php?id=".$id."'>Level Up</a> Level up this creature to help it reach the next stage.<br>
<a href='myadopts.php?act=stats&id=".$id."'>Stats</a> Stats for your creature.<br>
<a href='myadopts.php?act=bbcode&id=".$id."'>Get BBCodes / HTML Codes</a> Use these codes to place ".stripslashes($name)." on other forums.<br>
<a href='myadopts.php?act=rename&id=".$id."'>Rename</a> Rename ".stripslashes($name).".<br>
<a href='myadopts.php?act=trade&id=".$id."'>Change Trade Status</a> Change ".stripslashes($name)."'s trade status to notfortrade or fortrade.<br>";
if($currentlevel == '0') {
$article_content .= "Freeze (You can not freeze eggs.)<br>";
} else if($currentlevel == '1') {
$article_content .= "Freeze (You can not freeze eggs.)<br>";
} else if($currentlevel == '2') {
$article_content .= "Freeze (You can not freeze eggs.)<br>";
} else if($currentlevel == '3') {
$article_content .= "Freeze (You can not freeze eggs.)<br>";
} else if($currentlevel == '5') {
$article_content .= "Freeze (You can not freeze adults.)<br>";
} else {
$article_content .= "<a href='myadopts.php?act=freeze&id=".$id."'>Freeze</a> This action can NOT be undone.<br>";
}
$article_content .= "<a href='myadopts.php?act=pound&id=".$id."'>Abandon</a> Abandon ".stripslashes($name)." and allow it to fend for itself.</b><br></div>";
}
else{
$article_title = $err_idnoexist;
$article_content = $err_idnoexist_text;
}
}
} // End the MANAGE action code
else if($act == "stats"){
// We are getting the stats for the adoptable
// Check that an ID was submitted...
if(is_numeric($id)){
// Now we see if the adoptable actually exists...
$query = "SELECT * FROM ".$prefix."owned_adoptables as o LEFT JOIN ".$prefix."adoptables as a on o.type=a.type WHERE owner='$loggedinname' and aid='$id'";
$result = runquery($query);
$num = mysql_numrows($result);
//Loop out code
$i=0;
while ($i < 1) {
$aid=@mysql_result($result,$i,"aid"); //The adoptable's ID
$currentlevel=@mysql_result($result,$i,"currentlevel");
$type=@mysql_result($result,$i,"type");
$owner=@mysql_result($result,$i,"owner");
$name=@mysql_result($result,$i,"name");
$totalclicks=@mysql_result($result,$i,"totalclicks");
$gender=@mysql_result($result,$i,"gender");
$lastbred=@mysql_result($result,$i,"lastbred");
$isfrozen=@mysql_result($result,$i,"isfrozen");
$tradestatus=@mysql_result($result,$i,"tradestatus");
$father=@mysql_result($result,$i,"father");
$mother=@mysql_result($result,$i,"mother");
$getFather = mysql_query('SELECT `name`
FROM ' . $prefix . 'owned_adoptables
WHERE `aid` = ' . $father
);
$getMother = mysql_query('SELECT `name`
FROM ' . $prefix . 'owned_adoptables
WHERE `aid` = ' . $mother
);
$nFather = mysql_fetch_assoc($getFather);
$nFather = $nFather['name'];
$nMother = mysql_fetch_assoc($getMother);
$nMother = $nMother['name'];
$adultdescription=@mysql_result($result,$i,"adultdescription");
$eggdesc=@mysql_result($result,$i,"eggdesc");
$foxdesc=@mysql_result($result,$i,"foxdesc");
$date=@mysql_result($result,$i,"date");
$i++;
}
if($aid == $id){
// The adoptable exists, so we show the stats for it...
$image = getcurrentimage($id);
$nextlevelexists = getnextlevelexists($type, $currentlevel);
$nextlevel = "";
// If a higher level exists, get that level's information...
if($nextlevelexists == "true"){
$nextlevel = $currentlevel + 1;
$query = "SELECT * FROM ".$prefix."levels WHERE adoptiename='$type' and thisislevel='$nextlevel'";
$result = runquery($query);
$num = mysql_numrows($result);
$i=0;
while ($i < 1) {
$requiredclicks=@mysql_result($result,$i,"requiredclicks"); //The adoptable's ID
$i++;
}
} // End grab next level info...
// Determine what to show for next level:
if($nextlevelexists == "true" and $nextlevel != ""){
// See how many more clicks to go
$ctg = $requiredclicks - totalclicks;
$nloutput = $nextlevel."<br>Clicks Required for Level Increase: ".$ctg;
}
else{
$nloutput = "This adoptable is at its maximum level";
}
$article_content = "
<div style='height:100%; background: #1f1f1f url(http://silvadopts.com/forums/public/style_images/animate/box_pattern.png) repeat;
color: #fff;
border: 1px solid #282828;
border-top: 1px solid #363636;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
padding: 5px;'>Click the adopt to level it up!<table class='den' width='100%'><tr><td>
<br>
<a href='levelup.php?id=".$id."'><img src='".$image."' style='margin: 0px auto; display: block'></a><br>
<div class='vgroup'>
<a href='myadopts.php?act=manage&id=".$id."'>Actions</a><br>
Name: ".stripslashes($name)."<br>";
if($father == "0") {
$article_content .= 'Caught On:';
} else {
$article_content .= 'Laid On:';
}
$article_content .= "
$date<br>
For Trade: ".$tradestatus."<br>
Current Level: ".$currentlevel."<br>
Next Level: ".$nloutput."<br>
<b>Total Clicks: ".$totalclicks."</b><br></div>
<div class='vgroup'>
Owner: <a href='http://silvadopts.com/profile.php?user=".$owner."'>$owner</a><br>
Gender: ";
if($gender == 'm') {
$article_content .= 'Male ';
} else {
$article_content .= 'Female ';
}
if($isfrozen == 'no') {
$article_content .= '<br>';
} else {
$article_content .= '<img src=\'http://inky.org/rpg/agents-maps/snowflake.png\'><br> ';
}
if($nFather == '' && $nMother == '') {
$article_content .= '';
} else {
$article_content .= 'Father: ' . $nFather . '<br>
Mother: ' . $nMother . '<br>';
}
$article_content .= '
<a href="http://silvadopts.com/familytree.php?aid='.$aid.'">View Lineage</a><br>';
if($lastbred == '') {
$article_content .= '';
}
else if($lastbred == '0') {
$article_content .= '';
} else {
$article_content .= 'Last bred: '.date('M j, Y', $lastbred).'<br>
Children: (<i>This feature is not yet available</i>)<br>';
}
$article_content .= "<br><br><br><br><br><br></div>";
if($currentlevel == '0') {
$article_content .= "$eggdesc";
}
elseif($currentlevel == '1') {
$article_content .= "$eggdesc";
}
elseif($currentlevel == '2') {
$article_content .= "$eggdesc";
}
elseif($currentlevel == '3') {
$article_content .= "$eggdesc";
}
elseif($currentlevel == '4') {
$article_content .= "$foxdesc";
}
elseif($currentlevel >= '5') {
$article_content .= "$adultdescription";
}
$article_content .="<br><br>";
if($type == 'Red Stitch Silvfox') {
$article_content .='Artist: Switch';
} else if($type == 'Eventide Silvfox') {
$article_content .='Artist: Switch';
} else if($type == 'White Stitch Silvfox') {
$article_content .='Artist: Switch';
} else if($type == 'The Noctis Silvfox') {
$article_content .='Artist: Switch';
} else if($type == 'Gold Silvfox') {
$article_content .='Artist: Switch, Roconza';
} else if($type == 'Inferno Silvfox') {
$article_content .='Artist: Switch, Roconza';
} else if($type == 'The Marauder Silvfox') {
$article_content .='Artist: Switch';
} else if($type == 'Switch Silvfox') {
$article_content .='Artist: Switch';
} else if($type == 'Arctic Silvfox') {
$article_content .='Artist: Switch';
} else if($type == 'Zebra Silvfox') {
$article_content .='Artist: Isura';
} else if($type == 'Tiger Silvfox') {
$article_content .='Artist: Isura';
} else if($type == 'Heat Element Silvfox') {
$article_content .='Artist: Isura';
} else if($type == 'Magic Element Silvfox') {
$article_content .='Artist: Isura';
} else if($type == 'Grass Element Silvfox') {
$article_content .='Artist: Isura';
} else if($type == 'Water Element Silvfox') {
$article_content .='Artist: Isura';
} else if($type == 'Yellow Winged Silvfox') {
$article_content .='Artist: Isura';
} else if($type == 'Blue Winged Silvfox') {
$article_content .='Artist: Isura';
} else if($type == 'Teal Winged Silvfox') {
$article_content .='Artist: Isura';
} else if($type == 'Orange Winged Silvfox') {
$article_content .='Artist: Isura';
} else if($type == 'Dark Winged Silvfox') {
$article_content .='Artist: Isura';
} else if($type == 'The Forest Silvfox') {
$article_content .='Artist: Switch, Roconza, SilverDragonTears';
} else if($type == 'The Gremlin Silvfox') {
$article_content .='Artist: Switch, Roconza, Beachbeagle';
} else if($type == 'Rainbow Silvfox') {
$article_content .='Artist: Switch, SilverDragonTears';
} else if($type == 'Redd Silvfox') {
$article_content .='Artist: Duzlla';
} else if($type == 'Graven Silvfox') {
$article_content .='Artist: Duzlla';
} else if($type == 'Fairie Silvfox') {
$article_content .='Artist: Duzlla';
} else if($type == 'GreenTipped Silvfox') {
$article_content .='Artist: GoldenShadowFire';
} else if($type == 'Marauder Red Silvfox') {
$article_content .='Artist: Switch, SilverDragonTears';
} else if($type == 'Snow Owl') {
$article_content .='Artist: elfhome';
} else if($type == 'The Lichen Silvfox') {
$article_content .='Artist: albinosilver';
} else if($type == 'Day Dream Silvfox') {
$article_content .='Artist: SilverDragonTears';
} else if($type == 'Sapphire Golem Silvfox') {
$article_content .='Artist: Isura';
} else if($type == 'Brass Golem Silvfox') {
$article_content .='Artist: Isura';
} else if($type == 'Hellfire Golem Silvfox') {
$article_content .='Artist: Isura';
} else if($type == 'Raven') {
$article_content .='Artist: SilverDragonTears, albinosilver';
}
$article_content .="
</td></tr></table></div>";
}
else{
$article_title = $err_idnoexist;
$article_content = $err_idnoexist_text;
}
}
else{
$article_title = $err_idnoexist;
$article_content = $err_idnoexist_text;
}
}
// End the STATS code
else if($act == "bbcode"){
if(is_numeric($id)){
// Now we see if the adoptable actually exists...
$query = "SELECT * FROM ".$prefix."owned_adoptables WHERE owner='$loggedinname' and aid='$id'";
$result = runquery($query);
$num = mysql_numrows($result);
//Loop out code
$i=0;
while ($i < 1) {
$aid=@mysql_result($result,$i,"aid"); //The adoptable's ID
$currentlevel=@mysql_result($result,$i,"currentlevel");
$type=@mysql_result($result,$i,"type");
$name=@mysql_result($result,$i,"name");
$totalclicks=@mysql_result($result,$i,"totalclicks");
$isfrozen=@mysql_result($result,$i,"isfrozen");
$i++;
}
if($aid == $id){
$altbb = grabanysetting("usealtbbcode");
// Adoptable exists, so show the BBCode:
$article_title = "Codes for ".stripslashes($name);
$article_content = $lang_bbcode_explain."<br>
<p><u>Forum Codes / BBCode: </u></p>
<p>
<textarea name='textarea' cols='50' rows='4'>http://www.".$domain."".$scriptpath."/siggy.php?id=".$aid." (http://www.".$domain."".$scriptpath."/levelup.php?id=".$aid.")
</textarea>
</p>";
if($altbb == "yes"){
// Use the seo friendly alternate bbcodes...
$article_content = $article_content."<p><u>Alternate BBCodes (Use if the above do not work on a forum): </u></p>
<p>
<textarea name='textarea' cols='50' rows='4'>http://www.".$domain."".$scriptpath."/get/".$aid.".gif (http://www.".$domain."".$scriptpath."/levelup.php?id=".$aid.")
</textarea>
</p>";
}
$article_content = $article_content."<p><u>HTML Code</u>:</p>
<p>
<textarea name='textarea' cols='50' rows='4'><a href=\"http://www.".$domain."".$scriptpath."/levelup.php?id=".$aid."\" target=\"_blank\">
<img src=\"http://www.".$domain."".$scriptpath."/siggy.php?id=".$aid."\" border=0></a>
</textarea>
</p>";
}
else{
$article_title = $err_idnoexist;
$article_content = $err_idnoexist_text;
}
}
else{
$article_title = $err_idnoexist;
$article_content = $err_idnoexist_text;
}
} // End the BBCODE generation for the adoptable...
else if($act == "rename"){
// We are renaming an adoptable
if(is_numeric($id)){
// Now we see if the adoptable actually exists...
$query = "SELECT * FROM ".$prefix."owned_adoptables WHERE owner='$loggedinname' and aid='$id'";
$result = runquery($query);
$num = mysql_numrows($result);
//Loop out code
$i=0;
while ($i < 1) {
$aid=@mysql_result($result,$i,"aid"); //The adoptable's ID
$currentlevel=@mysql_result($result,$i,"currentlevel");
$type=@mysql_result($result,$i,"type");
$name=@mysql_result($result,$i,"name");
$totalclicks=@mysql_result($result,$i,"totalclicks");
$isfrozen=@mysql_result($result,$i,"isfrozen");
$i++;
}
if($aid == $id){
$image = getcurrentimage($id);
if($more == ""){
$article_title = "Rename ".stripslashes($name);
$article_content = "<img src='".$image."'><br>".$lang_rename."".stripslashes($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{
$article_title = $err_idnoexist;
$article_content = $err_idnoexist_text;
}
}
else{
$article_title = $err_idnoexist;
$article_content = $err_idnoexist_text;
}
}
else if($act == "trade"){
// We are setting the trade status for an adoptable...
if(is_numeric($id)){
// Now we see if the adoptable actually exists...
$query = "SELECT * FROM ".$prefix."owned_adoptables WHERE owner='$loggedinname' and aid='$id'";
$result = mysql_query($query);
$num = mysql_numrows($result);
//Loop out code
$i=0;
while ($i < 1) {
$aid=@mysql_result($result,$i,"aid"); //The adoptable's ID
$tradestatus=@mysql_result($result,$i,"tradestatus");
$i++;
}
if($aid == $id){
$image = getcurrentimage($id); // Get the image for the adopt...
if($more == ""){
$article_title = "Setting trade status for ".stripslashes($name);
$article_content = "Are you sure you wish to change the trade status of this adoptable?<center><b><a href='myadopts.php?act=trade&id=".$id."&more=confirm'>Yes I'd like to change its trade status</a></b><br><br>
<b><a href='myadopts.php'>Nope I change my mind! Go back to the previous page.</a></b></center><br>";
}
else if($more == "confirm"){
if($tradestatus == "fortrade"){
$newtradestatus = "notfortrade";
$query = "UPDATE ".$prefix."owned_adoptables SET tradestatus='".$newtradestatus."' WHERE aid='".$id."' and owner='".$loggedinname."'";
runquery($query);
$article_title = "Change trade status successfully";
$article_content = "The adoptable's trade status is now Not for Trade";
}
else if($tradestatus == "notfortrade"){
$newtradestatus = "fortrade";
$query = "UPDATE ".$prefix."owned_adoptables SET tradestatus='".$newtradestatus."' WHERE aid='".$id."' and owner='".$loggedinname."'";
runquery($query);
$article_title = "Change trade status successfully";
$article_content = "The adoptable's trade status is now For Trade";
}
else{
$article_title = "Something is very very wrong";
$article_content = "Please check phpmyadmin to see if the settings are correct, or report your issue to Mysidia Adoptables support forum";
}
}
else{
$article_title = "Invalid Action";
$article_content = "Invalid Action Specified";
}
}
else{
$article_title = $err_idnoexist;
$article_content = $err_idnoexist;
}
}
else{
$article_title = $err_idnoexist;
$article_content = $err_idnoexist_text;
}
}
else if($act == "freeze"){
// We are freezing an adoptable here...
if(is_numeric($id)){
// Now we see if the adoptable actually exists...
$query = "SELECT * FROM ".$prefix."owned_adoptables WHERE owner='$loggedinname' and aid='$id'";
$result = runquery($query);
$num = mysql_numrows($result);
//Loop out code
$i=0;
while ($i < 1) {
$aid=@mysql_result($result,$i,"aid"); //The adoptable's ID
$currentlevel=@mysql_result($result,$i,"currentlevel");
$type=@mysql_result($result,$i,"type");
$name=@mysql_result($result,$i,"name");
$totalclicks=@mysql_result($result,$i,"totalclicks");
$isfrozen=@mysql_result($result,$i,"isfrozen");
$i++;
}
if($aid == $id){
$image = getcurrentimage($id); // Get the image for the adopt...
if($more == ""){
if($isfrozen == "yes"){
$group = getgroup();
$cancp = cancp($group);
if($cancp == "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/freeze.gif'> Frozen<br>";
$go = "You are not allowed to unfreeze this adoptable. <a href='javascript:history.go(-1)'>Click here to go back.</a>";
}
}
else if($isfrozen == "no"){
$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>".stripslashes($name)."'s Current Status: ".$status."</b><br>".$lang_freeze."<br><br><b>".$go."</b><br><br>
".$lang_freeze_warning."";
}
else{
// We are actually freezing or unfreezing the adopt...
$frz = "no";
if($more == "freeze"){
$frz = "yes";
}
$query = "UPDATE ".$prefix."owned_adoptables SET isfrozen='".$frz."' WHERE aid='".$id."' and owner='".$loggedinname."'";
runquery($query);
if($frz == "yes"){
$article_title = stripslashes($name)." Frozen Successfully";
}
else{
$article_title = stripslashes($name)." Unfrozen Successfully";
}
$article_content = stripslashes($name)." is now frozen. You may now manage ".stripslashes($name)." on the <a href='myadopts.php?act=manage&id=".$id."'>My Adopts</a> page.";
}
}
else{
$article_title = $err_idnoexist;
$article_content = $err_idnoexist_text;
}
}
else{
$article_title = $err_idnoexist;
$article_content = $err_idnoexist_text;
}
}
else if($act == "pound"){
if(is_numeric($id)){
// Now we see if the adoptable actually exists...
$query = "SELECT * FROM ".$prefix."owned_adoptables WHERE owner='$loggedinname' and aid='$id'";
$result = runquery($query);
$num = mysql_numrows($result);
//Loop out code
$i=0;
while ($i < 1) {
$aid=@mysql_result($result,$i,"aid"); //The adoptable's ID
$currentlevel=@mysql_result($result,$i,"currentlevel");
$type=@mysql_result($result,$i,"type");
$name=@mysql_result($result,$i,"name");
$totalclicks=@mysql_result($result,$i,"totalclicks");
$isfrozen=@mysql_result($result,$i,"isfrozen");
$i++;
}
if($aid == $id){
$image = getcurrentimage($id); // Get the image for the adopt...
if($more == ""){
$article_title = "Abandon ".stripslashes($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> Abandon ".stripslashes($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 Abandon ".stripslashes($name)."! <img src='templates/icons/yes.gif' border=0></a></b></center><br>";
}
else if($more == "confirm"){
// Actually run the execution
$query = "UPDATE ".$prefix."owned_adoptables SET owner='SYSTEM' WHERE aid='".$id."'";
runquery($query);
$article_title = $lang_pound_title_complete;
$article_content = $lang_pound_complete;
}
else{
$article_title = "Invalid Action";
$article_content = "Invalid Action Specified";
}
}
else{
$article_title = $err_idnoexist;
$article_content = $err_idnoexist_text;
}
}
else{
$article_title = $err_idnoexist;
$article_content = $err_idnoexist_text;
}
}
else{
// No valid action specified :: show an error
$article_title = $lang_invalid_action_title;
$article_content = $lang_invalid_action;
}
}
else{
$article_title = $accden;
$article_content = $reqlogin;
} // End is logged in check else
//***************//
// OUTPUT PAGE //
//***************//
echo showpage($article_title, $article_content, $date);
?>
Anyway, if you want me to install it for you, I guess you could just do what HoF said.
Hall of Famer
08-29-2011, 05:20 PM
Well Fadillzzz, I have a suggestion for your script. Why dont you modify these lines a bit by replacing one-time loop with mysql_fetch_array()? All programming flaws such as the one below have been fixed in Mys v1.2.3:
$i=0;
while ($i < 1) {
$aid=@mysql_result($result,$i,"aid"); //The adoptable's ID
$currentlevel=@mysql_result($result,$i,"currentlevel");
$type=@mysql_result($result,$i,"type");
$name=@mysql_result($result,$i,"name");
$tradestatus=@mysql_result($result,$i,"tradestatus");
$father=@mysql_result($result,$i,"father");
$mother=@mysql_result($result,$i,"mother");
$lastbred=@mysql_result($result,$i,"lastbred");
$adultdescription=@mysql_result($result,$i,"adultdescription");
$i++;
}
fadillzzz
08-29-2011, 05:24 PM
Hmm...that actually is not part of the mod...
That code is inside SDT's myadopts.php file. I think I'll just let her decide what to do with it.
SilverDragonTears
08-29-2011, 05:30 PM
yea i'll pm you my info, since that didn't work either
fadillzzz
08-29-2011, 05:38 PM
Still? But I just tried it and it works... :coloness:
The only thing that you need to work on now, is probably some styling for better looking
BTW, You did click on the 'Click here to sort your adoptables' first right? before actually trying to sort the adoptables?
Hall of Famer
08-29-2011, 05:40 PM
Again Id recommend SDT to give ftp access to Fadillzzz so he can fix the glitch much more easily. It is difficult to help with someone using a heavily customized site.
SilverDragonTears
08-29-2011, 05:41 PM
OMG. I bet it's worked this whole time. I thought there would be an underline link.
*smacks self*
fadillzzz
08-29-2011, 05:43 PM
Finally :madO:
I was beginning to worry that my mod is only working on my development site XD
SilverDragonTears
08-29-2011, 05:44 PM
I'm so blond. Literally. Sorry fadillzz =( LOL
Any way to make the sort images smaller?
Hall of Famer
08-29-2011, 05:45 PM
Well if a Mod works on your development site, it is safe to assume it is fine on a standard Mysidia site. I am assuming SDT has a customized site already since she modified some of the script herself. This is probably why your Mod wont work on her site at the very beginning.
fadillzzz
08-29-2011, 05:56 PM
Any way to make the sort images smaller?
You mean make the item smaller when we're dragging it?
SilverDragonTears
08-29-2011, 06:06 PM
yea, because when someone has a lot it's hard to see what you want to drag where
fadillzzz
08-30-2011, 08:22 AM
I'm not sure. The documentation doesn't explain any theming for the "sortable" interactions.
But I think you can add '.ui-sortable-placeholder' to your stylesheet and give it some properties to style it to your liking.
SilverDragonTears
08-30-2011, 12:40 PM
Ok thanks! The sorting in itself is just wonderful! Thanks so much for it!
SilverDragonTears
08-31-2011, 01:39 PM
hmm what do I edit to style the table? Having some issues with it and I'm not familiar with JS.
fadillzzz
08-31-2011, 02:10 PM
If you want to edit the table body.
Just make a CSS rule with the selector 'tbody.ui-sortable'
SilverDragonTears
08-31-2011, 02:32 PM
like this:
tbody.ui-sortable {
color: #000;
width: 100%;
}
cause that didn't work
nm... it would help if i added <tbody> to it =p
fadillzzz
08-31-2011, 03:23 PM
Perhaps you should update your javascript code to this one. This will achieve what I actually wanted to make, the first javascript code I provided has a "defect" even though if you have different layout and styling the result might actually be what I expected. Nevertheless, please do try this one and see if you like it better. Otherwise, just revert back to the old javascript code.
$(document).ready(function(){
$('body').undelegate('click').delegate('p#activate _sort', 'click', function(){
var realBg = $('table#sortable_adoptables').css('background-color');
var submitForm = '<form name="submit_order" id="submit_order" action="" method="post"><fieldset><label for="submit">Submit Changes</label><input type="submit" id="submit" value="Submit"></fieldset></form>';
$('table#sortable_adoptables').css('background-color', '#FFFF66').animate({ backgroundColor: realBg }, 'slow' ).find('tbody').sortable({ cursor: 'pointer' });
$(submitForm).insertAfter('p#activate_sort').hide( ).slideDown();
$('p#activate_sort').attr('id', 'deactivate_sort');
});
$('body').undelegate('submit').delegate('form#subm it_order', 'submit', function(event){
event.preventDefault();
var data = $('table#sortable_adoptables tbody').sortable('serialize');
$.post('ajax_sort.php', data, function(result){
$('form#submit_order').html(result).delay(5000).fa deOut('slow', function(){
$(this).remove();
});
});
$('table#sortable_adoptables tbody').sortable('destroy');
$('p#deactivate_sort').attr('id', 'activate_sort');
});
});
SilverDragonTears
08-31-2011, 03:39 PM
I did it but I don't see a difference.
fadillzzz
08-31-2011, 03:48 PM
You sure? that code above should preserve your table background now...instead of changing it to white :BIGO:
SilverDragonTears
08-31-2011, 04:36 PM
Ahhh that's what it is =) Love it!
fadillzzz
08-31-2011, 04:55 PM
Oh and btw, I just noticed that when you click on 'Click here to sort your adoptables' the table somehow gets aligned to the left a little bit more.
If you're wondering how to fix that, I think the following code should do the trick
$(document).ready(function(){
$('body').undelegate('click').delegate('p#activate _sort', 'click', function(){
var realBg = $('table#sortable_adoptables').css('background-color');
var submitForm = '<form name="submit_order" id="submit_order" action="" method="post"><fieldset><label for="submit">Submit Changes</label><input type="submit" id="submit" value="Submit"></fieldset></form>';
$('table#sortable_adoptables').css({backgroundColo r: '#FFFF66', paddingRight: '0'}).animate({ backgroundColor: realBg }, 'slow' ).find('tbody').sortable({ cursor: 'pointer' });
$(submitForm).insertAfter('p#activate_sort').hide( ).slideDown();
$('p#activate_sort').attr('id', 'deactivate_sort');
});
$('body').undelegate('submit').delegate('form#subm it_order', 'submit', function(event){
event.preventDefault();
var data = $('table#sortable_adoptables tbody').sortable('serialize');
$.post('ajax_sort.php', data, function(result){
$('form#submit_order').html(result).delay(5000).fa deOut('slow', function(){
$(this).remove();
});
});
$('table#sortable_adoptables tbody').sortable('destroy');
$('p#deactivate_sort').attr('id', 'activate_sort');
});
SilverDragonTears
08-31-2011, 05:43 PM
still did it...
Teshia
08-31-2011, 09:27 PM
Sorting! Awesome!
fadillzzz
09-08-2011, 09:57 AM
First post updated:
Fixed a bug where trading adoptables can cause duplicate entries in the sorting tables.
The table structure now only have 'adoptable_id' as the primary key.
PokePets
10-22-2011, 03:56 AM
Thank you for this mod :)
Works perfect on my site!
SilverDragonTears
11-23-2011, 01:25 AM
Why won't it save the sort anymore (After Maple added in a tabs feature for our adopts)?
include("inc/functions.php");
//***************//
// START SCRIPT //
//***************//
$id = $_GET["id"];
$act = $_GET["act"];
$more = $_GET["more"];
$abilityid = $_GET["abilityid"];
$tab = $_GET['tab'];
if($isloggedin == "yes"){
if($act == ""){
$tabs = gettabs();
$article_title .="{$loggedinname}'s Den";
$article_content .="
<table width='60%' style='text-align:center;' class='shop'><center><tr><td><p class='sort' id='activate_sort'>
Sort Adopts - Currently NOT Working.
</p><center></td></tr></table></center>
<table width='60%' style='text-align:center;' class='shop'><tr><td width='20%'><a href='trade.php'>Trade</a>-<a href='search.php'>Search</a></td>
<td width='20%'><a href='breeding.php'>Breed</a></td>
<td width='20%'><a href='embed.php'>Embed All</a></td>
<td width='20%'><a href='inventory.php'>Kit Inventory</a></td><td width='20%'><a href='inventory2.php'>Adult Inventory</a></td></tr></table></center>
<br>
<table width='60%' style='text-align:center;' class='shop'><tr><td width='20%'><a href='tab.php'>Manage Dens</td></a>
<td width='20%'>Select a den to go to: <select name='tab' id='tab' ONCHANGE='location = this.options[this.selectedIndex].value;'>
<option value='#'>Please Select one below:</option><option value='myadopts.php'>Default</option>".$tabs."
</select></td>
</tr></table></center>
<br><div style='float:left;'>";
$query = "SELECT * FROM ".$GLOBALS['prefix']."owned_collectables WHERE type = 'Halloween' AND owner = '".$loggedinname."'";
$result = runquery($query);
$num = mysql_numrows($result);
if($num > 0){
$article_content .="<img src='images/candypumpkin.png' title='Trick or Treat 2011'>";
}else{
$article_content .="";
}
$query = "SELECT * FROM ".$GLOBALS['prefix']."owned_adoptables WHERE type = '911 Silvfox' AND owner = '".$loggedinname."'";
$result = runquery($query);
$num = mysql_numrows($result);
if($num > 0){
$article_content .="<img src='images/us.png' title='911 Event'>";
}else if($type == '911 Wolf'){
$article_content .="<img src='images/us.png' title='911 Event'>";
}else{
$article_content .="";
}
$query = "SELECT * FROM ".$GLOBALS['prefix']."owned_adoptables LEFT JOIN ".$GLOBALS['prefix']."sort_adoptables
ON ".$GLOBALS['prefix']."owned_adoptables.aid = ".$GLOBALS['prefix']."sort_adoptables.adoptable_id WHERE owner = '".$loggedinname."' ORDER BY ".$GLOBALS['prefix']."sort_adoptables.sorting_id, ".$GLOBALS['prefix']."owned_adoptables.currentlevel ASC";
$result = runquery($query);
$numpets = mysql_numrows($result);
if($numpets >= 500){
$article_content .="<img src='/images/trophy-gold.png' title='Gold Trophy - Over 500 SilvAdopts'>";
} else if($numpets >= 200){
$article_content .="<img src='/images/silvertrophy.png' title='Silver Trophy - Over 200 SilvAdopts'>";
} else if($numpets >= 50){
$article_content .="<img src='/images/trophy-bronze.png' title='Bronze Trophy - Over 50 SilvAdopts'>";
}else{
$article_content .="";
}
$article_content .="</div><br><br>
<br>Share this link with others to show them your Den<br>
<input type='text' size='100' value='http://silvadopts.com/profile.php?user=$loggedinname'><br>
<a href='http://silvadopts.com/profile.php?user=$loggedinname'>http://silvadopts.com/profile.php?user=$loggedinname</a><br>";
$article_content .= "<div style='height:100%;
color: #fff;
border: 1px solid #282828;
border-top: 1px solid #363636;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
padding: 5px;'><table style='width: 100%;' class='madopt' id='sortable_adoptables' ><tbody>
<tr><th>SilvAdopt</th><th>Name</th><th>Level</th><th>Manage</th><th>Get Codes</th><th>Clicks</th></tr><br>";
// We need to get all of the user's adoptables from the database and display them...
/* $query = "SELECT * FROM ".$prefix."owned_adoptables, ".$prefix."levels WHERE ".$prefix."owned_adoptables.owner = '{$loggedinname}'"
." AND ".$prefix."owned_adoptables.type = ".$prefix."owned_adoptables.type AND ".$prefix."levels.thisislevel = ".$prefix."owned_adoptables.currentlevel AND ".$prefix."levels.adoptiename = "
.$prefix."owned_adoptables.type ORDER BY ".$prefix."owned_adoptables.sort, ".$prefix."owned_adoptables.totalclicks";
*/
$query = " SELECT *
FROM {$prefix}owned_adoptables
LEFT JOIN {$prefix}sort_adoptables
ON {$prefix}owned_adoptables.aid = {$prefix}sort_adoptables.adoptable_id
INNER JOIN {$prefix}levels
ON {$prefix}levels.thisislevel = {$prefix}owned_adoptables.currentlevel
INNER JOIN {$prefix}adoptables
ON {$prefix}owned_adoptables.type = {$prefix}adoptables.type
WHERE {$prefix}owned_adoptables.owner = '{$loggedinname}' AND {$prefix}owned_adoptables.tab = '{$tab}'
AND {$prefix}levels.adoptiename = {$prefix}adoptables.type
ORDER BY {$prefix}sort_adoptables.sorting_id, {$prefix}owned_adoptables.currentlevel ASC";
$result = runquery($query);
$num = mysql_numrows($result);
//Loop out code
$i=0;
while ($i < $num) {
$aid=@mysql_result($result,$i, $prefix."owned_adoptables.aid");
$currentlevel=@mysql_result($result,$i, $prefix."owned_adoptables.currentlevel");
$gender=@mysql_result($result,$i, $prefix."owned_adoptables.gender");
$isfrozen=@mysql_result($result,$i, $prefix."owned_adoptables.isfrozen");
$type=@mysql_result($result,$i, $prefix."owned_adoptables.type");
$name=@mysql_result($result,$i, $prefix."owned_adoptables.name");
$eggimage=@mysql_result($result,$i, $prefix."adoptables.eggimage");
$usealternates=@mysql_result($result,$i, $prefix."owned_adoptables.usealternates");
$totalclicks=@mysql_result($result,$i, $prefix."owned_adoptables.totalclicks");
$primaryimage=@mysql_result($result,$i, $prefix."levels.primaryimage");
$alternateimage=@mysql_result($result,$i, $prefix."levels.alternateimage");
if ($usealternates=='yes') { $image = $alternateimage; }
else { $image = $primaryimage; }
if ($currentlevel==0) { $image = $eggimage; }
if ($image=='') { $image = $primaryimage; }
$article_content .= "<tr id='orderaid_{$aid}'><td width='20%'><a href='myadopts.php?act=stats&id=".$aid."'><img src='$image'></a></td><td width='20%'>";
if($isfrozen == 'no') {
$article_content .= '';
} else {
$article_content .= '<img src=\'images/snowflake.png\'>';
}
SilverDragonTears
03-23-2012, 01:52 AM
Do you have a fix for this code for 1.3?
function secure($data, $key = NULL) {
//This function performs security checks on all incoming form data
if ($key === 'orderaid')
{
//var_dump($data); var_dump($key); die;
foreach($data as $dataKey => $dataVal)
{
$data[$dataKey] = abs(intval($dataVal));
}
//var_dump($data);die;
return $data;
}
if(is_array($data)) {
die("Hacking Attempt!");
}
$data = htmlentities($data);
$data = mysql_real_escape_string($data);
$data = strip_tags($data, '');
if ($key === NULL)
{
return $data;
}
$GLOBALS['_POST'][$key] = $data;
}
This does not work in 1.3
fadillzzz
03-23-2012, 03:03 AM
That's odd. There isn't any big change to that function in Mys 1.3.
Perhaps you installed it incorrectly. But more importantly, what do you mean by "does not work"? Can you be more specific?
SilverDragonTears
03-23-2012, 05:53 PM
I fixed it :) It was late last night so I don't even know how I did it :/
Kesstryl
03-23-2012, 06:11 PM
If you do remember, can you post it? I'd like to get this working on 1.3 but I've been waiting for it to get updated to 1.3. This is too useful to not have.
SilverDragonTears
03-23-2012, 06:20 PM
I'll just post what I have in my functions.php script
function secure($data, $key = NULL) {
//This function performs security checks on all incoming form data
if ($key === 'orderaid')
{
//var_dump($data); var_dump($key); die;
foreach($data as $dataKey => $dataVal)
{
$data[$dataKey] = abs(intval($dataVal));
}
//var_dump($data);die;
return $data;
}
if(is_array($data)) {
die("Hacking Attempt!");
}
$data = htmlentities($data);
$data = strip_tags($data, '');
return $data;
}
And the ajax_sort file needs to be replaced also:
about line 23:
$adopts->query('REPLACE INTO ' . $prefix . 'sort_adoptables (`user_id`, `adoptable_id`, `sorting_id`)
VALUES ("' . addslashes($userID) . '", "' . addslashes($aid) . '", "' . addslashes($orderID) . '")');
Hall of Famer
03-23-2012, 06:45 PM
Well dude, just make a tiny bit of edit in your script and release the new Mod in Mys v1.3.x Addons/Mods subforum. That section needs some threads anyway.
Kesstryl
03-23-2012, 07:06 PM
Something didn't work
Parse error: syntax error, unexpected '}' in /homepages/22/d355892482/htdocs/fabletopia/functions/functions.php on line 83
Kesstryl
03-23-2012, 07:07 PM
Nevermind, just fixed an error, sometimes I just need to believe in myself :)
SilverDragonTears
03-23-2012, 07:25 PM
I forgot to mention... if you do this with the newest script, when you click on someone's profile the tabs don't work :/
fadillzzz
03-24-2012, 12:16 AM
I'll see what I can do about creating this mod for Mys 1.3
Hall of Famer
03-24-2012, 09:30 AM
Well Id say you take a look into it and see how difficult it is to convert the Mod to Mys v1.3.x compatible version. If it is too hard and will take days, then wait till you have more time.
Alaric
05-29-2012, 02:16 AM
This script look's and sounds awsome, I would like to use it in v.1.3.1
I hope you modify the script.. so i can use it in v.1.3
vBulletin® v3.8.11, Copyright ©2000-2025, vBulletin Solutions Inc.