View Single Post
  #5  
Old 09-24-2009, 10:51 AM
arlecchina arlecchina is offline
Member
 
Join Date: Feb 2009
Posts: 65
Credits: 3,695
arlecchina
Default RE: Drop-down menu for myadopt.php

Here is the code for the rename action without the drop-down menu code I wrote (Because I don't know where to put it to make it work).

I've made several changes to Brandon's original code but none of these changes should conflict with the drop-down menu I think.

Sorry for the horizontal scrolling.

PHP Code:
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 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
$currentlevel=@mysql_result($result,$i,"currentlevel");
$type=@mysql_result($result,$i,"type");
$name=@mysql_result($result,$i,"name");
$owner=@mysql_result($result,$i,"owner");
$totalclicks=@mysql_result($result,$i,"totalclicks");
$usealternates=@mysql_result($result,$i,"usealternates");
$isfrozen=@mysql_result($result,$i,"isfrozen");
$royalbio=@mysql_result($result,$i,"royalbio");
$royaloccupation=@mysql_result($result,$i,"royaloccupation");

$i++;
}

if(
$aid == $id){

$image getcurrentimage($id);

    if(
$currentlevel == "0"){
        
$royalnametitle "";
        
$lang_caremenu_biobutton "<span class='buttongrey buttoncarefor center'>".$lang_caremenu_bio_t."</span>";
        
$lang_caremenu_occupationbutton "<span class='buttongrey buttoncarefor center'>".$lang_caremenu_occupation_t."</span>";
        if(
$isfrozen == "yes"){
            
$levelupbutton "<span class='buttongrey buttoncarefor center'>".$levelupbutton1."</span>";
        }
        else{
            
$levelupbutton "<a href='levelup.php?id=".$aid."' class='button buttoncarefor center'>".$levelupbutton1."</a>";
        }
    }
    else if(
$currentlevel == "1"){
        
$royalnametitle "";
        
$lang_caremenu_occupationbutton "<span class='buttongrey buttoncarefor center'>".$lang_caremenu_occupation_t."</span>";
        
$lang_caremenu_biobutton "<a href='myadopts.php?act=bio&id=".$aid."' class='button buttoncarefor center'>".$lang_caremenu_bio_t."</a>";
        if(
$isfrozen == "yes"){
            
$levelupbutton "<span class='buttongrey buttoncarefor center'>".$levelupbutton2."</span>";
        }
        else{
            
$levelupbutton "<a href='levelup.php?id=".$aid."' class='button buttoncarefor center'>".$levelupbutton2."</a>";
        }
    }
    else if(
$currentlevel == "2"){
        
$royalnametitle "";
        
$lang_caremenu_occupationbutton "<span class='buttongrey buttoncarefor center'>".$lang_caremenu_occupation_t."</span>";
        
$lang_caremenu_biobutton "<a href='myadopts.php?act=bio&id=".$aid."' class='button buttoncarefor center'>".$lang_caremenu_bio_t."</a>";
        if(
$isfrozen == "yes"){
            
$levelupbutton "<span class='buttongrey buttoncarefor center'>".$levelupbutton2."</span>";
        }
        else{
            
$levelupbutton "<a href='levelup.php?id=".$aid."' class='button buttoncarefor center'>".$levelupbutton2."</a>";
        }
    }
    else if(
$currentlevel == "3"){
        
$royalnametitle "";
        
$lang_caremenu_occupationbutton "<span class='buttongrey buttoncarefor center'>".$lang_caremenu_occupation_t."</span>";
        
$lang_caremenu_biobutton "<a href='myadopts.php?act=bio&id=".$aid."' class='button buttoncarefor center'>".$lang_caremenu_bio_t."</a>";
        if(
$isfrozen == "yes"){
            
$levelupbutton "<span class='buttongrey buttoncarefor center'>".$levelupbutton2."</span>";
        }
        else{
            
$levelupbutton "<a href='levelup.php?id=".$aid."' class='button buttoncarefor center'>".$levelupbutton2."</a>";
        }
    }
    else if(
$currentlevel == "4"){
        
$lang_caremenu_biobutton "<a href='myadopts.php?act=bio&id=".$aid."' class='button buttoncarefor center'>".$lang_caremenu_bio_t."</a>";
        
$lang_caremenu_occupationbutton "<a href='myadopts.php?act=occupation&id=".$aid."' class='button buttoncarefor center'>".$lang_caremenu_occupation_t."</a>";
        if(
$isfrozen == "yes"){
            
$levelupbutton "<span class='buttongrey buttoncarefor center'>".$levelupbutton3."</span>";
        }
        else{
            
$levelupbutton "<a href='levelup.php?id=".$aid."' class='button buttoncarefor center'>".$levelupbutton3."</a>";
        }
        if(
$usealternates == "yes"){
            
$royalnametitle $royalstage4mtitle;
        }
        else if(
$usealternates == "no" ){
            
$royalnametitle $royalstage4ftitle;
        }
    }
    else if(
$currentlevel == "5"){
        
$lang_caremenu_biobutton "<a href='myadopts.php?act=bio&id=".$aid."' class='button buttoncarefor center'>".$lang_caremenu_bio_t."</a>";
        
$lang_caremenu_occupationbutton "<a href='myadopts.php?act=occupation&id=".$aid."' class='button buttoncarefor center'>".$lang_caremenu_occupation_t."</a>";
        if(
$isfrozen == "yes"){
            
$levelupbutton "<span class='buttongrey buttoncarefor center'>".$levelupbutton3."</span>";
        }
        else{
            
$levelupbutton "<a href='levelup.php?id=".$aid."' class='button buttoncarefor center'>".$levelupbutton3."</a>";
        }
        if(
$usealternates == "yes"){
            
$royalnametitle $royalstage5mtitle;
        }
        else if(
$usealternates == "no" ){
            
$royalnametitle $royalstage5ftitle;
        }
    }
    else if(
$currentlevel == "6"){
        
$lang_caremenu_biobutton "<a href='myadopts.php?act=bio&id=".$aid."' class='button buttoncarefor center'>".$lang_caremenu_bio_t."</a>";
        
$lang_caremenu_occupationbutton "<a href='myadopts.php?act=occupation&id=".$aid."' class='button buttoncarefor center'>".$lang_caremenu_occupation_t."</a>";
        if(
$isfrozen == "yes"){
            
$levelupbutton "<span class='buttongrey buttoncarefor center'>".$levelupbutton3."</span>";
        }
        else{
            
$levelupbutton "<a href='levelup.php?id=".$aid."' class='button buttoncarefor center'>".$levelupbutton3."</a>";
        }
        if(
$usealternates == "yes"){
            
$royalnametitle $royalstage6mtitle;
        }
        else if(
$usealternates == "no" ){
            
$royalnametitle $royalstage6ftitle;
        }
    }
    else if(
$currentlevel == "7"){
        
$lang_caremenu_biobutton "<a href='myadopts.php?act=bio&id=".$aid."' class='button buttoncarefor center'>".$lang_caremenu_bio_t."</a>";
        
$lang_caremenu_occupationbutton "<a href='myadopts.php?act=occupation&id=".$aid."' class='button buttoncarefor center'>".$lang_caremenu_occupation_t."</a>";
        if(
$isfrozen == "yes"){
            
$levelupbutton "<span class='buttongrey buttoncarefor center'>".$levelupbutton3."</span>";
        }
        else{
            
$levelupbutton "<a href='levelup.php?id=".$aid."' class='button buttoncarefor center'>".$levelupbutton3."</a>";
        }
        if(
$usealternates == "yes"){
            
$royalnametitle $royalstage7mtitle;
        }
        else if(
$usealternates == "no" ){
            
$royalnametitle $royalstage7ftitle;
        }
    }
    else if(
$currentlevel == "8"){
        
$lang_caremenu_biobutton "<a href='myadopts.php?act=bio&id=".$aid."' class='button buttoncarefor center'>".$lang_caremenu_bio_t."</a>";
        
$lang_caremenu_occupationbutton "<a href='myadopts.php?act=occupation&id=".$aid."' class='button buttoncarefor center'>".$lang_caremenu_occupation_t."</a>";
        if(
$isfrozen == "yes"){
            
$levelupbutton "<span class='buttongrey buttoncarefor center'>".$levelupbutton3."</span>";
        }
        else{
            
$levelupbutton "<a href='levelup.php?id=".$aid."' class='button buttoncarefor center'>".$levelupbutton3."</a>";
        }
        if(
$usealternates == "yes"){
            
$royalnametitle $royalstage8mtitle;
        }
        else if(
$usealternates == "no" ){
            
$royalnametitle $royalstage8ftitle;
        }
    }

    
//Frozen or Unfroozen?
    
if($isfrozen == "yes"){
        
$status2 $lang_unfreeze_button;
        
$renamebutton "<div class='buttongrey buttoncarefor center'>".$lang_caremenu_rename_t."</div>";
    }
    else{
        
$status2 $lang_freeze_button;
        
$renamebutton "<a href='myadopts.php?act=rename&id=".$aid."' class='button buttoncarefor center'>".$lang_caremenu_rename_t."</a>";
    }

if(
$isfrozen != "yes"){

if(
$more == ""){

$article_title $lang_rename_title." ".$royalnametitle." ".$name;
$article_content "<!-- google_ad_section_start(weight=ignore) -->
<div class='npc3'><p class='titania2'><img src='templates/default/images/npc_1_s.png' width='70' height='70' border='0' alt='Titania' />"
.$lang_rename." <span class='bold'>".$royalnametitle." ".$name."</span> ".$lang_rename2." <span class='bold'>".$royalnametitle." ".$name."".$lang_rename3."</p></div>

<div id='pwrapper'>
<div id='p'>
    <div id='p_up_left'></div>
    <div id='p_up'></div>
    <div id='p_up_right'></div>
    <div id='p_middle_left'></div>
    <div id='p_middle'>
        <div class='inside2'>

<div id='pwrapper2'>
    <div id='ptitle'><div class='sub-title'>"
.$royalnametitle." ".$name."</div></div>
    <div id='p4'>
            <div id='p5'><a href='levelup.php?id="
.$aid."'><img src='".$image."' alt='".$royalnametitle." ".$name."' id='p5image' /></a></div>
            <div id='p5'>
            <div id='p1'><a href='myadopts.php?act=manage&id="
.$aid."' class='button buttoncarefor center'>".$lang_caremenu_stats2_t."</a></div>
            <div id='p1'>"
.$levelupbutton."</div>
            <div id='p2'>"
.$lang_caremenu_biobutton."</div>
            <div id='p3'>"
.$lang_caremenu_occupationbutton."</div>
            <div id='p1'><a href='myadopts.php?act=stats&id="
.$aid."' class='button buttoncarefor center'>".$lang_caremenu_stats_t."</a></div>
            <div id='p2'><a href='myadopts.php?act=bbcode&id="
.$aid."' class='button buttoncarefor center'>".$lang_caremenu_codes_t."</a></div>
            <div id='p3'>"
.$renamebutton."</div>
            <div id='p1'><a href='myadopts.php?act=freeze&id="
.$aid."' class='button buttoncarefor center'>".$status2."</a></div>
            <div id='p1'><a href='myadopts.php?act=kill&id="
.$aid."' class='button buttoncarefor center'>".$lang_caremenu_setfree_t."</a></div>
            </div>
    </div>
</div>

<form name='form1' method='get' action='myadopts.php'>
<label>"
.$lang_adoptrename_old_label."</label> ".$name."<br />
<div class='npc_p'><p class='titania2_p'>"
.$lang_rename4."</p></div>
<label for='more'>"
.$lang_adoptrename_new_label."</label> <input name='more' type='text' id='more' class='p_middletextarea' />
<input name='id' type='hidden' id='id' value='"
.$id."' />
<input name='act' type='hidden' id='act' value='rename' />
<input type='submit' name='Submit' class='button' value='"
.$lang_adoptrename_button."' />
</form>
        </div>
    </div>
    <div id='p_middle_right'></div>
    <div id='p_down_left'></div>
    <div id='p_down'></div>
    <div id='p_down_right'></div>
</div>
</div>
<!-- google_ad_section_end -->"
;

}
else{

// We are renaming the adoptable

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

$article_title $lang_rename_success_title;
$article_content "<!-- google_ad_section_start(weight=ignore) -->
<div class='npc3'><p class='titania2'><img src='templates/default/images/npc_1_s.png' width='70' height='70' border='0' alt='Titania' />"
.$lang_rename_success."</p></div>
<div id='pwrapper'>
<div id='p'>
    <div id='p_up_left'></div>
    <div id='p_up'></div>
    <div id='p_up_right'></div>
    <div id='p_middle_left'></div>
    <div id='p_middle'>
        <div class='inside2'>

<div id='pwrapper2'>
    <div id='ptitle'><div class='sub-title'>"
.$royalnametitle." ".$name."</div></div>
    <div id='p4'>
            <div id='p5'><a href='levelup.php?id="
.$aid."'><img src='".$image."' alt='".$royalnametitle." ".$name."' id='p5image' /></a></div>
            <div id='p5'>
            <div id='p1'><a href='myadopts.php?act=manage&id="
.$aid."' class='button buttoncarefor center'>".$lang_caremenu_stats2_t."</a></div>
            <div id='p1'>"
.$levelupbutton."</div>
            <div id='p2'>"
.$lang_caremenu_biobutton."</div>
            <div id='p3'>"
.$lang_caremenu_occupationbutton."</div>
            <div id='p1'><a href='myadopts.php?act=stats&id="
.$aid."' class='button buttoncarefor center'>".$lang_caremenu_stats_t."</a></div>
            <div id='p2'><a href='myadopts.php?act=bbcode&id="
.$aid."' class='button buttoncarefor center'>".$lang_caremenu_codes_t."</a></div>
            <div id='p3'>"
.$renamebutton."</div>
            <div id='p1'><a href='myadopts.php?act=freeze&id="
.$aid."' class='button buttoncarefor center'>".$status2."</a></div>
            <div id='p1'><a href='myadopts.php?act=kill&id="
.$aid."' class='button buttoncarefor center'>".$lang_caremenu_setfree_t."</a></div>
            </div>
    </div>
</div>

        </div>
    </div>
    <div id='p_middle_right'></div>
    <div id='p_down_left'></div>
    <div id='p_down'></div>
    <div id='p_down_right'></div>
</div>
</div>
<!-- google_ad_section_end -->"
;

}
}
else{

// We cannot rename a frozen adoptable...

$article_title $lang_frozen_title;
$article_content "<!-- google_ad_section_start(weight=ignore) -->
<div class='npc3'><p class='titania2'><img src='templates/default/images/npc_1_s.png' width='70' height='70' border='0' alt='Titania' />"
.$lang_frozen1." <span class='bold'>".$royalnametitle." ".$name."</span>".$lang_fronze2." <a href='myadopts.php?act=freeze&id=".$id."&more=unfreeze'>".$lang_adoptremane_unfreeze_link."</a> <span class='bold'>".$royalnametitle." ".$name."".$lang_frozen3."</p></div>
<div id='pwrapper'>
<div id='p'>
    <div id='p_up_left'></div>
    <div id='p_up'></div>
    <div id='p_up_right'></div>
    <div id='p_middle_left'></div>
    <div id='p_middle'>
        <div class='inside2'>

<div id='pwrapper2'>
    <div id='ptitle'><div class='sub-title'>"
.$royalnametitle." ".$name."</div></div>
    <div id='p4'>
            <div id='p5'><a href='levelup.php?id="
.$aid."'><img src='".$image."' alt='".$royalnametitle." ".$name."' id='p5image' /></a></div>
            <div id='p5'>
            <div id='p1'><a href='myadopts.php?act=manage&id="
.$aid."' class='button buttoncarefor center'>".$lang_caremenu_stats2_t."</a></div>
            <div id='p1'>"
.$levelupbutton."</div>
            <div id='p2'>"
.$lang_caremenu_biobutton."</div>
            <div id='p3'>"
.$lang_caremenu_occupationbutton."</div>
            <div id='p1'><a href='myadopts.php?act=stats&id="
.$aid."' class='button buttoncarefor center'>".$lang_caremenu_stats_t."</a></div>
            <div id='p2'><a href='myadopts.php?act=bbcode&id="
.$aid."' class='button buttoncarefor center'>".$lang_caremenu_codes_t."</a></div>
            <div id='p3'>"
.$renamebutton."</div>
            <div id='p1'><a href='myadopts.php?act=freeze&id="
.$aid."' class='button buttoncarefor center'>".$status2."</a></div>
            <div id='p1'><a href='myadopts.php?act=kill&id="
.$aid."' class='button buttoncarefor center'>".$lang_caremenu_setfree_t."</a></div>
            </div>
    </div>
</div>

        </div>
    </div>
    <div id='p_middle_right'></div>
    <div id='p_down_left'></div>
    <div id='p_down'></div>
    <div id='p_down_right'></div>
</div>
</div>
<!-- google_ad_section_end -->"
;

}


}
else{

$article_title $err_idnoexist;
$article_content "<!-- google_ad_section_start(weight=ignore) -->
<div class='npc3'><p class='titania2'><img src='templates/default/images/npc_1_s.png' width='70' height='70' border='0' alt='Titania' />"
.$err_idnoexist_text."</p></div>
<!-- google_ad_section_end -->"
;

}
}
else{

$article_title $err_idnoexist;
$article_content "<!-- google_ad_section_start(weight=ignore) -->
<div class='npc3'><p class='titania2'><img src='templates/default/images/npc_1_s.png' width='70' height='70' border='0' alt='Titania' />"
.$err_idnoexist_text."</p></div>
<!-- google_ad_section_end -->"
;

}


Reply With Quote