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
  #21  
Old 04-06-2017, 09:43 PM
kristhasirah's Avatar
kristhasirah kristhasirah is offline
Member
 
Join Date: Jan 2010
Location: In middle of the nothingness
Posts: 196
Gender: Female
Credits: 28,392
kristhasirah
Default

Will test the code tomorrow and see if i can help you find a way to make it work ^^ if not lets hope one of the most experienced members can help you, sadly i dont have too much experience in coding and cant help you much.

I think i found a way to make it work, dont know if you have tried this:

PHP Code:
<?php 

class AdoptView extends View
     
    public function 
index(){ 
        
$mysidia Registry::get("mysidia"); 
        
$document $this->document
        if(
$mysidia->user->money 499){ 
        echo 
"<script type='text/javascript'>alert('You do not have enough money!')</script>";
        
$mysidia->session->terminate("adopt");
        }
        else{          
        if(
$mysidia->input->post("submit")){             
            
$aid $this->getField("aid")->getValue(); 
            
$name $this->getField("name")->getValue(); 
            
$eggImage $this->getField("eggImage")->getValue(); 
            
$image = new Image($eggImage); 
            
$image->setLineBreak(TRUE);     
            
$mysidia->user->changecash(-500);  
             
            
$document->setTitle("{$name} adopted successfully");             
            
$document->add($image); 
            
$document->addLangvar("Congratulations!  You just adopted {$name}. You can now manage {$name} on the "); 
            
$document->add(new Link("myadopts""Myadopts Page.")); 
            
$document->add(new Comment("")); 
            
$document->add(new Link("myadopts/manage/{$aid}""Click Here to Manage {$name}")); 
            
$document->add(new Comment("")); 
            
$document->add(new Link("myadopts/bbcode/{$aid}""Click Here to get BBCodes/HTML Codes for {$name}")); 
            
$document->add(new Comment("")); 
            
$document->addLangvar("Be sure and"); 
            
$document->add(new Link("levelup/{$aid}""feed ")); 
            
$document->addLangvar("{$name} with clicks so that they grow!"); 
            
$mysidia->session->terminate("adopt");   
            return;             
            } 
         } 
        
$document->setTitle($mysidia->lang->title); 
        
$document->addLangvar((!$mysidia->user->isloggedin)?$mysidia->lang->guest:$mysidia->lang->member);           
        
$adoptForm = new Form("form""adopt""post"); 
        
$adoptTitle = new Comment("Available Species"); 
        
$adoptTitle->setHeading(3); 
        
$adoptForm->add($adoptTitle); 
        
$adoptTable = new Table("table"""FALSE); 
          
         
         
          
      
    
    
$adoptform "<form name='form1' method='post' action='$adopt'> <table id='adoptdark' name='adopt' class='adopt'>";  
    
$common 0;   
    
$uncommon rand(1,50);     
    
$rare rand(1,100);     
    
$veryrare rand(1,200);  
    
$endangered rand(1,300);     

    if (
$uncommon==&& $onlyone==0){     
    
$query "SELECT * FROM ".constant('PREFIX'). "adoptables WHERE rarity='Uncommon' ORDER BY RAND() LIMIT 1";   
$onlyone 1;     
    }     
    else if (
$rare==&& $onlyone==0){     
    
$query "SELECT * FROM ".constant('PREFIX'). "adoptables WHERE rarity='Rare' ORDER BY RAND() LIMIT 1";   
$onlyone 1;     
    }         
    else if (
$veryrare==1  && $onlyone==0){     
    
$query "SELECT * FROM ".constant('PREFIX'). "adoptables WHERE rarity='Very Rare' ORDER BY RAND() LIMIT 1";   
$onlyone 1;     
    }    
    else if (
$endangered==1  && $onlyone==0){     
    
$query "SELECT * FROM ".constant('PREFIX'). "adoptables WHERE rarity='Endangered' ORDER BY RAND() LIMIT 1";   
$onlyone 1;     
    }       
    else{     
    
$query "SELECT * FROM ".constant('PREFIX'). "adoptables WHERE rarity='Common' ORDER BY RAND() LIMIT 1";     
    }     
    
$stmt $mysidia->db->query($query);    
      
        while(
$row $stmt->fetchObject()) {  

            
$adoptform .= "<td width='25%' VALIGN='center'><div align=center><img src='../../picuploads/unknownegg.png' /></div></a><br><div align=center><input type='radio' name='id' id='id' value='{$row->id}' /></div><div align=center></td>";  
          
        }  
      
      
    
$common 0;   
    
$uncommon rand(1,50);     
    
$rare rand(1,100);     
    
$veryrare rand(1,200);  
    
$endangered rand(1,300);     

    if (
$uncommon==&& $onlyone==0){     
    
$query "SELECT * FROM ".constant('PREFIX'). "adoptables WHERE rarity='Uncommon' ORDER BY RAND() LIMIT 1";   
$onlyone 1;     
    }     
    else if (
$rare==&& $onlyone==0){     
    
$query "SELECT * FROM ".constant('PREFIX'). "adoptables WHERE rarity='Rare' ORDER BY RAND() LIMIT 1";   
$onlyone 1;     
    }         
    else if (
$veryrare==1  && $onlyone==0){     
    
$query "SELECT * FROM ".constant('PREFIX'). "adoptables WHERE rarity='Very Rare' ORDER BY RAND() LIMIT 1";   
$onlyone 1;     
    }    
    else if (
$endangered==1  && $onlyone==0){     
    
$query "SELECT * FROM ".constant('PREFIX'). "adoptables WHERE rarity='Endangered' ORDER BY RAND() LIMIT 1";   
$onlyone 1;     
    }       
    else{     
    
$query "SELECT * FROM ".constant('PREFIX'). "adoptables WHERE rarity='Common' ORDER BY RAND() LIMIT 1";     
    }     
    
$stmt $mysidia->db->query($query);    

    while(
$row $stmt->fetchObject()) {  

            
$adoptform2 .= "<td width='25%' VALIGN='center'><div align=center><img src='../../picuploads/unknownegg.png' /></div></a><br><div align=center><input type='radio' name='id' id='id' value='{$row->id}' /></div></td>";  

              
   }   
     
    
$common 0;   
    
$uncommon rand(1,50);     
    
$rare rand(1,100);     
    
$veryrare rand(1,200);  
    
$endangered rand(1,300);     

    if (
$uncommon==&& $onlyone==0){     
    
$query "SELECT * FROM ".constant('PREFIX'). "adoptables WHERE rarity='Uncommon' ORDER BY RAND() LIMIT 1";   
$onlyone 1;     
    }     
    else if (
$rare==&& $onlyone==0){     
    
$query "SELECT * FROM ".constant('PREFIX'). "adoptables WHERE rarity='Rare' ORDER BY RAND() LIMIT 1";   
$onlyone 1;     
    }         
    else if (
$veryrare==1  && $onlyone==0){     
    
$query "SELECT * FROM ".constant('PREFIX'). "adoptables WHERE rarity='Very Rare' ORDER BY RAND() LIMIT 1";   
$onlyone 1;     
    }    
    else if (
$endangered==1  && $onlyone==0){     
    
$query "SELECT * FROM ".constant('PREFIX'). "adoptables WHERE rarity='Endangered' ORDER BY RAND() LIMIT 1";   
$onlyone 1;     
    }       
    else{     
    
$query "SELECT * FROM ".constant('PREFIX'). "adoptables WHERE rarity='Common' ORDER BY RAND() LIMIT 1";     
    }     
    
$stmt $mysidia->db->query($query);    

    while(
$row $stmt->fetchObject()) {  

            
$adoptform3 .= "<td width='25%' VALIGN='center'><div align=center><img src='../../picuploads/unknownegg.png' /></div></a><br><div align=center><input type='radio' name='id' id='id' value='{$row->id}' /></div></td>";  
        } 
        
$document->add(new Comment("{$adoptform}{$adoptform2}{$adoptform3}"));   
         
         
        
$adoptForm->add($adoptTable);         
        
$adoptSubtitle = new Comment("Adopt"); 
        
$adoptSubtitle->setHeading(3); 
        
$adoptForm->add($adoptSubtitle); 
        
$adoptForm->add(new Comment("Adoptable Name: "FALSE)); 
        
$adoptForm->add(new TextField("name")); 
        
$adoptForm->add(new Comment("")); 
        
$adoptForm->add(new Button("Adopt Me""submit""submit")); 
        
$document->add($adoptForm);  
        } 

