Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- //-----------------------------------
- // Mod created by Dave Macaulay ([email protected])
- // For free use only with Mccodes V2
- // For use of mod this must remain intack!
- //------------------------------------
- if(!isset($_GET['print'])) {
- require('globals.php');
- echo '<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script>
- <h3><u>City Bank</u></h3><hr/>';
- } else {
- require('globals_nonauth.php');
- }
- define('price', 5000);
- define('file', basename($_SERVER['SCRIPT_FILENAME']));
- $_GET['amount'] = (isset($_GET['amount']) && is_numeric($_GET['amount'])) ? abs(intval($_GET['amount'])) : '';
- if(isset($_GET['get_bank'])) {
- echo ($_GET['simple'] ? $ir['bankmoney'] : money_formatter($ir['bankmoney'] + 0));
- exit;
- }
- if(isset($_GET['get_hand'])) {
- echo ($_GET['simple'] ? $ir['money'] : money_formatter($ir['money'] + 0));
- exit;
- }
- if($ir['bankmoney'] < 0) {
- new_account();
- if(!isset($_GET['print'])) {
- $h->endpage();
- }
- exit;
- }
- if (!isset($_GET['a']))
- {
- $_GET['a'] = '';
- }
- switch($_GET['a'])
- {
- case 'deposit': deposit(); break;
- case 'withdraw': withdraw(); break;
- default: index(); break;
- }
- function new_account() {
- global $ir,$db,$c,$userid;
- if(!isset($_GET['print'])) {
- ?>
- <script type="text/javascript">
- function openAccount() {
- var c = confirm("Are you sure you want to open a bank account for <?=money_formatter(price)?>?");
- if(c) {
- $('#main_text').html('Opening account...
- ');
- $('#main_text').append('Checking you have the correct funds...
- ');
- if(<?=$ir['money']?> < <?=price?>) {
- $('#main_text').append('<span style="color: red;">Incorrect funds, You need another <?=money_formatter((price)-$ir['money'])?>...</span>');
- } else {
- $.post('<?=file?>?open=true&print=1', function(data) {
- if(data == 'not_enough_money') {
- $('#main_text').append('Incorrect funds...');
- } else if(data == 'opened') {
- $('#main_text').append('You have succesfully opened your brand new bank account!<a href="javascript:void(0);">>View Account</a>');
- }
- });
- }
- }
- }
- function showBank() {
- $.get('<?=file?>?print=1', function(data) {
- $('#main_text').html(data);
- });
- }
- </script>
- <?php
- }
- if(isset($_GET['open'])) {
- if($ir['money'] < price) {
- echo 'Not enough money to open a bank.';
- exit;
- } else {
- $db->query("UPDATE `users` SET `money` = `money` - " . price . ", `bankmoney` = 0 WHERE `userid` = " . $userid);
- echo 'Bank account opened.';
- exit;
- }
- } else {
- echo '
- <span id="main_text">
- You currently don\'t have a bank account with us, would you like to open an account for only <i>' . money_formatter(price + 0). '</i>!<br/>
- <a href="javascript:void(0);">>Open an account!</a></span>';
- }
- }
- function index() {
- global $ir,$db,$c,$userid;
- ?>
- <script type="text/javascript">
- function makeTrans(type) {
- if(type != 'withdraw' && type != 'deposit') {
- alert("Script Error!");
- } else {
- var data = $('[name='+type+']');
- $.post('<?=file?>?print=true&a=' + type, { 'amount' : data.val() }, function(data) {
- $('#' + type + '_callback').html(data);
- $.post('<?=file?>?print=true&get_bank=true', function(data) { $('#bank_money').html(data); });
- $.post('<?=file?>?print=true&get_bank=true&sim ple=true', function(data) { $('[name=withdraw]').val(data); });
- $.post('<?=file?>?print=true&get_hand=true&sim ple=true', function(data) { $('[name=deposit]').val(data); });
- });
- }
- }
- </script>
- <?php
- echo 'You currently have <i><span id="bank_money">' . money_formatter($ir['bankmoney'] + 0) . '</i> in your bank account. You are earning 2% interest on this daily.<br/>
- <a href="javascript:void(0);" target="_blank">>Withdraw</a><br/>
- <div id="withdraw" style="background: #ffffd3;border: 1px #ffff99 solid;display: none;padding: 20px;width: 250px;margin: 5px;">
- <form action="" method="post" onsubmit="makeTrans(\'withdraw\');return false;"><input type="text" name="withdraw" value="' . ($ir['bankmoney'] ? $ir['bankmoney'] : 0) . '" /> <input type="submit" value="Withdraw" /></form>
- <div id="withdraw_callback">
- Please select the amount you wish to withdraw then hit the withdraw button next to it.
- </div>
- </div>
- <a href="javascript:void(0);" target="_blank">>Deposit</a><br/>
- <div id="deposit" style="background: #ffffd3;border: 1px #ffff99 solid;display: none;padding: 20px;width: 250px;margin: 5px;">
- <form action ="" method="post" onsubmit="makeTrans(\'deposit\'); return false;"><input type="text" name="deposit" value="' . ($ir['money'] ? $ir['money'] : 0) . '" /> <input type="submit" value="Deposit" /></form>
- <div id="deposit_callback">
- Please choose the amount of money you wish to store in your account.
- </div>
- </div>
- ';
- }
- function deposit() {
- global $db,$ir,$c,$userid;
- if($_POST['amount'] > $ir['money']) {
- echo '<span style="color:red;">You do not have that much money to deposit!</span>';
- } else {
- $fee = ceil($_POST['amount'] * 15 / 100);
- $fee = ($fee > 3000 ? 3000 : $fee);
- $gain = $_POST['amount'] - $fee;
- $db->query("UPDATE `users` SET `bankmoney` = `bankmoney` + ".$gain.", `money` = `money` - ".$_POST['amount']." WHERE `userid` = ".$userid);
- echo 'You deposited ' . money_formatter($_POST['amount'] + 0) . ' into your account.
- The 15% fee of ' . money_formatter($fee + 0) . ' was taken depositing you a final amount of ' . money_formatter($gain + 0) . '.';
- }
- }
- function withdraw() {
- global $db,$ir,$c,$userid;
- if(isset($_POST['amount']) && $_POST['money'] > $ir['bankmoney']) {
- echo '<span style="color:red;">You dont have enough money saved to withdraw that much!</span>';
- } else {
- $db->query("UPDATE `users` SET `bankmoney` = `bankmoney` - " . $_POST['amount'] . ", `money` = `money` + " . $_POST['amount'] . " WHERE `userid` = ".$userid);
- $ir['money'] += $_POST['amount'];
- echo 'You withdrew ' . money_formatter($_POST['amount'] + 0) . ' into your hand from your account.<br/>
- You know have ' . money_formatter($ir['money'] + 0) . ' in your hand.';
- }
- }
- if(!isset($_GET['print'])) {
- $h->endpage();
- }
- ?>
Add Comment
Please, Sign In to add comment