Jump to content
MakeWebGames

help with a mod I tried coverting a bank to a crystal bank


Recommended Posts

Posted

This is my first time ever trying this

Error:

Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/gucci/public_html/crystalbank.php on line 72

 

crystalbank.php

<?php
include "globals.php";
print "<h3>Crystal Bank</h3>";
if($ir['bankcrystals']>-1)
{
switch($_GET['action'])
{
case "deposit":
deposit();
break;

case "withdraw":
withdraw();
break;

default:
index();
break;
}

}
else
{
if(isset($_GET['buy']))
{
if($ir['money']>5000)
{
print "Congratulations, you bought a crystal bank account for \$5,000!

[url='crystalbank.php']Start using my account[/url]";
$db->query("UPDATE users SET money=money-5000,bankcrystals=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 \$5,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']} crystal in the bank.[/b]

<table width='75%' cellspacing=1 class='table'> <tr> <td width='50%'>[b]Deposit crystal[/b]

It will cost you 15% of the crystals you deposit, rounded up. The maximum fee is \3 crystals.<form action='crystalbank.php?action=deposit' method='post'>
Amount: <input type='text' name='deposit' value='{$ir['crystals']}' />

<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['bankcrystals']}' />

<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 deposit this amount.";
}
else
{
$fee=ceil($_POST['deposit']*15/100);
if($fee > 3) { $fee=3; }
$gain=$_POST['deposit']-$fee;
$ir['bankcrystals']+=$gain;
$db->query("UPDATE users SET bankcrystals=bankcrystals+$gain, crystals=crystals-{$_POST['deposit']} where userid=$userid");
print "You hand over \{$_POST['deposit']} to be deposited, 

after the fee is taken (\$$fee), \$$gain is added to your account. 

[b]You now have \${$ir['bankcrystals']} in the bank.[/b]

[url='bank.php']> Back[/url]";
}
}
function withdraw()
{
global $db,$ir,$c,$userid,$h;
$_POST['withdraw']=abs((int) $_POST['withdraw']);
if($_POST['withdraw'] > $ir['bankcrystals'])
{
print "You do not have enough banked crystals to withdraw this amount.";
}
else
{

$gain=$_POST['withdraw'];
$ir['bankcrystals']-=$gain;
$db->query("UPDATE users SET bankcrystals=bankcrystals-$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['bankcrystals']} in the bank.[/b]

[url='crystalbank.php']> Back[/url]";
}
}
$h->endpage();
?>

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...