Jump to content
MakeWebGames

New 2.0 code help if your making a code and need help ask!!!!!!


canibalstew

Recommended Posts

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']})");
}
Link to comment
Share on other sites

  • 3 weeks later...

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 :)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...