Re: [mccode v2] Secure Bank!
about the bank test.php thing ya wanna do do this
1st change the name on file manager from bank.php to test.php
den put this in it should work
<?php
include (DIRNAME(__FILE__) . "/globals.php");
print "<h3>Bank</h3>";
if($ir['bankmoney']>-1)
{
$_GET['action'] = isset($_GET['action']) && is_string($_GET['action']) ? strtolower(trim($_GET['action'])) : "";
switch($_GET['action'])
{
case "deposit":
deposit();
break;
case "withdraw":
withdraw();
break;
default:
index();
break;
}
}
else
{
if(isset($_GET['buy']))
{
if($ir['money']>4999)
{
print "Congratulations, you bought a bank account for \$5,000!
[url='test.php']Start using my account[/url]";
$sql = sprintf("UPDATE users SET money = money - %u, bankmoney = bankmoney = %u WHERE (userid = %u)", 5000, 0, $userid);
$db->query($sql);
}
else
{
print "You do not have enough money to open an account.
[url='explore.php']Back to town...[/url]";
}
}
else
{
print "Open a bank account today, just \$5,000!
[url='test.php?buy']> Yes, sign me up![/url]";
}
}
function index()
{
global $db, $ir, $c, $userid, $h;
echo sprintf("[b]You currently have \$%s in the bank.[/b]
", number_format($ir['bankmoney']));
echo ("<table width='85%' cellspacing=1 class='table'>");
echo ("<tr>");
echo ("<td width='50%'>[b]Deposit money[/b]
");
echo ("It will cost you 15% of the money you deposit, rounded up. The maximum fee is \$3,000.<form action='test.php?action=deposit' method='post'>");
echo sprintf("Amount: <input type='text' name='deposit' value='%s' />
", $ir['money']);
echo ("<input type='submit' value='Deposit' /></form></td>");
echo ("<td width='50%'>[b]Withdraw money[/b]
");
echo ("There is no fee on withdrawals.<form action='bank.php?action=withdraw' method='post'>");
echo sprintf("Amount: <input type='text' name='withdraw' value='%s' />
", $ir['bankmoney']);
echo ("<input type='submit' value='Withdraw' /></form></td>");
echo ("</tr>");
echo ("</table>");
}
function deposit()
{
global $db,$ir,$c,$userid,$h;
$_POST['deposit'] = (float) $_POST['deposit'];
if($_POST['deposit'] > $ir['money'])
{
print "You do not have enough money to deposit this amount.";
}
else
{
$fee=ceil($_POST['deposit']*15/100);
if($fee > 3000) { $fee=3000; }
$gain=$_POST['deposit']-$fee;
$ir['money']+=$gain;
$sql = sprintf("UPDATE users SET bankmoney = bankmoney + %u, money = money - %u WHERE (userid = %u)", @intval($gain), $_POST['deposit'], $userid);
$db->query($sql);
echo sprintf("You hand over \$%s to be deposited,
after the fee is taken (\$%s), \$%s is added to your account.
[b]You now have \$%s in the bank.[/b]
[url='test.php']> Back[/url]", number_format($_POST['deposit']), number_format($fee), number_format($gain), number_format($ir['bankmoney']));
}
}
function withdraw()
{
global $db,$ir,$c,$userid,$h;
$_POST['withdraw'] = (float) $_POST['withdraw'];
if($_POST['withdraw'] > $ir['bankmoney'])
{
print "You do not have enough banked money to withdraw this amount.";
}
else
{
$_POST['withdraw'] = (float) $_POST['withdraw'];
$gain=$_POST['withdraw'];
$ir['bankmoney']-=$gain;
$sql = sprintf("UPDATE users SET bankmoney = bankmoney - %u, money = money + %u WHERE (userid = %u)", $gain, $gain, $userid);
$db->query($sql);
echo sprintf("You ask to withdraw %s,
the banking lady grudgingly hands it over.
[b]You now have \$%s in the bank.[/b]
[url='test.php']> Back[/url]", number_format($gain), number_format($ir['bankmoney']));
}
}
$h->endpage();
?>
that is tested and works on my site
if not workin add my msn
[email protected]