Mysidia Adoptables Support Forum  

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

Notices

Reply
 
Thread Tools Display Modes
  #1  
Old 07-22-2009, 04:43 PM
arlecchina arlecchina is offline
Member
 
Join Date: Feb 2009
Posts: 65
Credits: 3,605
arlecchina
Default levelup.php - Message if user owns pet they are leveled up/can't level up

I want the message a user gets when they level up their own pet to be different than a message they would get if they were leveling up another user's pet. I tried this but it's not working.

PHP Code:
if($loggedinname == $owner){

$ownerinfo "You own this pet.";

}

else {

$ownerinfo "";


I would insert $ownerinfo into the general message that the user receives when they level up or can't level up a pet.

Thanks for any insight or help in advance.
Reply With Quote
  #2  
Old 07-23-2009, 02:37 PM
BMR777 BMR777 is offline
Member
 
Join Date: Jan 2011
Posts: 1,122
Gender: Male
Credits: 10,719
BMR777 is on a distinguished road
Default RE: levelup.php - Message if user owns pet they are leveled up/can't level up

What's the whole code you are using? You would have to also edit the $article_content variable as well. :)
Reply With Quote
  #3  
Old 07-24-2009, 11:04 AM
arlecchina arlecchina is offline
Member
 
Join Date: Feb 2009
Posts: 65
Credits: 3,605
arlecchina
Default RE: levelup.php - Message if user owns pet they are leveled up/can't level up

Here is the whole levelup.php code. I'm sorry about the horizontal scrolling. I tried to shorten the lines but some of them I am afraid to break up without messing up something.
PHP Code:
<?php

// **********************************************************************
// Rusnak PHP Adoptables Script
// Copyright 2009 Brandon Rusnak
// For help and support: http://www.rusnakweb.com/forum/
//
// Redistribution prohibited without written permission
// **********************************************************************

// Wake the sleeping giant

// **********************************************************************
// Basic Configuration Info
// **********************************************************************

include("inc/functions.php");
include(
"inc/config.php");
include(
"lang/lang.php");

$themeurl grabanysetting("themeurl");

// **********************************************************************
// Define our top links by calling getlinks()
// **********************************************************************

$links getlinks();

// **********************************************************************
// Define our ads by calling getads()
// **********************************************************************

$ads getads("any");

// **********************************************************************
// Grab any dynamic article content from the content table
// **********************************************************************

$pagecontent getsitecontent("index");
$article_title $pagecontent[title];
$article_content $pagecontent[content];
$article_content nl2br($article_content);

// **********************************************************************
// Grab any settings that we will need for the current page from the DB
// **********************************************************************

$browsertitle grabanysetting("browsertitle");
$sitename grabanysetting("sitename");
$slogan grabanysetting("slogan");

// **********************************************************************
// Check and see if the user is logged in to the site
// **********************************************************************

$loginstatus logincheck();
$isloggedin $loginstatus[loginstatus];
$loggedinname $loginstatus[username];

// **********************************************************************
// End Prepwork - Output the page to the user
// **********************************************************************

$id $_GET["id"];
$id preg_replace("/[^a-zA-Z0-9s]/"""$id);
$id secure($id);

if(
$id == "" or !is_numeric($id)){

// If the ID is blank or non-numeric, then it is invalid...

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

}
else{

// We have what appears to be a valid adoptable ID, so we pull the adoptable's information from the database...

$query "SELECT * FROM ".$prefix."owned_adoptables WHERE aid='$id'";
$result mysql_query($query);
$num mysql_numrows($result);

//Loop out code
$i=0;
while (
$i 1) {

$aid=@mysql_result($result,$i,"aid");
$type=@mysql_result($result,$i,"type"); 
$name=@mysql_result($result,$i,"name");
$totalclicks=@mysql_result($result,$i,"totalclicks");
$currentlevel=@mysql_result($result,$i,"currentlevel"); 
$usealternates=@mysql_result($result,$i,"usealternates");
$isfrozen=@mysql_result($result,$i,"isfrozen");
$owner=@mysql_result($result,$i,"owner");

$i++;
}

if(
$aid == $id){

// The adoptable does exist, so now we need to see if we can vote...
// We need to get the date today and the user's IP address (if is guest we use this)

$date date('Y-m-d');

$ip $_SERVER['REMOTE_ADDR']; 
$ip preg_replace("/[^a-zA-Z0-9@._-]/"""$ip);
$ip secure($ip);

$num 0;

if(
$isloggedin == "yes"){

// If we are logged in, we check if a user with our username voted for this adoptable today...

$query "SELECT * FROM ".$prefix."vote_voters WHERE adoptableid='$id' and username = '$loggedinname' and date = '$date'";

}
else{

$query "SELECT * FROM ".$prefix."vote_voters WHERE adoptableid='$id' and ip = '$ip' and date = '$date'";


// End the is logged in check else statement


// Check what the number for the query is...

$result mysql_query($query);
$num mysql_numrows($result);

    if(
$num == 0){

    
// The number of results is still zero, so we did not vote on this adoptable yet today...
    
    // Now we see if the adoptable is frozen by its owner.  If it is, we do not level...

    
if($isfrozen == "yes"){

    
$article_title $lang_isfrozen_title;
    
$article_content "<!-- google_ad_section_start(weight=ignore) -->
    <div class='npc'><p class='titania'><img src='templates/default/images/npc_1_s.png' width='185' height='185' border='0' alt='Titania' />"
.$lang_isfrozen_explain."</p></div>
    <!-- google_ad_section_end -->"
;

    }
    else{

    
// Adoptable is NOT frozen, so I think we can actually proceed with the leveling up of this adoptable...

    
$newclicks $totalclicks 1// Add 1 click to the current click total of this adoptable...

    // Actually insert our click information into the database...

    
$query "UPDATE ".$prefix."owned_adoptables SET totalclicks='".$newclicks."' WHERE aid='".$id."'";
    
mysql_query($query);

    
// Now we need to update our vote_voters table with the user's vote...

    
mysql_query("INSERT INTO ".$prefix."vote_voters VALUES ('$date', '$loggedinname', '$ip','$id')");

    
// Now we need to see if we actually level this adoptable up...
    // See if another level actually exists...

    
$nextlevelexists getnextlevelexists($type$currentlevel);

    if(
$nextlevelexists == "true"){

    
// A higher level does exist, so we see if it is time to level up

    
$nextlevel $currentlevel 1;

    
$query "SELECT * FROM ".$prefix."levels WHERE adoptiename='$type' and thisislevel='$nextlevel'";
    
$result mysql_query($query);
    
$num mysql_numrows($result);

    
//Loop out code
    
$i=0;
    while (
$i 1) {
 
    
$requiredclicks=@mysql_result($result,$i,"requiredclicks");  // The number of clicks required for the next level

    
$i++;
    }    

    
// Check if the number of clicks we have now is greater than or equal to the required clicks to level up...

    
if($newclicks >= $requiredclicks and $requiredclicks != and $requiredclicks != ""){

    
// We need to level this adoptable up...

    
$query "UPDATE ".$prefix."owned_adoptables SET currentlevel='".$nextlevel."' WHERE aid='".$id."'";
    
mysql_query($query);

    
// Now we check if we are enabling alternate images...
    
    
$parentid converttypetoparentid($type); // Get the ID of the parent type adoptable
    
$altstatus getaltstatus($parentid$id$nextlevel); // Check if we are using alternate images or not...

    
if($altstatus == "yes"){

    
// We are enabling alternate images for this adoptable...

    
$query "UPDATE ".$prefix."owned_adoptables SET usealternates='yes' WHERE aid='".$id."'";
    
mysql_query($query);

    }

    
// Now we can see if the adoptable's owner gets a reward...
    // The reward function will take care of sending out any reward that exists...

    
$rewardstatus reward($id$type$nextlevel$owner);

    } 
// End the if statement if we are leveling the adoptable up

    
}

    
// Show a thank you message along with the adoptable's information to the user...

    
$image getcurrentimage($id); // Get the current image of the adoptable...

        
if($loggedinname == $owner){

        
$ownerinfo "<p class='titania'>Would you like to <a href='myadopts.php'>care for your Royals</a>?</p>";

        }
        else {

        
$ownerinfo "";

        } 

    
$article_title $lang_gave_title;
    
$article_content "<!-- google_ad_section_start(weight=ignore) -->
    <div class='npc'><p class='titania'><img src='templates/default/images/npc_1_s.png' width='185' height='185' border='0' alt='Titania' />"
.$lang_gave." <span class='bold'>".$name."</span> ".$lang_gave2." ".$lang_unit."".$lang_gave3."</p>
    <p class='titania'>"
.$lang_levelup_encourage1." <span class='bold'>".$name."</span> ".$lang_levelup_encourage2."</p><p class='titania'>".$name."'s Owner, <a href='profile.php?user=".$owner."'>".$owner."</a>, may have more Royals you can help grow on their <a href='profile.php?user=".$owner."'>Profile</a>.</p>
    "
.$ownerinfo."</div>
    <div class='width100 center'><a href='levelup.php?id="
.$aid."'><img src='".$image."' alt='".$name."' /></a></div>
    <!-- google_ad_section_end -->"
;
    
    } 
// Adoptable is not frozen, end isfrozen else check
    
    
}
    else{

    
// We already voted on this adoptable today, so show an error...

    
$image getcurrentimage($id); // Get the current image of the adoptable...

        
if($isloggedin == "yes"){

        
$article_title $lang_alreadyleveled_title;
        
$article_content "<!-- google_ad_section_start(weight=ignore) -->
        <div class='npc'>
        <p class='titania'>
        <img src='templates/default/images/npc_1_s.png' width='185' height='185' border='0' alt='Titania' />"
.$lang_member_alreadyleveled1." <span class='bold'>".$name."</span> ".$lang_member_alreadyleveled2." <span class='bold'>".$name."</span> ".$lang_member_alreadyleveled3." <span class='bold'>".$name."</span> ".$lang_member_alreadyleveled4."</p>
        <p class='titania'>"
.$name."'s Owner, <a href='profile.php?user=".$owner."'>".$owner."</a>, may have more Royals you can help grow on their <a href='profile.php?user=".$owner."'>Profile</a>.</p>
        "
.$ownerinfo."</div>
        <div class='width100 center'><a href='levelup.php?id="
.$aid."'><img src='".$image."' alt='".$name."' /></a></div>
        <!-- google_ad_section_end -->"
;

        }
        else{

        
$article_title $lang_alreadyleveled_title;;
        
$article_content "<!-- google_ad_section_start(weight=ignore) -->
        <div class='npc'>
        <p class='titania'>
        <img src='templates/default/images/npc_1_s.png' width='185' height='185' border='0' alt='Titania' />"
.$lang_guest_alreadyleveled1." <span class='bold'>".$name."</span> ".$lang_guest_alreadyleveled2." <span class='bold'>".$name."</span> ".$lang_guest_alreadyleveled3." <span class='bold'>".$name."</span> ".$lang_guest_alreadyleveled4."</p>
        <p class='titania'>"
.$name."'s Owner, <a href='profile.php?user=".$owner."'>".$owner."</a>, may have more Royals you can help grow on their <a href='profile.php?user=".$owner."'>Profile</a>.</p></div>
        <div class='width100 center'>
        <a href='levelup.php?id="
.$aid."'><img src='".$image."' alt='".$name."' /></a>
        </div>
        <!-- google_ad_section_end -->"
;
        }
    }

}
else{

// Adoptable is invalid, show an error...

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

}

// End the ID is not blank and is numeric else check

// **********************************************************************
// Begin Template Definition
// **********************************************************************

//Define our current theme
$file $themeurl;

// Do the template changes and echo the ready template
$template file_get_contents($file);

$template replace(':ARTICLETITLE:',$article_title,$template);
$template replace(':ARTICLECONTENT:',$article_content,$template);
$template replace(':ARTICLEDATE:',$article_date,$template);

$template replace(':BROWSERTITLE:',$browsertitle,$template);
$template replace(':SITENAME:',$sitename,$template);

//Define our links
$template replace(':LINKSBAR:',$links,$template);

//Get the content for the side bar...

$sidebar getsidebar();
$template replace(':SIDEFEED:',$sidebar,$template);

//Get the ad content...
$template replace(':ADS:',$ads,$template);

//Get the slogan info
$template replace(':SLOGAN:',$slogan,$template);

echo 
$template;

// **********************************************************************
// End Template Definition
// **********************************************************************

?>
Reply With Quote
  #4  
Old 07-24-2009, 11:22 AM
BMR777 BMR777 is offline
Member
 
Join Date: Jan 2011
Posts: 1,122
Gender: Male
Credits: 10,719
BMR777 is on a distinguished road
Default RE: levelup.php - Message if user owns pet they are leveled up/can't level up

The code looks ok. What happens if the owner is the same as the logged in user? Is the message displayed or is nothing always displayed?
Reply With Quote
  #5  
Old 07-24-2009, 02:00 PM
arlecchina arlecchina is offline
Member
 
Join Date: Feb 2009
Posts: 65
Credits: 3,605
arlecchina
Default RE: levelup.php - Message if user owns pet they are leveled up/can't level up

Quote:
Originally Posted by BMR777
The code looks ok. What happens if the owner is the same as the logged in user? Is the message displayed or is nothing always displayed?
Nothing is always displayed but of course the message should display if the owner is the logged in user but it doesn't work.
Reply With Quote
  #6  
Old 07-28-2009, 04:45 PM
arlecchina arlecchina is offline
Member
 
Join Date: Feb 2009
Posts: 65
Credits: 3,605
arlecchina
Default RE: levelup.php - Message if user owns pet they are leveled up/can't level up

Any ideas on why this isn't working? Thanks in advance. You're very helpful.
Reply With Quote
  #7  
Old 07-28-2009, 04:52 PM
BMR777 BMR777 is offline
Member
 
Join Date: Jan 2011
Posts: 1,122
Gender: Male
Credits: 10,719
BMR777 is on a distinguished road
Default RE: levelup.php - Message if user owns pet they are leveled up/can't level up

I don't see any reason why it shouldn't work. Are you sure that the $loggedinname variable is equaling the $owner one? I would check by echoing the values of both before running the check and make sure they match. :)
Reply With Quote
Reply


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

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

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to automatically send a new user a welcome message pachoofoosh Tutorials and Tips 8 07-16-2017 12:18 PM
Adoptable Change When Leveled. NobodysHero Questions and Supports 0 06-25-2014 01:01 PM
Help with levelup in 1.3.3? Infernette Questions and Supports 1 03-25-2013 05:47 PM
Already LEveled but haven't SilverDragonTears Questions and Supports 3 11-01-2012 10:35 AM
Show who recently leveled up a given adoptable kisazeky Addons/Mods Graveyard 3 04-04-2009 05:56 PM


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

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





What's New?

What's Hot?

What's Popular?


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