Mysidia Adoptables Support Forum

Mysidia Adoptables Support Forum (http://www.mysidiaadoptables.com/forum/index.php)
-   Questions and Supports (http://www.mysidiaadoptables.com/forum/forumdisplay.php?f=18)
-   -   Breeding/Refresh Issue (http://www.mysidiaadoptables.com/forum/showthread.php?t=3416)

SilverDragonTears 12-27-2011 09:23 PM

Breeding/Refresh Issue
 
When someone breeds an adopt, they can refresh until they manage to produce an offspring. And then they can keep refreshing and produce as many as they want.

As long as they don't leave the page, they can do this as many times as they want. How can I prevent this?

AlexC 12-27-2011 10:21 PM

There was a similar issue with people being able to refresh or click back on the "adopt" page and get multiple adoptables. I think it's on the adopt script or whatever it's called, it's possible you can look at the codes there and figure out how HoF stopped it there.

SilverDragonTears 12-27-2011 10:26 PM

I've been trying that but I'm either not putting it in the right place or that doesn't work :/

AlexC 12-27-2011 10:28 PM

Alright - well, the best of luck, I wouldn't mind knowing the solution to this, I have a very find defined rare/uncommon/common system planned for my site. ;-; something like this could damage anybody's site.

SilverDragonTears 12-27-2011 10:30 PM

I have donation foxes.... People pay money for these. Think of how I feel :/

AlexC 12-27-2011 10:35 PM

Oh jeez, that's bad - have you had people doing this a lot?

SilverDragonTears 12-27-2011 10:36 PM

I'm not sure if they're doing it or not. But I do know that some people know about it... and if they can figure it out, anyone can :(

AlexC 12-27-2011 10:42 PM

All it takes is for someone to post somewhere even half-heartily, and even the stupid can figure it out. p: good luck, hope someone can figure it out.

Abronsyth 12-28-2011 12:19 PM

Perhaps you could work in a script that disables the refresh button on the breeding page? I know such things exist, though I'm not sure where...

Hall of Famer 01-02-2012 12:36 PM

Well as far as I remember, you can play with PHP sessions to prevent users from abusing the 'refresh page' technique.

SilverDragonTears 01-02-2012 02:56 PM

I tried HoF, but I'm not good with those. Can you tell me what and where I should put it?

Hall of Famer 01-05-2012 11:54 AM

Well you may try registering the global variable $_SESSION['breeding'] and play with it. Id recommend you to look at the example from adopt.php and doadopt.php, note the two script files are linked together in a way that a session variable is assigned in adopt.php for each new session and destroyed at the end of doadopt.php row insertion.

SilverDragonTears 01-05-2012 06:41 PM

That completely loses me ._.

SilverDragonTears 01-05-2012 08:57 PM

This is what I tried and it's not working. I'm sure I'm not even close.

PHP Code:

else if($act == "breed"){
    
$_SESSION["breeding"] = 1;

if(
is_numeric($id)){


$breedinglevel grabanysetting('breedinglevel');

$article_title "Breeding System"
$article_content "<p>You may breed your adoptables here. They must be at least a level {$breedinglevel} to be able to breed.</p>"

$femaleid $_POST['female'];
$maleid $_POST['male'];
$breed $_POST['breed'];
$date date("M j, Y");

// $date = "March 23, 2010";

if ($isloggedin == "yes"){

    if(
$_SESSION["breeding"] != 1){
    
        
$article_title $err_idnoexist;
        
$article_content $err_idnoexist_text;
    }
    elseif(
$_SESSION["breeding"] == 1){

$query "SELECT * FROM ".$prefix."owned_adoptables WHERE owner='".$loggedinname."' AND currentlevel<='3' AND isfrozen='no'";
$result mysql_query($query);
$num mysql_num_rows($result);

if(
$num >= 5){
$breed 'no';
$article_title "Too many eggs to breed!";
$article_content "You already have too many eggs to take care of!";
}
   else if (
$breed != 'yes'){ // if they have not chosen which pets to breed yet, we let them choose
        
$article_content .= "<p>Select the two adoptables that you'd like to breed:</p><form method='post'>"
        
$lastweek time() - ((grabanysetting('breedinginterval')) * 24 60 60);
        
        
// show all available female adoptables
        
$result runquery("SELECT * FROM ".$prefix."owned_adoptables WHERE owner = '$loggedinname' and aid='$id' AND gender = 'f' AND canbreed = 'yes' AND currentlevel >= {$breedinglevel} AND lastbred <= '$lastweek'") ;
        
$num mysql_num_rows($result);
        if (
$num!=0) {
            
$article_content .= "<p>Female: <select name='female'>";
            while (
$row mysql_fetch_array($resultMYSQL_ASSOC)) {
                
$article_content .= "<option value='{$row['aid']}'>{$row['aid']} {$row['name']} ({$row['type']})</option>";
            }
            
$article_content .= "</select></p>";
        }
        else {
            
$article_content .= "<p>Your female can't breed at this time.</p>";
        }
        
        
// show all available male adoptables
  
        
$result runquery("SELECT * FROM ".$prefix."owned_adoptables WHERE owner = '$loggedinname' AND gender = 'm'  AND canbreed = 'yes' AND currentlevel >= {$breedinglevel} AND lastbred <= '$lastweek'") ;
      
$num mysql_num_rows($result);

            if (
$num!=0) {
            
$article_content .= "<p>Male: <select name='male'>";
            while (
$row mysql_fetch_array($resultMYSQL_ASSOC)) {
                
$article_content .= "<option value='{$row['aid']}'>{$row['aid']} {$row['name']} ({$row['type']})</option><br>";
            }

            
$article_content .= "</select></p>";
        }
        else {
            
$article_content .= "<p>None of your male adoptables can breed at the time.</p>";
        }
        
$article_content .= "<input type='hidden' name='breed' value='yes'><input type='submit' value='Breed It'></form>";
    } 
    else {
        
$result runquery("SELECT * FROM ".$prefix."owned_adoptables WHERE aid = '$femaleid'") ;
        
$female mysql_fetch_array($result);

        
$female_type = @mysql_result($result,0,'type'); 
        
$female_name = @mysql_result($result,0,'name');

        
$result2 runquery("SELECT * FROM ".$prefix."adoptables WHERE type = '$female_type'") ;
        
$female_species mysql_fetch_array($result2);
        
$female_class = @mysql_result($result2,0,'class');
                
$bredchance = @mysql_result($result2,0,'bredchance'); 
        
        
$result runquery("SELECT * FROM ".$prefix."owned_adoptables WHERE aid = '$maleid'") ;
        
$male mysql_fetch_array($result);

        
$male_type = @mysql_result($result,0,'type'); 
        
$male_name = @mysql_result($result,0,'name');

        
$result2 runquery("SELECT * FROM ".$prefix."adoptables WHERE type = '$male_type'") ;
        
$male_species mysql_fetch_array($result2);
        
$male_class = @mysql_result($result2,0,'class'); 


        
// let's check the requirements first.
        
if($female_class != $male_class){//check if the male and female belong to the same breeding class
            
$article_content "Sorry, it seems that your two adoptables do not belong to the same breeding class.";
        }
        else if ((
$female['currentlevel'] < (grabanysetting('breedinglevel'))) OR ($male['currentlevel'] < (grabanysetting('breedinglevel')))){ // check the adoptables' levels
            
$article_content .= "Sorry, one of your adoptables don't have the minimum level to breed. Keep getting clicks for them so they can grow.";    
        } 

        
// the below codes check if the user has modified the form using firebug or inspect element...
        
elseif($female['owner'] != $loggedinname or $male['owner'] != $loggedinname){
           
// The adoptables do not belong to the owner... This user has apparently modified the content of drop-down form, and thus deserves his/her punishment
           
runquery("UPDATE {$prefix}users SET usergroup=5 WHERE username='{$loggedinname}'");
           
$article_title "An error has occurred";    
           
$article_content "It appears that at least one of the adoptables selected do not belong to yours. You have been banned for this action, please contact site administrator for more info.";
        }
        elseif(
$female['gender'] != "f" or $male['gender'] != "m"){
           
// The female's gender is male or male's gender is female? This user has apparently modified the content of drop-down form, and thus deserves his/her punishment
           
runquery("UPDATE {$prefix}users SET usergroup=5 WHERE username='{$loggedinname}'");
           
$article_title "An error has occurred";    
           
$article_content "It appears that the female and/or male adoptables gender's have been modified. You have been banned for this action, please contact site administrator for more info.";              
        }
        else {
            
// we choose the type!

            
if ($female_type == 'Noctis Silvfox Beta' && $male_type == 'Noctis Silvfox Beta'){
            
$female_type 'Noctis Silvfox' && $male_type 'Noctis Silvfox';}
            
$types = array($female_type$male_type);
            if (
$female_type == 'Red Stitch Silvfox Beta' && $male_type == 'Red Stitch Silvfox Beta'){
            
$female_type 'Red Stitch Silvfox' && $male_type 'Red Stitch Silvfox';}
            
$types = array($female_type$male_type);
            if (
$female_type == 'White Stitch Silvfox Beta' && $male_type == 'White Stitch Silvfox Beta'){
            
$female_type 'White Stitch Silvfox' && $male_type 'White Stitch Silvfox';}
            
$types = array($female_type$male_type);

            if (
$female_type == 'White Silvfox Beta' && $male_type == 'Red Stitch Silvfox Beta'){
            
$female_type 'White Stitch Silvfox' && $male_type 'Red Stitch Silvfox';}
            
$types = array($female_type$male_type);
            if (
$female_type == 'Noctis Silvfox Beta' && $male_type == 'Red Stitch Silvfox Beta'){
            
$female_type 'Noctis Silvfox' && $male_type 'Red Stitch Silvfox';}
            
$types = array($female_type$male_type);
            if (
$female_type == 'Noctis Silvfox Beta' && $male_type == 'White Stitch Silvfox Beta'){
            
$female_type 'Noctis Silvfox' && $male_type 'White Stitch Silvfox';}
            
$types = array($female_type$male_type);


            if (
$female_type == 'Noctis Silvfox Beta' && $male_type != '$male_type'){
            
$female_type 'Noctis Silvfox';
            
$types = array($female_type$male_type);}
            if (
$female_type == 'Red Stitch Silvfox Beta' && $male_type != '$male_type'){
            
$female_type 'Red Stitch Silvfox';
            
$types = array($female_type$male_type);}
            if (
$female_type == 'White Stitch Silvfox Beta' && $male_type != '$male_type'){
            
$female_type 'White Stitch Silvfox';
            
$types = array($female_type$male_type);}


            if (
$female_type != '$female_type' && $male_type == 'Noctis Silvfox Beta'){
            
$male_type 'Noctis Silvfox';
            
$types = array($female_type$male_type);}
            if (
$female_type != '$female_type' && $male_type == 'Red Stitch Silvfox Beta'){
            
$male_type 'Red Stitch Silvfox';
            
$types = array($female_type$male_type);}
            if (
$female_type != '$female_type' && $male_type == 'White Stitch Silvfox Beta'){
            
$male_type 'White Stitch Silvfox';
            
$types = array($female_type$male_type);}
            
            if (
$female_type == 'Autumn Silvfox' && $male_type == 'Autumn Silvfox'){
            
$female_type 'Winter Silvfox' && $male_type 'Winter Silvfox';}
            
$types = array($female_type$male_type);
            if (
$female_type == 'Autumn Silvfox' && $male_type != '$male_type'){
            
$female_type 'Winter Silvfox';
            
$types = array($female_type$male_type);}
            if (
$female_type != '$female_type' && $male_type == 'Autumn Silvfox'){
            
$male_type 'Winter Silvfox';
            
$types = array($female_type$male_type);}

            
$types = array($female_type$male_type);
            
$typerand rand(0,1); 
       
            
            
// we choose the gender
            
$genders = array('f''m');
            
$genderrand rand(0,1);                
                  
$code rand(120000); 

            
// MESSY - I'm blanking out on how to find the actual alt status stuff right now, any help would be lovely.

            
$alts getaltstatus($aid00);
            if(
$genders[$genderrand] == 'f') { $alts 'yes';}

            
$time time();
            
$bredtemp rand(0,100);
if(
$bredtemp <= $bredchance){
$article_content "These two don't seem very interested in each other right now. Try again in a week."
 
}    
else{
$newquery "INSERT INTO ".$prefix."owned_adoptables VALUES ('', '$types[$typerand]', 'Unnamed', '$loggedinname', '0', '0', '$code', '', '$alts', 'notfortrade', 'no', '$genders[$genderrand]', '$lastbred', '$lastinfluence', '$lastbite', 'sort', '$maleid', '$femaleid', '$desc', '$date', '','yes', '$biterid', 'no')";
            
runquery($newquery);
                        unset(
$_SESSION["breeding"]);
                        
// END the actual adoption process
                    
}    
            
$article_content "Congratulations! Breeding is successful,  you have acquired a baby ".$types[$typerand]." from breeding center.
            <br><a href='myadopts.php'>Manage your new 
{$types[$typerand]} now!</a></p>";
                
     
}
            
runquery("UPDATE ".$prefix."owned_adoptables SET lastbred = '$time' WHERE aid = '$femaleid'");
            
runquery("UPDATE ".$prefix."owned_adoptables SET lastbred = '$time' WHERE aid = '$maleid'");
        } 
// we end the place where it goes on if the levels are ok
    
//this bracket ends the else where we find the male/female id's
}// this is the end of if($isloggedin == "yes")
else {
    
$article_content .= "You are not logged in. Please log in to use this feature.";
}





All times are GMT -5. The time now is 02:08 PM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.