Thread: Cash System
View Single Post
  #18  
Old 11-29-2009, 11:15 PM
Fireballchad Fireballchad is offline
Member
 
Join Date: Aug 2009
Posts: 49
Credits: 8,206
Fireballchad
Default RE: Cash System

Hey Arianna I sort of got your cash thing working...
I will try to make a tut of what I did.
Yours worked sorta of but you missed a few things it needed...
I am currently trying to make it so if you dont have enough money then you cant buy it... As of right now it allows you to go negative...
PHP Code:
<?
//File admin.php
//After line 165 add:
<input name='cba' type='radio' value='pricenum'>
Only when users pay this much money
<
input name='price' type='text' id='price'>
<
br>

// FILE: nadopt.php
// After line 94 add: it will be this but with promo instead
    
$price $_POST["price"];
    
$price secure($price);
    
// Change line 243 (about) to: '$price' was added at the end
mysql_query("INSERT INTO ".$prefix."adoptables VALUES ('', '$name', '$description','$eggimage','$cba','$promocode', '$freqcond', '$number','$datecond','$date','$adoptscond','$maxnumcond','$morethannum','$usergroupcond','$usergroups','$alternates','$altoutlevel','$altchance','$price')");

// in the table adopts_adoptables, use the sql query. 
ALTER TABLE  `adopts_adoptablesADD  `priceINT10 NOT NULL DEFAULT  'NULL';
// I Hand entered this into my data base Default should be NULL I don't know if
// 'NULL' will work or not but fix it if it doesn't

// we still have to alter two more things - the adopt.php page, and the doadopt.php page.
// FILE: adopt.php
// After line 63 (about) add:
$price $_GET["price"];
$price secure($price);
// After line 96 add:
$price=@mysql_result($result,$i,"price");
// After line 152 add:
$price=@mysql_result($result,$i,"price");
// After line 174 add:
<p>I cost ".$price." coins!</p>
// And after line 179 add:
<input name='price' type='hidden' id='price' value='".$price."'>

// FILE: doadopt.php
//After Line 75 (about) add:
$price $_GET["price"];
$price secure($price);
// After line 102 add:
$price=@mysql_result($result,$i,"price");
// Insert this giant junk of code after:
$id=@mysql_result($result,$i,"aid"); 


$i++;
}

// Here's the code:
$query "SELECT * FROM `adopts_users` WHERE `username`='$loggedinname'";
$result mysql_query($query);
$num mysql_numrows($result);

$i 0;
while (
$i 1) {
$money = @mysql_result($result$i"money");
$newbalance $money $price;
$i++;
}

mysql_query("UPDATE `adopts_users` SET `money`='" $newbalance "' WHERE `username`='$loggedinname'");

$article_content $article_content "<div align='center'>Thanks for buying your adoptable! Now you have ".$newbalance." coins!</div>"

// Credit goes to     Arianna I only helped fix some stuff... Still needs to be fixed!!!
?>
Reply With Quote