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-01-2011, 11:17 PM
xCataluna xCataluna is offline
Member
 
Join Date: Jul 2011
Posts: 6
Gender: Female
Credits: 518
xCataluna is on a distinguished road
Default Help altering levelup.php

Hello. :3

I've recently been trying to add a line to the page you see when leveling an adoptable... and failing. X3

We have an adoptable with a promocode attached to each level. The rewards system sends it to the pet owner, of course, but we would like to have a link displayed on the levelup page as a thank you to the person clicking.

I need the page to check if the adoptable is type "Happy Birthday".
If yes, I need it to check the current level and retrieve the associated promocode.
And then I need to make it display a little message with the link containing the promocode.

And I can't figure how to do it. >.<
I only know as much php as I've taught myself, and I've no idea how mysql works. I think I may have developed an irrational fear of it. XD

So I come to you, and beg your help and your patience, please. :3
Reply With Quote
  #2  
Old 07-02-2011, 05:03 AM
Chibi_Chicken Chibi_Chicken is offline
Niwatori Kami
 
Join Date: Jun 2011
Posts: 63
Gender: Unknown/Other
Credits: 5,028
Chibi_Chicken is on a distinguished road
Default

Well my suggestion after looking at the levelup and reward function would be.
after the line
Code:
$rewardstatus = reward($id, $type, $nextlevel, $owner);
check if $type is the Happy Birthday type
if true then get the promocode from the adopt.

sql command:
Code:
"SELECT * FROM ".$GLOBALS['prefix']."levels WHERE adoptiename='$type' and thisislevel='$nextlevel'"
with the result grab the $promocode and build a link:
Code:
$promocode=@mysql_result($result, 0,"promocode");
<a href='promo.php?promocode=".$promocode."'>HERE IS A LINK TO PROMOCODE: $promocode</a>
where you could display that link would be
Code:
 	$article_content = "<img src='".$image."'><br>".$lang_gave."".$name." one ".$lang_unit.".<br>".$lang_levelup_encourage;
or at
Code:
	$article_content = $article_content . "<div align='center'><br />You have earned ". grabanysetting('rewardmoney') ." ". grabanysetting('cost') ." for leveling up this adoptable. <br />You now have {$GLOBALS['money']} ".grabanysetting('cost')."</div>";
The problems that i can see with this is if the pet didnt level up it will still try to display a link.
Reply With Quote
  #3  
Old 07-02-2011, 11:03 PM
xCataluna xCataluna is offline
Member
 
Join Date: Jul 2011
Posts: 6
Gender: Female
Credits: 518
xCataluna is on a distinguished road
Default

Thank you so much, it works! ^___^

And it does display a link at all times, which is good, we want that. :3
But, unsurprisingly, the link is blank if the pet doesn't level, which is bad.
Is there any way to make it always display the promocode?

Edit: I moved the code down to the bottom, as part of the OUTPUT PAGE section.
That got it to display the promocodes, and I even managed to make the link only display on "Happy Birthday" pages. :3

But I have one more wee problem. When I moved it, it stopped displaying the promocode for the current level, now its displaying the one for the next level. And changing $nextlevel to $currentlevel in the query has no affect. o_o

What am I doing wrong?

Last edited by xCataluna; 07-03-2011 at 02:09 AM.
Reply With Quote
  #4  
Old 07-03-2011, 04:41 AM
Chibi_Chicken Chibi_Chicken is offline
Niwatori Kami
 
Join Date: Jun 2011
Posts: 63
Gender: Unknown/Other
Credits: 5,028
Chibi_Chicken is on a distinguished road
Default

Quote:
Originally Posted by xCataluna View Post
Thank you so much, it works! ^___^

But I have one more wee problem. When I moved it, it stopped displaying the promocode for the current level, now its displaying the one for the next level. And changing $nextlevel to $currentlevel in the query has no affect. o_o

What am I doing wrong?
I am not sure why it would do that; However looking back and your first post and understanding the problem more I suggest this.
On line 165 or before "// Show a thank you message along with the adoptable's information to the user..."

Check if it is the right type of adoptable then add in this query since we dont know if the pet leveled up or not and grab the $currentlevel

sql: "SELECT * FROM ".$prefix."owned_adoptables WHERE aid='$id'";
get: $currentlevel

then query to get the $promocode

sql: "SELECT * FROM ".$prefix."levels WHERE adoptiename='$type' and thisislevel='$currentlevel'"
get: $promocode

then build the link and display it I would recomend at
Code:
$article_content = $article_content . "<div align='center'><br />You have earned ". grabanysetting('rewardmoney') ." ". grabanysetting('cost') ." for leveling up this adoptable. <br />You now have {$GLOBALS['money']} ".grabanysetting('cost')."</div>";
Quote:
Originally Posted by xCataluna View Post
Edit: I moved the code down to the bottom, as part of the OUTPUT PAGE section.
I dont recomend putting any code outside of the error/if checking you get more bugs or possible exploits

side note:
bugs that I have notticed about leveling up,
if you are logged out and click on the pet then log in you can click again but not the other way around.
why is it showing you earned money when you are a visitor and not logged in?
You could add a hook and suggest if you had been logged in/ sign up you could have earned that money.
Reply With Quote
  #5  
Old 07-03-2011, 04:30 PM
xCataluna xCataluna is offline
Member
 
Join Date: Jul 2011
Posts: 6
Gender: Female
Credits: 518
xCataluna is on a distinguished road
Default

Alright I've tried those queries, and it still uses the next promocode instead of the current one. I tried subtracting one from the $currentlevel before calling for the promocode, and that didn't work either. >.<

I wondered if it had something to do with the egg level having no promocode, so I added one to the database... no luck. :p

Could it be some sort of problem associated with the egg level being zero, instead of one?

I'm about ready to headdesk, but thank you for helping. X3
Reply With Quote
  #6  
Old 07-04-2011, 11:21 AM
Chibi_Chicken Chibi_Chicken is offline
Niwatori Kami
 
Join Date: Jun 2011
Posts: 63
Gender: Unknown/Other
Credits: 5,028
Chibi_Chicken is on a distinguished road
Default

echo out the sql queries and see what $currentlevel value is, maybe it is getting the wrong value somewhere.
Reply With Quote
  #7  
Old 07-07-2011, 02:33 AM
xCataluna xCataluna is offline
Member
 
Join Date: Jul 2011
Posts: 6
Gender: Female
Credits: 518
xCataluna is on a distinguished road
Default

Alrighty~

I echoed $currentlevel and got a blank, which was weird.
So I changed the query to reference $image instead, which echoed properly.
But the displayed promocode was the same. >__<

We decided to just work around the problem by shifting the promocode entries in mySQL one. So now the displayed promocode is correct.

Not the most elegant solution, but it works now. :3
Thank you so much for all your help. <3
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
Help with levelup in 1.3.3? Infernette Questions and Supports 1 03-25-2013 05:47 PM
Levelup Problems? Tequila Questions and Supports 4 11-18-2011 11:52 PM
help with levelup.php please Sensacionsk8 Questions and Supports 7 02-27-2011 01:44 PM
help me with levelup.php Sensacionsk8 Questions and Supports 0 02-23-2011 05:48 PM
levelup issue ipman Questions and Supports 8 01-26-2011 09:33 AM


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

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