Jump to content

How do i convert Resources?


Twysted

Recommended Posts

ok i have this set so you convert x ore into x silver but i don't know how to make it where you convert xy ore into x silver. anybobody can help me with this?

[code]<?php

$isadmin = "*";
include( "../includes/inc-header.php" );
if ( !$_POST['ore1_convert'] && !$_POST['silver_convert'] ) {

?>
<form action="silver_bank.php" method="post">
<table width="100%"  border="0">
  <tr>
<td colspan="2" class="bodycell3">Conversion Labratory</td>
  </tr>
  <tr>
<td colspan="2" class="bodycell4">
<center>
Conversions: <?=$user['uConvert']?> / <?=$user['uConvertMax']?>
</center>
</td>
  </tr>
  <tr>
<td class="bodycell4" width="50%" align="center">
<b>Convert Ore to Silver:</b><br><br>
<input name="ore1" type="text" value="0" size="5" maxlength="10"> / <?=$user['uOre']?><br><br>
<input name="ore1_convert" type="submit" value="Convert">
</td>
<td class="bodycell4" width="50%" align="center">
<b>DeConvert Silver to Ore:</b><br><br>
<input name="ore2" type="text" value="0" size="5" maxlength="10"> / <?=$user['uSilver']?><br><br>
<input name="silver_convert" type="submit" value="DeConvert">
</td>
  </tr>
</table>
</form>
<?php
} elseif ( $_POST['silver_convert'] ) {

    ?>
<table width="100%"  border="0">
  <tr>
<td class="bodycell3">Conversion Labratory</td>
  </tr>
  <tr>
<td class="bodycell4" align="center">
<?php
    $ores = round( str_replace( "-", "", $_POST['ore1'] ) );
    if ( $ores > $user['uOre'] ) {
        echo "You don't have enough Ore.";
    } elseif ( $ores < 5 ) {
        echo "You must enter a proper amount.";
    } elseif ( $user['uConvert'] == 0 ) {
        echo "You can't deposit any more for today.";
    } else {
        echo "You sucessfully coverted $ores Ore, Into $ores Silver.";
        $db->query( "UPDATE users SET uOre=uOre-$ores,uSilver=uSilver+$ores,uConvert=uConvert-1 WHERE uID='" . $user['uID'] . "'" );
    }

    ?>
<br><br>
<a href="javascript:history.back();">BACK</a>
</td>
  </tr>
</table>
<?php
} elseif ( $_POST['silver_convert'] ) {

    ?>
<table width="100%"  border="0">
  <tr>
<td class="bodycell3">Conversion Labratory</td>
  </tr>
  <tr>
<td class="bodycell4" align="center">
<?php
    $ores = round( str_replace( "-", "", $_POST['ore2'] ) );
    if ( $ores > $user['uSilver'] ) {
        echo "You don't have enough silver on hand.";
    } elseif ( $ores < 10 ) {
        echo "You must enter a proper amount.";
    } else {
        echo "You sucessfully deconverted $ores silver back into Ore.";
        $db->query( "UPDATE users SET uOre=uOre+$ores,uSilver=uSilver-$ores WHERE uID='" . $user['uID'] . "'" );
    }

    ?>
<br><br>
<a href="javascript:history.back();">BACK</a>
</td>
  </tr>
</table>
<?php
}
include( "../includes/inc-footer.php" );

?>[/code]
Link to comment
https://forums.phpfreaks.com/topic/27898-how-do-i-convert-resources/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.