?>
what it does is when the user clicks the adopt page the message will popup, when the user click ok they can see the eggs, but if they try to adopt any of the pets it will give them the id error... dont know if this can be usefull for you... as i really dont know how you have your site set it up when the user guess the adopt.

Last edited by kristhasirah; 04-07-2017 at 08:39 AM.
Reply With Quote
  #22  
Old 04-07-2017, 07:01 PM
Chaos77777 Chaos77777 is offline
Member
 
Join Date: Jan 2017
Posts: 43
Gender: Male
Credits: 3,728
Chaos77777 is on a distinguished road
Default

It actually works! It's a bit odd when it pops up that the user doesn't have enough money when they first go to the page lol, but that's just cosmetic. I'll worry about fixing that to look better some other time. For now it works right, even tried bugging around it the ways I know of, and it still works as intended. Thanks so much!
Reply With Quote
  #23  
Old 04-07-2017, 08:09 PM
kristhasirah's Avatar
kristhasirah kristhasirah is offline
Member
 
Join Date: Jan 2010
Location: In middle of the nothingness
Posts: 196
Gender: Female
Credits: 28,392
kristhasirah
Default

Glad i could help you and that is close to what you where looking for ^^
Reply With Quote
  #24  
Old 04-07-2017, 08:23 PM
Chaos77777 Chaos77777 is offline
Member
 
Join Date: Jan 2017
Posts: 43
Gender: Male
Credits: 3,728
Chaos77777 is on a distinguished road
Default

Awww, I was able to work around it. Have the page open with 500 currency, open another page and spend that money. Click over to the adopt page and adopt normally. It says "You do not have enough money" and gives you the adopt lol... Welp, back to the drawing board
Reply With Quote
  #25  
