canibalstew Posted December 17, 2006 Posted December 17, 2006 i am making a code for users to exchange a (new currency(blunts) witch has been installed correctly) and they can exchange it for a 3 dollar donator pack but i cant get it to work so if you guy could let me know what i did wrong and how i can get it to work <?php include "globals.php"; if($ir['jail'] or $ir['hospital']) { die("This page cannot be accessed while in jail or hospital."); } if($ir['blunts'] >= 99) { print("Sorry, you Dont Have enough Blunts to Come here."); } switch($_GET['action']) { case 'creditbluntform': creditb_user_form(); break; case 'creditbluntsub': creditb(); break; } print "Blunt Exchange You can Exchange blunts for a Donator Package. 100 Blunts for a \$3 donator Package you have {$ir['blunts']} in hand!!! Blunts: "; function creditb() { global $db,$ir,$c,$h,$userid; if($ir['blunts'] >= 99) { print("You Dont have enough Blunts "); } else { $db->query("UPDATE users u LEFT JOIN userstats us ON userid=userid SET money=money+5000, crystals=crystals+50, IQ=IQ+50, donatordays=donatordays+30 WHERE userid=$userid"); print"You have paid 100 blunts to recieve a \$3 Donator Pack."; } $d=30; print "Blunt Exchange credited."; $d=$db->query("SELECT username FROM users WHERE userid='{$_POST['user']}'"); $un=$db->fetch_single($d); stafflog_add("Gave ID {$_POST['user']} a \$3 donator pack (Pack {$_POST['type']})"); } Quote
Revolution Posted December 17, 2006 Posted December 17, 2006 Re: New 2.0 code help if your making a code and need help ask!!!!!! Any error messages? What was the output? Quote
canibalstew Posted December 18, 2006 Author Posted December 18, 2006 Re: New 2.0 code help if your making a code and need help ask!!!!!! Yeah sorry every thing seems to work but it dont take the blunts and dont credit user like the action is wrong Quote
seanybob Posted January 3, 2007 Posted January 3, 2007 Re: New 2.0 code help if your making a code and need help ask!!!!!! if($ir['blunts'] >= 99) { print("Sorry, you Dont Have enough Blunts to Come here."); } K, I'll start here... if they have 99 or MORE blunts, they cant come here? I'm thinking you meant if($ir['blunts'] < 100) { die("Sorry, you Dont Have enough Blunts to Come here."); } Now I'm just gonna tweak around the rest of your file here... switch($_GET['action']) { case 'creditbluntform': creditb_user_form(); break; case 'creditbluntsub': creditb(); break; case 'index': credit_index(); break; default: credit_index(); break; } function credit_index() { print "<h3>Blunt Exchange </h3> You can Exchange blunts for a Donator Package. [b]100[/b] Blunts for a \$3 donator Package. You have [b]{$ir['blunts']}[/b] in hand!!!<font> <form action='bluntex.php?action=creditb' method='post'> Blunts: <input type='text' name='blunts' /> <input type='submit' value='Credit User' /></form>"; } function creditb() { global $db,$ir,$c,$h,$userid; if($ir['blunts'] < 100) { die("You don't have enough Blunts "); } else { $db->query("UPDATE users u LEFT JOIN userstats us ON userid=userid SET money=money+5000, crystals=crystals+50, IQ=IQ+50, donatordays=donatordays+30 WHERE userid=$userid"); print"You have paid 100 blunts to recieve a \$3 Donator Pack."; } $d=30; print "Blunt Exchange credited."; $d=$db->query("SELECT username FROM users WHERE userid='{$_POST['user']}'"); $un=$db->fetch_single($d); stafflog_add("Gave ID {$_POST['user']} a \$3 donator pack (Pack {$_POST['type']})"); } I didn't mess with your queries, just fixed a couple things in the upper parts of the code. Your queries may or may not work, I'm outta time to check :) Quote
canibalstew Posted January 3, 2007 Author Posted January 3, 2007 Re: New 2.0 code help if your making a code and need help ask!!!!!! wow thanx alot Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.