View Single Post
  #8  
Old 02-02-2011, 05:34 PM
PTGigi's Avatar
PTGigi PTGigi is offline
Crazily Friendly~HoF
 
Join Date: Jul 2009
Location: Somewhere >.>
Posts: 370
Gender: Female
Credits: 35,853
PTGigi
Default

Alright let's hope I don't fail and forget something XD I didn't know what you were using for cash so I just used $cash2 for everything X3 Change as you like

Admin.php should read like this for the cash:
PHP Code:
  <p><strong>Adoptables Pricing Settings:</strong></p>
  <
p>This section allows you to set if you want to enable pricing for this adoptablePlease either disable this option or enter a positive number here.. </p>
  <
p><strong>
   <
input name='pricestatus' type='checkbox' id='pricestatus' value='enabled'>
  </
strong>Set a price for this adoptable</p>
  <
p>You can now decide how much money to charge for this particular adoptable:</p>
  <
input name='pricevalue' type='text' id='pricevalue' size='10' maxlength='10'>Cash 1<br>
  <
input name='pricevalue2' type='text' id='pricevalue2' size='10' maxlength='10'>Cash 2<br>
<
p
The cash check in doadopt should read:
PHP Code:
// Now we determine if the user has enough cash left to purchase an adoptable, if its price status is enabled.

$pris getpricestatus($id); 
$priv getpricevalue($id);
$priv2 getpricevalue2($id);
$mycash getcash($loggedinname);
$mycash2 getcash2($loggedinname);

$cashleft $mycash $priv;
$casj2left $mycash2 $priv;

if(
$cashleft or $cash2left 0){
  
$article_title $name." cannot be adopted";
  
$article_content "It appears that you do not have enough money to acquire this adoptable, please come back later.";

And just a couple lines below that should read:
PHP Code:
//Next, the user's lost an amount of money equal to the adoptable's price value.
$query "UPDATE ".$prefix."users SET dollar='".$cashleft."' WHERE username='".$loggedinname."'";
mysql_query($query);
$query "UPDATE ".$prefix."users SET cash2='".$cash2left."' WHERE username='".$loggedinname."'";
mysql_query($query); 
And in functions you need to add:
PHP Code:
function getcash2($loggedinname){

include(
"config.php");

//First we see if we are logged in or not

$loginstatus logincheck();
$isloggedin $loginstatus[loginstatus];
$loggedinname $loginstatus[username];

$query "SELECT * FROM ".$prefix."users WHERE username = '$loggedinname'";
$result = @mysql_query($query);
$num = @mysql_numrows($result);

//Loop out code
$i=0;
while (
$i 1) {

$cash2=@mysql_result($result,$i,"cash2");

$i++;
}

return 
$cash2;


And

PHP Code:
function getpricevalue2($aid){

include(
"config.php");

//This function retrieves an adoptable's price from sql database.

$pricestatus "no";

$query "SELECT * FROM ".$prefix."adoptables WHERE id='$aid'";
$result mysql_query($query);
$num mysql_numrows($result);

//Loop out code
$i=0;
while (
$i 1) {

$pricestatus=@mysql_result($result,$i,"pricestatus");
$pricevalue2=@mysql_result($result,$i,"pricevalue2");
$i++;
}

if(
$pricestatus == "enabled"){
$priceval2 $pricevalue2;
}
else{
$priceval2 0;
}

return 
$priceval2;


And I'm going to have to double check those other files in a bit, I have to eat dinner soon. D:

EDIT: Durr forgot nadopt XD Give me a minute and I'll have that up XD

EDIT2:

nadopt.php: Find the 'pricestats = $_Post" part and replace with this:
PHP Code:
$pricestatus $_POST["pricestatus"];
$pricestatus secure($pricestatus);

$pricevalue $_POST["pricevalue"];
$pricevalue secure($pricevalue);

$pricevalue2 $_POST["pricevalue2"];
$pricevalue2 secure($pricevalue2); 
__________________


"I see now that the circumstances of one's birth are irrelevant; it is what you do with the gift of life that determines who you are."~Mewtwo
My Adoptables|Nuzlocke Webcomic

Last edited by PTGigi; 02-02-2011 at 05:36 PM.
Reply With Quote