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
  #31  
Old 03-23-2012, 10:50 PM
SilverDragonTears's Avatar
SilverDragonTears SilverDragonTears is offline
I am your Nemesis.
 
Join Date: Jun 2011
Posts: 1,113
Gender: Female
Credits: 82,395
SilverDragonTears is on a distinguished road
Default

I'll try that a little later. The only problem with the rarity thing is that a rare will pop up all three at the same time. A user can then just open the links in different tabs and also get as many as they want. Which is why I want each egg to be unique. Then when you click one egg it can no longer be taken(adopted).
__________________

Check out SilvaTales
Reply With Quote
  #32  
Old 03-24-2012, 01:29 AM
!Alive !Alive is offline
Member
 
Join Date: Feb 2012
Posts: 39
Gender: Male
Credits: 1,070
!Alive is on a distinguished road
Default

You have your adopt page set up to work differently than I have mine. I may be able figure out a solution if I see your code.
I have a few vague ideas of how this might be achieved.
Reply With Quote
  #33  
Old 03-24-2012, 01:32 AM
SilverDragonTears's Avatar
SilverDragonTears SilverDragonTears is offline
I am your Nemesis.
 
Join Date: Jun 2011
Posts: 1,113
Gender: Female
Credits: 82,395
SilverDragonTears is on a distinguished road
Default

PHP Code:
<?php

include("functions/functions.php");
include(
"functions/functions_users.php");
include(
"functions/functions_adopts.php");
include(
"inc/lang.php");

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

$id $_GET["id"];
$promocode $_GET["promocode"];
$date date("M j, Y");
// $date = "Oct 23, 2001";
$_SESSION["allow"] = 1;
// Here we check if we have an ID that has been submitted or no

