Jump to content
MakeWebGames

Bank


Dayo

Recommended Posts

Here is a bank for your games, there ios no sql as the tables already exist. Enjoy :D

to edit the percentage just cange $bperc at the top if you dont want to charge intrest make it 0

<?php
include 'top.php';
// Bank Script Made By Dayo
// Made for the GL scripts
$bperc = 3; // set this to the ammount you want to charge to deposit money
// dont forget to make a link on your menu [url='bank.php']Bank[/url]

if (isset($_POST['withdraw'])) {
$withdraw = abs(@intval($_POST['withdraw']));
if ($withdraw > $bank_money) { echo 'You dont have enough money in your bank to do this';} else { mysql_query("UPDATE `login` SET `money`=`money`+'".$withdraw."',  `bank`=`bank`-'".$withdraw."'"); echo 'You withdrew $'.number_format($withdraw).' from your bank.';}
} else if (isset($_POST['deposit'])) {

$ibp = 100 - $bperc;
$deposit = abs(@intval($_POST['deposit']));
$depo=round($deposit/100);
$deposit2 = $depo*$ibp;
if ($deposit > $money) { echo 'You dont have enough money to do this';} else { mysql_query("UPDATE `login` SET `money`=`money`-'".$deposit."', `bank`=`bank`+'".$deposit2."'"); 
echo mysql_error();
echo 'You deposited $'.number_format($deposit).' into your bank.';}
}
?>
<form name="form1" method="post" action="">
<?php  	 if ($_GET['action']=='deposit') 
{ echo '[[url="bank.php?action=withdraw"]Withdraw Money[/url]] [Deposit Money]'; }
else if 
($_GET['action'] == 'withdraw') { echo '[Withdraw Money] [[url="bank.php?action=deposit"]Deposit Money[/url]]';}?>
 <table width="400" border="0" cellspacing="0" cellpadding="0">
   <tr>
     <td colspan="2">[b]Bank[/b]</td>
   </tr>    <?php if ($bperc > 0) {?>
<tr>
     <td colspan="2">There is a charge of <?php echo $bperc; ?>% to deposit your money</td>
   </tr> <?php }// ends $bperc if statment?>

  <?php if ($_GET['action']=='withdraw') {?> <tr>
     <td>Withdraw</td>
     <td><label>
       <input name="withdraw" type="text" id="withdraw" value="<?php echo round($bank_money); ?>">
     </label></td>
   </tr><?php } else if ($_GET['action']=='deposit') {?>
   <tr>
     <td>Deposit</td>
     <td><label>
       <input name="deposit" type="text" id="deposit" value="<?php echo $money; ?>">
     </label></td>
   </tr><?php }  if (!isset($_GET['action'])) { echo '<tr><td>[url="bank.php?action=withdraw"]Withdraw Money[/url]</td><td>[url="bank.php?action=deposit"]Deposit Money[/url]</td></tr>';} else {?>
   <tr>
     <td colspan="2"><label>
       <input type="submit" name="Submit" value="Submit">
     </label></td>
   </tr><?php } ?>
 </table>
</form>
<?php include 'bottom.php';
?>

if you have any problems post here

Link to comment
Share on other sites

  • 5 months 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...