View Single Post
  #1  
Old 02-27-2017, 06:35 PM
Dinocanid's Avatar
Dinocanid Dinocanid is offline
Member
 
Join Date: Aug 2016
Location: Maryland, USA
Posts: 516
Gender: Unknown/Other
Credits: 95,758
Dinocanid is on a distinguished road
Default Limiting adopt amount not working correctly

Another issue I've run into recently. I have a very basic system on my site where users can only adopt/breed a certain amount of adoptables before they need more space. The problem is that users can't seem to buy more than 35 spaces, even if the currency comes out of their account. There also seems to be a problem with users still being able to get adoptables from the adoption center, even though I use the exact same code on the other pages to stop users from going over. I can't seem to do it myself if at full capacity, but other users on the site say that they still can.

PHP Code:
$shelfSpace $mysidia->db->select("users", array("shelfspace"), "username = '{$mysidia->user->username}'")->fetchColumn(); 
        
$adoptAmount $mysidia->db->select("owned_adoptables", array("aid"), "owner = '{$mysidia->user->username}'")->rowCount();
        if(
$userStatus->canbreed == "no") throw new NoPermissionException("permission");
        elseif(
$adoptAmount >= $shelfSpace){
        throw new 
NoPermissionException("Your pantry is full. Try clearing some space or buy an expansion!");

(An example of it in breeding.php)

PHP Code:
             if($mysidia->input->post("buyspace")){
$mysidia->user->changecash(-100);
$mysidia->db->update("users", array("shelfspace" => ($mysidia->user->shelfspace 10)), "username = '{$mysidia->user->username}'"); 
(Part of the code where the users can buy space)

The really strange part is that it seems to be linked to the amount of spaces I have, which is 35. In phpMyAdmin, space is not shared and is stored with the individual user. The system will acknowledge that the user has bought space, but they still won't be able to keep more than 35 pets.
__________________

Last edited by Dinocanid; 02-27-2017 at 06:38 PM.
Reply With Quote