Old 04-07-2017, 09:19 PM
kristhasirah's Avatar
kristhasirah kristhasirah is offline
Member
 
Join Date: Jan 2010
Location: In middle of the nothingness
Posts: 196
Gender: Female
Credits: 28,392
kristhasirah
Default

Sorry to hear that. I Dint test it that way, having 2 pages opened at the same time, i suppose is because one page still has the session opened and thats why the user can keep adopting.
Reply With Quote
  #26  
Old 04-26-2017, 02:13 AM
KatFennec's Avatar
KatFennec KatFennec is offline
Member
 
Join Date: Apr 2017
Posts: 57
Gender: Female
Credits: 7,842
KatFennec is on a distinguished road
Default

I've been trying to get this working, and while it seems to be functioning acceptably, my partner wants me to see if I can replace the radio buttons with proper buttons that, once clicked, will immediately adopt the selected creature. unfortunately, I can't seem to figure out how to convert them, or failing that, create buttons to replace them.
Reply With Quote
  #27  
Old 04-26-2017, 08:19 AM
kristhasirah's Avatar
kristhasirah kristhasirah is offline
Member
 
Join Date: Jan 2010
Location: In middle of the nothingness
Posts: 196
Gender: Female
Credits: 28,392
kristhasirah
Default

yes is possible i have it like that in my site:
PHP Code:
<div align=center><img src='{$row->eggimage}'style=' margin-bottom:30px;'/></div></br><div align=center><strong>{$row->description}</strong></div></div></br><div align=center><input name='id' type='hidden' id='id' value='{$row->id}'><input type='submit' name='submit' value='adopt me'></body></td
but be warned the id of the adopt can be changed with inspect element! the user can add any number and if the adopt is available they will get it
to prevent this you can add :
PHP Code:
<body oncontextmenu='return false' onkeydown=\"return false;\" onmousedown=\"return false;\"> 
to disable the right click and prevent that in a way.... but maybe you or your friend know a different way to hide or not allowing tho change the id of the adopt ^^ i can't help much in that area im still trying to figure out how to fix that with out having to do something like dragon cave or most of the sites where you adopt an already created egg... because i don't know how to code it

just to inform... this is also for the default adopt page, users can use inspect element and change the id of the of the radio button and put anything there... even the id of the adopts that are in shops and get them for free.

Last edited by kristhasirah; 04-26-2017 at 11:50 AM.
Reply With Quote
  #28  
Old 04-26-2017, 01:05 PM
aquapyrofan aquapyrofan is offline
Member
 
Join Date: Apr 2017
Posts: 48
Gender: Unknown/Other
Credits: 8,431
aquapyrofan is on a distinguished road
Default

Quote:
Originally Posted by kristhasirah View Post
yes is possible i have it like that in my site:
PHP Code:
<div align=center><img src='{$row->eggimage}'style=' margin-bottom:30px;'/></div></br><div align=center><strong>{$row->description}</strong></div></div></br><div align=center><input name='id' type='hidden' id='id' value='{$row->id}'><input type='submit' name='submit' value='adopt me'></body></td
but be warned the id of the adopt can be changed with inspect element! the user can add any number and if the adopt is available they will get it
to prevent this you can add :
PHP Code:
<body oncontextmenu='return false' onkeydown=\"return false;\" onmousedown=\"return false;\"> 
to disable the right click and prevent that in a way.... but maybe you or your friend know a different way to hide or not allowing tho change the id of the adopt ^^ i can't help much in that area im still trying to figure out how to fix that with out having to do something like dragon cave or most of the sites where you adopt an already created egg... because i don't know how to code it

just to inform... this is also for the default adopt page, users can use inspect element and change the id of the of the radio button and put anything there... even the id of the adopts that are in shops and get them for free.
Those already show up in the page randomly by default, we have it set to not do that by setting their rarity to 5, but there's got to be a better way to fix it.
Reply With Quote
  #29  
Old 04-26-2017, 02:31 PM
kristhasirah's Avatar
kristhasirah kristhasirah is offline
Member
 
Join Date: Jan 2010
Location: In middle of the nothingness
Posts: 196
Gender: Female
Credits: 28,392
kristhasirah
Default

add AND shop='none' after the rarity = '' for each row that way the adopts that are in a shop wont appear in there
Reply With Quote
  #30  
Old 04-29-2017, 11:50 AM
kristhasirah's Avatar
kristhasirah kristhasirah is offline
Member
 
Join Date: Jan 2010
Location: In middle of the nothingness
Posts: 196
Gender: Female
Credits: 28,392
kristhasirah
Default

found a way to stop users from changing the ids and getting the adopts in the shop or any other adopt you don't want to be adopted in the main adopt page:
PHP Code:
            if($id == '11') throw new InvalidIDException("global_id"); 
to add more ids just add: || $id == 'id' (replace 'id' with the number you want to exclude.
for me this is working if the user change the id using inspect element to one of the defined ids it will trow the this id don't exist message
hope it works for everyone else.
i have mine below the first if statement in the public function index.
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 03:52 AM.

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