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 09-01-2011, 09:46 AM
Abronsyth's Avatar
Abronsyth Abronsyth is offline
A Headache Embodied
 
Join Date: Aug 2011
Location: NY
Posts: 1,011
Gender: Male
Credits: 113,351
Abronsyth is on a distinguished road
Default Last Question

Okay, this is the last question for a while, I have it set that once an adoptable gets 10 clicks, it levels up, however, there are at least 7 Adoptables currently having over 10 clicks, and they are all still on Level 0...

...I tried looking through the levelup.php, but PHP is definitely not my strong point, so if something was messing it up, I couldn't tell.

Anyone know how to fix this?
__________________
My Mods Site (1.3.4, 2020 Mods)
Reply With Quote
  #2  
Old 09-01-2011, 01:37 PM
SilverDragonTears's Avatar
SilverDragonTears SilverDragonTears is offline
I am your Nemesis.
 
Join Date: Jun 2011
Posts: 1,113
Gender: Female
Credits: 82,325
SilverDragonTears is on a distinguished road
Default

Can you post your levelup.php here?
__________________

Check out SilvaTales
Reply With Quote
  #3  
Old 09-01-2011, 05:36 PM
Abronsyth's Avatar
Abronsyth Abronsyth is offline
A Headache Embodied
 
Join Date: Aug 2011
Location: NY
Posts: 1,011
Gender: Male
Credits: 113,351
Abronsyth is on a distinguished road
Default

Sure, one second....
here:
Code:
<?php

include("inc/functions.php");

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

