MarFur93 Posted April 14, 2008 Share Posted April 14, 2008 I keep Receiving the following error when I access Cyberbank: Parse error: syntax error, unexpected T_STRING, expecting T_VARIABLE or '$' in /home/marfur93/public_html/cyberbank.php on line 81 Does anyone know how I can Fix this? The Following Is my cyberbank.php <?php include "globals.php"; print "<h3>Cyber Bank</h3>"; if($ir['cybermoney']>-1) { switch($_GET['action']) { case "deposit": deposit(); break; case "withdraw": withdraw(); break; default: index(); break; } } else { if(isset($_GET['buy'])) { if($ir['money']>9999999) { print "Congratulations, you bought a bank account for \$10,000,000! Start using my account"; $db->query("UPDATE users SET money=money-10000000,cybermoney=0 WHERE userid=$userid"); } else { print "You do not have enough money to open an account. Back to town..."; } } else { print "Open a bank account today, just \$10,000,000! > Yes, sign me up!"; } } function index() { global $db,$ir,$c,$userid,$h; print "\nYou currently have \${$ir['cybermoney']} in the bank. At the end of each day, your bank balance will go up by 7%. <table width='75%' border='2'> <tr> <td width='50%'>Deposit Money It will cost you 15% of the money you deposit, rounded up. The maximum fee is \$1,500,000.<form action='cyberbank.php?action=deposit' method='post'> Amount: <input type='text' name='deposit' value='{$ir['money']}' /> <input type='submit' value='Deposit' /></form></td> <td> Withdraw Money It will cost you 7.5% of the money you withdraw, rounded up. The maximum fee is \$750,000.<form action='cyberbank.php?action=withdraw' method='post'> Amount: <input type='text' name='withdraw' value='{$ir['cybermoney']}' /> <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['money']) { print "You do not have enough money to deposit this amount."; } else { $fee=ceil($_POST['deposit']*15/100); if($fee > 1500000) { $fee=1500000; } $gain=$_POST['deposit']-$fee; $ir['cybermoney']+=$gain; $db->query("UPDATE users SET cybermoney=cybermoney+$gain, money=money-{$_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. You now have \${$ir['cybermoney']} in the Cyber Bank. > Back"; } } function withdraw() { global db,$ir,$c,$userid,$h; $_POST['withdraw']=abs((int) $_POST['withdraw']); if($_POST['withdraw'] > $ir['cybermoney']) { print "You do not have enough banked money to withdraw this amount."; } else { $fee=ceil($_POST['withdraw']*75/1000); if($fee > 750000) { $fee=750000; } $gain=$_POST['withdraw']-$fee; $ir['cybermoney']-=$gain; $db->query("UPDATE users SET cybermoney=cybermoney-$gain, money=money+$gain where userid=$userid"); print "You ask to withdraw $gain, the teller hands it over after she takes the bank fees. You now have \${$ir['cybermoney']} in the Cyber Bank. > Back"; } } $h->endpage(); ?> Quote Link to comment Share on other sites More sharing options...
Floydian Posted April 14, 2008 Share Posted April 14, 2008 Re: Help Needed With Cyberbank [MCcodes v2.0] function withdraw() { global db,$ir,$c,$userid,$h; Where it says that, put this: function withdraw() { global $db,$ir,$c,$userid,$h; Quote Link to comment Share on other sites More sharing options...
MarFur93 Posted April 14, 2008 Author Share Posted April 14, 2008 Re: Help Needed With Cyberbank [MCcodes v2.0] Thanks very much for that! :-D Quote Link to comment Share on other sites More sharing options...
Floydian Posted April 14, 2008 Share Posted April 14, 2008 Re: Help Needed With Cyberbank [MCcodes v2.0] You're welcome. ;) I put that code into my PHP Code IDE (Zend) and it took me right to that spot. It might be helpful to pick up a good PHP IDE with syntax error detection built in. Of course it's not necessary, but for errors like these, it's super fast in detecting them ;) Quote Link to comment Share on other sites More sharing options...
MarFur93 Posted April 15, 2008 Author Share Posted April 15, 2008 Re: Help Needed With Cyberbank [MCcodes v2.0] Thanks, I might take your advice on that! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.