Jump to content
MakeWebGames

Exchange problem


stevenrfc

Recommended Posts

Hello,

My exchange for redux doesnt work, i can only seem to refill energy for second currency but i can seem to get IQ or money, I keep getting this error

"Error, you either do not have enough Gold Bars or did not fill out the form.

Back"

Even though i have 999,990 gold bars.

I even got the latest version of redux and replace the new file with my old one and its still not working.

I've been told that this should be working fine but its not and i havent touched the file or anything.

Has anyone else got this problem? And does anyone know how to fix it??

Exchange

if (!defined($_CONFIG['define_code']))
{
   echo 'This file cannot be accessed directly.';
   exit;
}
$_GET['spend'] =
       (isset($_GET['spend'])
               && in_array($_GET['spend'],
                       array('refill', 'IQ', 'IQ2', 'main', 'main2')))
               ? $_GET['spend'] : '';
if ($_GET['spend'] == '')
{
   echo "Welcome to the exchange!
You have <b>{$ir['second']}</b> " . $set['second_currency']
           . ".
What would you like to spend your " . $set['second_currency']
           . " on?

<a href='" . gen_url('exchange', true)
           . "&spend=refill'>Energy Refill - {$set['ct_refillprice']} "
           . $set['second_currency'] . "</a>
<a href='" . gen_url('exchange', true)
           . "&spend=IQ'>IQ - {$set['ct_iqpercrys']} IQ per "
           . substr($set['second_currency'], 0, -1) . "</a>
<a href='" . gen_url('exchange', true) . "&spend=main'>"
           . $set['main_currency'] . " - \$"
           . number_format($set['ct_moneypercrys']) . " per "
           . substr($set['second_currency'], 0, -1) . "</a>";
}
else
{
   if ($_GET['spend'] == 'refill')
   {
       if ($ir['second'] < $set['ct_refillprice'])
       {
           echo "You don't have enough " . $set['second_currency'] . "!";
       }
       else if ($ir['energy'] == $ir['maxenergy'])
       {
           echo "You already have full energy.";
       }
       else
       {
           $db->query(
                   "UPDATE users SET energy=maxenergy,`second` = `second`-{$set['ct_refillprice']} WHERE userid=$userid");
           echo "You have paid {$set['ct_refillprice']} "
                   . $set['second_currency'] . " to refill your energy bar.";
       }
   }
   else if ($_GET['spend'] == 'IQ')
   {
       echo "Type in the amount of " . $set['second_currency']
               . " you want to swap for IQ.
You have <b>{$ir['second']}</b> " . $set['second_currency'] . ".
One " . substr($set['second_currency'], 0, -1)
               . " = {$set['ct_iqpercrys']} IQ.<form action='"
               . gen_url('exchange', true)
               . "&spend=IQ2' method='post'><input type='text' name='"
               . $set['second_currency']
               . "' /><input type='submit' value='Swap' /></form>";
   }
   else if ($_GET['spend'] == 'IQ2')
   {
       $_POST[$set['second_currency']] =
               (int) $_POST[$set['second_currency']];
       if ($_POST[$set['second_currency']] <= 0
               || $_POST[$set['second_currency']] > $ir['second'])
       {
           echo "Error, you either do not have enough "
                   . $set['second_currency']
                   . " or did not fill out the form.
<a href='" . gen_url('exchange', true) . "&spend=IQ'>Back</a>";
       }
       else
       {
           $iqgain = $_POST[$set['second_currency']] * $set['ct_iqpercrys'];
           $db->query(
                   "UPDATE users SET `second` = `second`-{$_POST[$set['second_currency']]} WHERE userid=$userid");
           $db->query(
                   "UPDATE userstats SET IQ=IQ+$iqgain WHERE userid=$userid");
           echo "You traded {$_POST[$set['second_currency']]} "
                   . $set['second_currency'] . " for $iqgain IQ.";
       }
   }
   else if ($_GET['spend'] == 'main')
   {
       echo "
Type in the amount of ".$set['second_currency']." you want to swap for ".$set['main_currency'].".

You have <b>{$ir['second']}</b> ".$set['second_currency'].".
One ".substr($set['second_currency'], 0, -1)." = ".money_formatter($set['ct_moneypercrys']).".
<form action='".gen_url('exchange', true)."&spend=main2' method='post'>
<input type='text' name='".$set['second_currency']."' />

<input type='submit' value='Swap' />
</form>
       ";
   }
   else if ($_GET['spend'] == 'main2')
   {
   $_POST[$set['second_currency']] =
           (isset($_POST[$set['second_currency']]) && is_numeric($_POST[$set['second_currency']]))
                   ? abs(intval($_POST[$set['second_currency']])) : '';
       if ( empty($_POST[$set['second_currency']]) || $_POST[$set['second_currency']] > $ir['second'] )
       {
           echo "
           Error, you either do not have enough ".$set['second_currency']." or did not fill out the form.

           <a href='".gen_url('exchange', true)."&spend=main'>Back</a>
           ";
       }
       else
       {
           $iqgain =
                   $_POST[$set['second_currency']] * $set['ct_moneypercrys'];
           $db->query(
                   "UPDATE users SET `second` = `second`-{$_POST[$set['second_currency']]},`main` = `main`+$iqgain WHERE userid=$userid");
           echo "You traded {$_POST[$set['second_currency']]} "
                   . $set['second_currency'] . " for \$"
                   . number_format($iqgain) . ".";
       }
   }
}

$h->endpage();

 

If anyone could help, it would be much appreciated

Thank you. :)

Link to comment
Share on other sites

  • 2 weeks later...
  • 2 weeks later...

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...