antoheley
12-30-2003, 10:23 PM
Hi is there anything wrong with this code because it dont seem to work on my game.
<body bgcolor="#000000">
<?php $title = "Bank"; include("header.php"); ?>
<font color="#00CC66">Welcome to the bank, $user. You can deposit your extra credits in here, to avoid having them stolen by attackers.</colour>
<?php
if ($action == with) {
if ($with > $stat[bank] || $with <= 0) {
print "You cannot withdraw that amount.";
include("footer2.php");
exit;
}
mysql_query("update players set cash=cash+$with where id=$stat[id]");
mysql_query("update players set bank=bank-$with where id=$stat[id]");
print "You withdrew $with cash.";
}
if ($action == deposit) {
if ($dep > $stat[cash] || $dep <= 0) {
print "You cannot withdraw that amount.";
include("footer2.php");
exit;
}
mysql_query("update players set cash=cash-$dep where id=$stat[id]");
mysql_query("update players set bank=bank+$dep where id=$stat[id]");
print "You deposited $dep credits.";
}
}
?>
<form method=post action=bank.php?action=withdraw>
<?php
print "I will <input type=submit value=withdraw> <input type=text value=$stat[bank] name=with> credits.";
?>
</form>
<form method=post action=bank.php?action=deposit>
<?php
print "I will <input type=submit value=deposit> <input type=text value=$stat[credits] name=dep> credits.";
?>
</form>
<?php include("footer.php"); ?>
please help.
thanks alot
anto
<body bgcolor="#000000">
<?php $title = "Bank"; include("header.php"); ?>
<font color="#00CC66">Welcome to the bank, $user. You can deposit your extra credits in here, to avoid having them stolen by attackers.</colour>
<?php
if ($action == with) {
if ($with > $stat[bank] || $with <= 0) {
print "You cannot withdraw that amount.";
include("footer2.php");
exit;
}
mysql_query("update players set cash=cash+$with where id=$stat[id]");
mysql_query("update players set bank=bank-$with where id=$stat[id]");
print "You withdrew $with cash.";
}
if ($action == deposit) {
if ($dep > $stat[cash] || $dep <= 0) {
print "You cannot withdraw that amount.";
include("footer2.php");
exit;
}
mysql_query("update players set cash=cash-$dep where id=$stat[id]");
mysql_query("update players set bank=bank+$dep where id=$stat[id]");
print "You deposited $dep credits.";
}
}
?>
<form method=post action=bank.php?action=withdraw>
<?php
print "I will <input type=submit value=withdraw> <input type=text value=$stat[bank] name=with> credits.";
?>
</form>
<form method=post action=bank.php?action=deposit>
<?php
print "I will <input type=submit value=deposit> <input type=text value=$stat[credits] name=dep> credits.";
?>
</form>
<?php include("footer.php"); ?>
please help.
thanks alot
anto