Hey,
Create A File Called crystalbank.php
And insert
<?php
require "globals.php";
print "<h3>Crystal Bank</h3>";
if($ir['crystalbank']>-1)
{
switch($_GET['action'])
{
case "deposit":
deposit();
break;
case "withdraw":
withdraw();
break;
default:
index();
break;
}
}
else
{
if(isset($_GET['buy']))
{
if($ir['money']>5000000)
{
print "Congratulations, you bought a crystal bank account for \$25,000!
[url='crystalbank.php']Start using my account[/url]";
$db->query("UPDATE users SET money=money-5000000,crystalbank=0 WHERE userid=$userid");
}
else
{
print "You do not have enough Money to open an account.
[url='explore.php']Back to town...[/url]";
}
}
else
{
print "Open a crystal bank account today, just \$25,000!
[url='crystalbank.php?buy']> Yes, sign me up![/url]";
}
}
function index()
{
global $db, $ir,$c,$userid,$h;
print "\n[b]You currently have {$ir['crystalbank']} crystals in your Crystal bank.[/b]
<table width='75%' cellspacing=1 class='table'> <tr> <td width='50%'>[b]Deposit crystal[/b]
<form action='crystalbank.php?action=deposit' method='post'>
Amount: <input type='text' name='deposit' value='{$ir['crystalbank']}' />
<input type='submit' value='Deposit' /></form></td> <td>
[b]Withdraw crystals[/b]
There is no fee on withdrawals.<form action='crystalbank.php?action=withdraw' method='post'>
Amount: <input type='text' name='withdraw' value='{$ir['crystalbank']}' />
<input type='submit' value='Withdraw' /></form></td> </tr> </table>";
}
function deposit()
{
global $db,$ir,$c,$userid,$h;
$_POST['deposit']=abs((int) $_POST['deposit']);
if($_POST['deposit'] > $ir['crystals'])
{
print "You do not have enough crystals to deposite in the bank.";
}
else
{
$gain=$_POST['deposit']-$fee;
$ir['crystals']+=$gain;
$db->query("UPDATE users SET crystalbank=crystalbank+$gain, crystals=crystals-{$_POST['deposit']} where userid=$userid");
print "You hand over {$_POST['deposit']} to be deposited,
$gain is added to your account.
[b]You now have {$ir['crystalbank']} in the bank.[/b]
[url='crystalbank.php']> Back[/url]";
}
}
function withdraw()
{
global $db,$ir,$c,$userid,$h;
$_POST['withdraw']=abs((int) $_POST['withdraw']);
if($_POST['withdraw'] > $ir['crystalbank'])
{
print "You do not have enough crystals to withdraw from the bank.";
}
else
{
$gain=$_POST['withdraw'];
$ir['crystalbank']-=$gain;
$db->query("UPDATE users SET crystalbank=crystalbank-$gain, crystals=crystals+$gain where userid=$userid");
print "You ask to withdraw $gain,
the banking lady grudgingly hands it over.
[b]You now have {$ir['crystalbank']} in the bank.[/b]
[url='crystalbank.php']> Back[/url]";
}
}
$h->endpage();
?>
Then save and then open your php and run
ALTER TABLE `users` ADD `crystalbank` INT( 11 ) NOT NULL DEFAULT '-1';
Now open your explore.php
Find
[url='estate.php']Estate Agent[/url]
Under that add
[url='crystalbank.php']Crystal Bank[/url]
And There You Have It :)
I Know its basic stuff but i hope it helps :D
Nathan//
www.eyesofdoom.ej.am