$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 = $err_idnoexist_text;

}
else{

// We have what appears to be a valid adoptable ID, so we pull the adoptable's information from the database...
$result = runquery("SELECT * FROM {$prefix}owned_adoptables WHERE aid='{$id}'");
$owned_adoptable = mysql_fetch_array($result);

if($owned_adoptable['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 = runquery($query);
$num = mysql_num_rows($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($owned_adoptable['isfrozen'] == "yes"){

	$article_title = $lang_isfrozen_title;
	$article_content = $lang_isfrozen_explain;

	}
	else{

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

	$newclicks = $owned_adoptable['totalclicks']+ 1; // Add 1 click to the current click total of this adoptable...

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

    runquery("UPDATE {$prefix}owned_adoptables SET totalclicks='{$newclicks}' WHERE aid='{$id}'");

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

	runquery("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($owned_adoptable['type'], $owned_adoptable['currentlevel']);

	if($nextlevelexists == "true"){

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

	$nextlevel = $owned_adoptable['currentlevel'] + 1;

    $result2 = runquery("SELECT * FROM {$prefix}levels WHERE adoptiename='{$type}' and thisislevel='{$nextlevel}'");
    $level = mysql_fetch_array($result2);
	
	// Check if the number of clicks we have now is greater than or equal to the required clicks to level up...

	if($newclicks >= $level['requiredclicks'] and $level['requiredclicks'] != 0 and $level['requiredclicks'] != ""){

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

	runquery("UPDATE {$prefix}owned_adoptables SET currentlevel='{$nextlevel}' WHERE aid='{$id}'");
	
	// Now we check if we are enabling alternate images...
	
	$parentid = converttypetoparentid($owned_adoptable['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...
	runquery("UPDATE {$prefix}owned_adoptables SET usealternates='yes' WHERE aid='{$id}'");

	}

	// 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, $owned_adoptable['type'], $nextlevel, $owned_adoptable['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...

	$article_title = $lang_gave."{$owned_adoptable['name']} one ".$lang_unit;
	$article_content = "<img src='{$image}'><br>{$lang_gave}{$owned_adoptable['name']}	one {$lang_unit}.<br>".$lang_levelup_encourage;
	

	} // Adoptable is not frozen, end isfrozen else check
 
    if($owned_adoptable['isfrozen'] == "no"){ 
	$reward = clickreward(grabanysetting('rewardmoney'), $GLOBALS['username'], $GLOBALS['money']);
	$newamount = $GLOBALS['money'] + $reward;
	runquery("UPDATE {$GLOBALS['prefix']}users SET `money` = '{$newamount}' WHERE `username` = '{$loggedinname}'");
	$article_content = $article_content . "<div align='center'><br />You have earned {$reward} ".grabanysetting('cost')." for leveling up this adoptable. <br />You now have {$newamount} ".grabanysetting('cost')."</div>";
    }

	}
	else{

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

		if($isloggedin == "yes"){

		$article_title = $lang_alreadyleveled_title;
		$article_content = $lang_member_alreadyleveled;

		}
		else{

		$article_title = $lang_alreadyleveled_title;;
		$article_content = $lang_guest_alreadyleveled;


		}

	}


}
else{

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

$article_title = $err_idnoexist;
$article_content = $err_idnoexist_text;

}



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


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

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

?>
__________________
My Mods Site (1.3.4, 2020 Mods)
Reply With Quote
  #4  
Old 09-01-2011, 05:49 PM
SilverDragonTears's Avatar
SilverDragonTears SilverDragonTears is offline
I am your Nemesis.
 
Join Date: Jun 2011
Posts: 1,113
Gender: Female
Credits: 82,325
SilverDragonTears is on a distinguished road
Default

Which version of MS are you running and have you changed anything in this page?
__________________

Check out SilvaTales
Reply With Quote
  #5  
Old 09-01-2011, 05:59 PM
Abronsyth's Avatar
Abronsyth Abronsyth is offline
A Headache Embodied
 
Join Date: Aug 2011
Location: NY
Posts: 1,011
Gender: Male
Credits: 113,351
Abronsyth is on a distinguished road
Default

Says it's version 1.2.2, and I have not touched the levelup.php at all.
__________________
My Mods Site (1.3.4, 2020 Mods)
Reply With Quote
  #6  
Old 09-01-2011, 06:03 PM
SilverDragonTears's Avatar
SilverDragonTears SilverDragonTears is offline
I am your Nemesis.
 
Join Date: Jun 2011
Posts: 1,113
Gender: Female
Credits: 82,325
SilverDragonTears is on a distinguished road
Default

I think this is the newer version which I don't have and haven't looked at. HOF could it be this part?

Code:
runquery("UPDATE {$prefix}owned_adoptables SET tot
which on my levelup.php it looks like
Code:
$query = "UPDATE ".$prefix."owned_adoptables SET totalclicks='".$newclicks."' WHERE aid='".$id."'";
	runquery($query);
I'll need HOF to confirm it though...
__________________

Check out SilvaTales
Reply With Quote
  #7  
Old 09-01-2011, 06:11 PM
Abronsyth's Avatar
Abronsyth Abronsyth is offline
A Headache Embodied
 
Join Date: Aug 2011
Location: NY
Posts: 1,011
Gender: Male
Credits: 113,351
Abronsyth is on a distinguished road
Default

Could very well be it, I don't know, I'm fairly certain you're quite a bit better with PHP then myself XD

I'll see what HOF says, then test it out to see if that is, indeed, the problem.
__________________
My Mods Site (1.3.4, 2020 Mods)
Reply With Quote
  #8  
Old 09-01-2011, 07:13 PM
Hall of Famer's Avatar
Hall of Famer Hall of Famer is offline
Administrator, Lead Coder
 
Join Date: Dec 2008
Location: South Brunswick
Posts: 4,448
Gender: Male
Credits: 333,039
Hall of Famer is on a distinguished road
Default

Well this is caused by two typos made at levels.php. I've attached the levelup.php again, upload it to your server to overwrite the old file. Lemme know if it still wont fix your problem.
Attached Files
File Type: php levelup.php (5.7 KB, 2 views)
__________________


Mysidia Adoptables, a free and ever-improving script for aspiring adoptables/pets site.
Reply With Quote
  #9  
Old 09-02-2011, 11:52 AM
Abronsyth's Avatar
Abronsyth Abronsyth is offline
A Headache Embodied
 
Join Date: Aug 2011
Location: NY
Posts: 1,011
Gender: Male
Credits: 113,351
Abronsyth is on a distinguished road
Default

Whoo, it's fixed now! Thanks, HOF! Hopefully that's the last glitch for now :)
__________________
My Mods Site (1.3.4, 2020 Mods)
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


All times are GMT -5. The time now is 02:58 AM.

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