if($id == "") {
    
// We did not enter in an id, or it is not a number
    
$article_title $showingtitle;

    
// If we are a guest, show a message that lets them know that they cannot adopt...
    
if($isloggedin != "yes"$article_content $article_content.$showingguest;


    
// Begin the output of all the adoptables to the user...
    
$uncommon rand(1,50); 
    
$rare rand(1,100); 
    
$ultrarare rand(1,200); 

    if (
$uncommon==1){ 
    
$query "SELECT * FROM ".$prefix."adoptables WHERE rarity='1' ORDER BY RAND() LIMIT 1"
    } 
    else if (
$rare==1){ 
    
$query "SELECT * FROM ".$prefix."adoptables WHERE rarity='2' ORDER BY RAND() LIMIT 1"
    }     
    else if (
$ultrarare==1){ 
    
$query "SELECT * FROM ".$prefix."adoptables WHERE rarity='3' ORDER BY RAND() LIMIT 1"
    }     
    else{ 
    
$query "SELECT * FROM ".$prefix."adoptables WHERE rarity='0' ORDER BY RAND() LIMIT 1"
    } 
    
$stmt $adopts->query($query);
    
    
$article_content .= "
    <table class='adopt'><tr>"
;

    
    while(
$row $stmt->fetch(PDO::FETCH_OBJ)) {
        
$aid=$row->id//The adoptable's ID
        
$type=$row->type;
        
$description=$row->description;
        
$eggimage=$row->eggimage;

        
// Call a function to check if we have the proper privledge level to adopt this pet
        
if($promocode == ""$promocode "none";
        
$canadopt canadopt($aid"showing"$promocode$row); // Feed an adoptable ID and showing, to show the adopt to guests...

        
if($canadopt == "yes"){
            
//If we can adopt the adoptable, show the image and adoption link...
            
$article_content .= "
            <td  VALIGN='top'><br><br><br><br><br><br><br><br><br><br><a href='doadopt.php?id="
.$aid."'><img src='picuploads/png/e42598f988b271a7e66b36b9a5d8143b.png' /></a><br>
            
{$description}</td>";
        }
    }



    if (
$uncommon==1){ 
    
$query "SELECT * FROM ".$prefix."adoptables WHERE rarity='1' ORDER BY RAND() LIMIT 1"
    } 
    else if (
$rare==1){ 
    
$query "SELECT * FROM ".$prefix."adoptables WHERE rarity='2' ORDER BY RAND() LIMIT 1"
    }     
    else if (
$ultrarare==1){ 
    
$query "SELECT * FROM ".$prefix."adoptables WHERE rarity='3' ORDER BY RAND() LIMIT 1"
    }     
    else{ 
    
$query "SELECT * FROM ".$prefix."adoptables WHERE rarity='0' ORDER BY RAND() LIMIT 1"
    } 
    
$stmt $adopts->query($query);

    
    while(
$row $stmt->fetch(PDO::FETCH_OBJ)) {
        
$aid=$row->id//The adoptable's ID
        
$type=$row->type;
        
$description=$row->description;
        
$eggimage=$row->eggimage;

        
// Call a function to check if we have the proper privledge level to adopt this pet
        
if($promocode == ""$promocode "none";
        
$canadopt canadopt($aid"showing"$promocode$row); // Feed an adoptable ID and showing, to show the adopt to guests...

        
if($canadopt == "yes"){
            
//If we can adopt the adoptable, show the image and adoption link...
            
$article_content .= "
            <td  VALIGN='top'><br><br><br><br><br><br><br><br><br><br><a href='doadopt.php?id="
.$aid."'><img src='picuploads/png/e42598f988b271a7e66b36b9a5d8143b.png' /></a><br>
            
{$description}</td>";
        }
    }



    if (
$uncommon==1){ 
    
$query "SELECT * FROM ".$prefix."adoptables WHERE rarity='1' ORDER BY RAND() LIMIT 1"
    } 
    else if (
$rare==1){ 
    
$query "SELECT * FROM ".$prefix."adoptables WHERE rarity='2' ORDER BY RAND() LIMIT 1"
    }     
    else if (
$ultrarare==1){ 
    
$query "SELECT * FROM ".$prefix."adoptables WHERE rarity='3' ORDER BY RAND() LIMIT 1"
    }     
    else{ 
    
$query "SELECT * FROM ".$prefix."adoptables WHERE rarity='0' ORDER BY RAND() LIMIT 1"
    } 
    
$stmt $adopts->query($query);

    
    while(
$row $stmt->fetch(PDO::FETCH_OBJ)) {
        
$aid=$row->id//The adoptable's ID
        
$type=$row->type;
        
$description=$row->description;
        
$eggimage=$row->eggimage;

        
// Call a function to check if we have the proper privledge level to adopt this pet
        
if($promocode == ""$promocode "none";
        
$canadopt canadopt($aid"showing"$promocode$row); // Feed an adoptable ID and showing, to show the adopt to guests...

        
if($canadopt == "yes"){
            
//If we can adopt the adoptable, show the image and adoption link...
            
$article_content .= "
            <td  VALIGN='top'><br><br><br><br><br><br><br><br><br><br><a href='doadopt.php?id="
.$aid."'><img src='picuploads/png/e42598f988b271a7e66b36b9a5d8143b.png' /></a><br>
            
{$description}</td>";
        }
    }

 
// End the looping out of all adoptables...
    
    
$article_content .= "</tr></table>";
// This bracket ends the IF check for whether or not an ID was entered
else{
    
// We have specified an ID of an adoptable we wish to adopt

    
$query "SELECT * FROM {$prefix}adoptables, {$prefix}adoptables_conditions 
                                                  WHERE 
{$prefix}adoptables.id='{$id}
                                                        
{$prefix}adoptables_conditions.id = {$prefix}adoptables.id";
    
$result runquery($query);
    
$row mysql_fetch_array($result);

    
$aid $row['id'];
    
$type=$row['type'];
    
$description=$row['description'];
    
$eggimage=$row['eggimage'];

    if(
$aid == $id){
        
//The adoptable exists and is valid

        
$canadopt canadopt($aid"adopting"$promocode$row); 

        if(
$canadopt == "yes"){
            
$article_title "Adopting ".$type;
            
$article_content $langa1."".$type.$langa2;


            
$article_content $article_content."<br><img src='{$eggimage}' border='0'><br>
            <form name='form1' method='get' action='doadopt.php'>
              <p>Adoptable Name: 
                <input name='name' type='text' id='name'>
                <input name='id' type='hidden' id='id' value='
{$id}'>
                <input name='promocode' type='hidden' id='promocode' value='
{$promocode}'>
              </p>
              <p>
                <input type='submit' name='Submit' value='Adopt Me'>
            </p>
            </form>"
;
        }
        else{
            
$article_title $accden;
            
$article_content $adoptnoper;
        } 
// End Can Adopt ELSE
    
}
    else {
        
//The adoptable does not exist, nothing we can do...
        
$article_title $err_idnoexist;
        
$article_content $err_idnoexist_text;
    } 
// End adoptable does not exist ELSE
// This bracket ends the else statements for whether or not an ID was entered


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

echo showpage($article_title$article_content$date);

?>
__________________

Check out SilvaTales
Reply With Quote
  #34  
Old 03-24-2012, 03:08 PM
!Alive !Alive is offline
Member
 
Join Date: Feb 2012
Posts: 39
Gender: Male
Credits: 1,070
!Alive is on a distinguished road
Default

Okay, since my adopting is set up different than yours I don't really have the ability to easily test this. The idea behind this code it to set a variable when the page is loaded and when one of the adoptables is clicked/adopted the value of that variable changes. And if the link is clicked a second time refresh the page so that it can't be adopted more than once.

Try this
In the functions.php add this function:
PHP Code:
function canclick()
{
if (
$clicked 0;
    {
    
$clicked 1;
    }
else {
    
header'Location: adopt.php' ) ;
}

If your adopt page has another name change the php page name.

Then change your adopt.php code to this modified version:
PHP Code:
<?php 

include("functions/functions.php"); 
include(
"functions/functions_users.php"); 
include(
"functions/functions_adopts.php"); 
include(
"inc/lang.php"); 

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

$id $_GET["id"]; 
$promocode $_GET["promocode"]; 
$date date("M j, Y"); 
// $date = "Oct 23, 2001"; 
$_SESSION["allow"] = 1
// Here we check if we have an ID that has been submitted or no 

$clicked 0;

if(
$id == "") { 
    
// We did not enter in an id, or it is not a number 
    
$article_title $showingtitle

    
// If we are a guest, show a message that lets them know that they cannot adopt... 
    
if($isloggedin != "yes"$article_content $article_content.$showingguest


    
// Begin the output of all the adoptables to the user... 


    
$uncommon rand(1,50);  
    
$rare rand(1,100);  
    
$ultrarare rand(1,200);  

    if (
$uncommon==1){  
    
$query "SELECT * FROM ".$prefix."adoptables WHERE rarity='1' ORDER BY RAND() LIMIT 1";  
    }  
    else if (
$rare==1){  
    
$query "SELECT * FROM ".$prefix."adoptables WHERE rarity='2' ORDER BY RAND() LIMIT 1";  
    }      
    else if (
$ultrarare==1){  
    
$query "SELECT * FROM ".$prefix."adoptables WHERE rarity='3' ORDER BY RAND() LIMIT 1";  
    }      
    else{  
    
$query "SELECT * FROM ".$prefix."adoptables WHERE rarity='0' ORDER BY RAND() LIMIT 1";  
    }  
    
$stmt $adopts->query($query); 
     
    
$article_content .= 
    <table class='adopt'><tr>"


     
    while(
$row $stmt->fetch(PDO::FETCH_OBJ)) { 
        
$aid=$row->id//The adoptable's ID 
        
$type=$row->type
        
$description=$row->description
        
$eggimage=$row->eggimage

        
// Call a function to check if we have the proper privledge level to adopt this pet 
        
if($promocode == ""$promocode "none"
        
$canadopt canadopt($aid"showing"$promocode$row); // Feed an adoptable ID and showing, to show the adopt to guests... 

        
if($canadopt == "yes"){ 
            
//If we can adopt the adoptable, show the image and adoption link... 
            
$article_content .= 
            <td  VALIGN='top'><br><br><br><br><br><br><br><br><br><br><a href='doadopt.php?id="
.$aid."' onclick='canclick()'><img src='picuploads/png/e42598f988b271a7e66b36b9a5d8143b.png' /></a><br> 
            
{$description}</td>"
        } 
    } 



    if (
$uncommon==1){  
    
$query "SELECT * FROM ".$prefix."adoptables WHERE rarity='1' ORDER BY RAND() LIMIT 1";  
    }  
    else if (
$rare==1){  
    
$query "SELECT * FROM ".$prefix."adoptables WHERE rarity='2' ORDER BY RAND() LIMIT 1";  
    }      
    else if (
$ultrarare==1){  
    
$query "SELECT * FROM ".$prefix."adoptables WHERE rarity='3' ORDER BY RAND() LIMIT 1";  
    }      
    else{  
    
$query "SELECT * FROM ".$prefix."adoptables WHERE rarity='0' ORDER BY RAND() LIMIT 1";  
    }  
    
$stmt $adopts->query($query); 

     
    while(
$row $stmt->fetch(PDO::FETCH_OBJ)) { 
        
$aid=$row->id//The adoptable's ID 
        
$type=$row->type
        
$description=$row->description
        
$eggimage=$row->eggimage

        
// Call a function to check if we have the proper privledge level to adopt this pet 
        
if($promocode == ""$promocode "none"
        
$canadopt canadopt($aid"showing"$promocode$row); // Feed an adoptable ID and showing, to show the adopt to guests... 

        
if($canadopt == "yes"){ 
            
//If we can adopt the adoptable, show the image and adoption link... 
            
$article_content .= 
            <td  VALIGN='top'><br><br><br><br><br><br><br><br><br><br><a href='doadopt.php?id="
.$aid."'onclick='canclick()'><img src='picuploads/png/e42598f988b271a7e66b36b9a5d8143b.png' /></a><br> 
            
{$description}</td>"
        } 
    } 



    if (
$uncommon==1){  
    
$query "SELECT * FROM ".$prefix."adoptables WHERE rarity='1' ORDER BY RAND() LIMIT 1";  
    }  
    else if (
$rare==1){  
    
$query "SELECT * FROM ".$prefix."adoptables WHERE rarity='2' ORDER BY RAND() LIMIT 1";  
    }      
    else if (
$ultrarare==1){  
    
$query "SELECT * FROM ".$prefix."adoptables WHERE rarity='3' ORDER BY RAND() LIMIT 1";  
    }      
    else{  
    
$query "SELECT * FROM ".$prefix."adoptables WHERE rarity='0' ORDER BY RAND() LIMIT 1";  
    }  
    
$stmt $adopts->query($query); 

     
    while(
$row $stmt->fetch(PDO::FETCH_OBJ)) { 
        
$aid=$row->id//The adoptable's ID 
        
$type=$row->type
        
$description=$row->description
        
$eggimage=$row->eggimage

        
// Call a function to check if we have the proper privledge level to adopt this pet 
        
if($promocode == ""$promocode "none"
        
$canadopt canadopt($aid"showing"$promocode$row); // Feed an adoptable ID and showing, to show the adopt to guests... 

        
if($canadopt == "yes"){ 
            
//If we can adopt the adoptable, show the image and adoption link... 
            
$article_content .= 
            <td  VALIGN='top'><br><br><br><br><br><br><br><br><br><br><a href='doadopt.php?id="
.$aid."'onclick='canclick()'><img src='picuploads/png/e42598f988b271a7e66b36b9a5d8143b.png' /></a><br> 
            
{$description}</td>"
        } 
    } 

 
// End the looping out of all adoptables... 
     
    
$article_content .= "</tr></table>"
// This bracket ends the IF check for whether or not an ID was entered 
else{ 
    
// We have specified an ID of an adoptable we wish to adopt 

    
$query "SELECT * FROM {$prefix}adoptables, {$prefix}adoptables_conditions  
                                                  WHERE 
{$prefix}adoptables.id='{$id}'  
                                                        
{$prefix}adoptables_conditions.id = {$prefix}adoptables.id"
    
$result runquery($query); 
    
$row mysql_fetch_array($result); 

    
$aid $row['id']; 
    
$type=$row['type']; 
    
$description=$row['description']; 
    
$eggimage=$row['eggimage']; 

    if(
$aid == $id){ 
        
//The adoptable exists and is valid 

        
$canadopt canadopt($aid"adopting"$promocode$row);  

        if(
$canadopt == "yes"){ 
            
$article_title "Adopting ".$type
            
$article_content $langa1."".$type.$langa2


            
$article_content $article_content."<br><img src='{$eggimage}' border='0'><br> 
            <form name='form1' method='get' action='doadopt.php'> 
              <p>Adoptable Name:  
                <input name='name' type='text' id='name'> 
                <input name='id' type='hidden' id='id' value='
{$id}'> 
                <input name='promocode' type='hidden' id='promocode' value='
{$promocode}'> 
              </p> 
              <p> 
                <input type='submit' name='Submit' value='Adopt Me'> 
            </p> 
            </form>"

        } 
        else{ 
            
$article_title $accden
            
$article_content $adoptnoper
        } 
// End Can Adopt ELSE 
    

    else { 
        
//The adoptable does not exist, nothing we can do... 
        
$article_title $err_idnoexist
        
$article_content $err_idnoexist_text
    } 
// End adoptable does not exist ELSE 
// This bracket ends the else statements for whether or not an ID was entered 


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

echo showpage($article_title$article_content$date); 

?>
Tell me what happens. :D
*is not sure if I did it right*
Reply With Quote
  #35  
Old 03-24-2012, 03:30 PM
SilverDragonTears's Avatar
SilverDragonTears SilverDragonTears is offline
I am your Nemesis.
 
Join Date: Jun 2011
Posts: 1,113
Gender: Female
Credits: 82,395
SilverDragonTears is on a distinguished road
Default

I tried the function part first:

Parse error: syntax error, unexpected ';' in /home/taleofdr/public_html/functions/functions.php on line 117
__________________

Check out SilvaTales
Reply With Quote
  #36  
Old 03-24-2012, 03:33 PM
!Alive !Alive is offline
Member
 
Join Date: Feb 2012
Posts: 39
Gender: Male
Credits: 1,070
!Alive is on a distinguished road
Default

Nevermind I figured out what was wrong. XP

Try this
PHP Code:
function canclick()
{
if (
$clicked 0)
    {
    
$clicked 1;
    }
else {
    
header'Location: adopt.php' ) ;
}


Last edited by !Alive; 03-24-2012 at 03:37 PM.
Reply With Quote
  #37  
Old 03-24-2012, 03:41 PM
SilverDragonTears's Avatar
SilverDragonTears SilverDragonTears is offline
I am your Nemesis.
 
Join Date: Jun 2011
Posts: 1,113
Gender: Female
Credits: 82,395
SilverDragonTears is on a distinguished road
Default

Ok I think it's working :) I clicked on an egg and then tried to click it again and it said the id was invalid which means it can only be adopted once so that's good :) But... the rare and uncommon ones that I have still show up 3 at one time.
__________________

Check out SilvaTales
Reply With Quote
  #38  
Old 03-24-2012, 03:47 PM
!Alive !Alive is offline
Member
 
Join Date: Feb 2012
Posts: 39
Gender: Male
Credits: 1,070
!Alive is on a distinguished road
Default

Have you assigned each adoptable with a rarity number?
Reply With Quote
  #39  
Old 03-24-2012, 03:52 PM
SilverDragonTears's Avatar
SilverDragonTears SilverDragonTears is offline
I am your Nemesis.
 
Join Date: Jun 2011
Posts: 1,113
Gender: Female
Credits: 82,395
SilverDragonTears is on a distinguished road
Default

Yes I have 5 dragon species available right now. Two are uncommon, One is uncommon, and the other two are rare.
__________________

Check out SilvaTales
Reply With Quote
  #40  
Old 03-24-2012, 04:00 PM
!Alive !Alive is offline
Member
 
Join Date: Feb 2012
Posts: 39
Gender: Male
Credits: 1,070
!Alive is on a distinguished road
Default

Hmm... It just seems like an odd coincidence for multiple rare and uncommon to appear with the chances of them appearing....
I have only seen three kinds of egg in the lair. The shiny black and white, the one with two layers of scales and a colorful one. The black and white and scales one occur most often.
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 11:17 AM.

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