<HTML><HEAD><TITLE>Hometown Bank</TITLE>
<META content="text/html; charset=windows-1252" http-equiv=Content-Type>
<META content="MSHTML 5.00.2314.1000" name=GENERATOR></HEAD>
<BODY>
<H1 align=center>Hometown Bank</H1>
<P>
<P>
Hi <?php echo $name?>.<br>
<?php
$db = mysql_connect();
mysql_select_db("bank",$db);
$str="select balance from hometown where username=\"".$name."\" and
password=\"".$password."\" ";
$result = mysql_query($str,$db) or die ("Invalid database query");
if(mysql_num_rows($result)==0){
printf("<p><b> Sorry, invalid userid or password </b>");
?>
<form action=bank01.php>
<input type=submit value="try again!">
</form>
</body>
</html>
<?php
}
else {
$balance=mysql_result($result,0,balance);
if(isset($amount)) {
if(isset($Deposit)) {
$balance=$balance+$amount;
}
if(isset($Withdraw)) {
$balance=$balance-$amount;
}
}
#printf("<br>amount: $%6.2f", $amount);
printf("<br>balance: $%6.2f", $balance);
$str="update hometown set balance=".$balance." where
username=\"".$name."\" and
password=\"".$password."\" ";
$result = mysql_query($str,$db) or die ("Invalid database query");
?>
<FORM action=bank02.php>
<INPUT TYPE=hidden NAME=name VALUE= <?php echo $name ?> >
<INPUT TYPE=hidden NAME=password VALUE= <?php echo $password ?> >
Enter Amount: <INPUT name=amount>
<P>
<INPUT name=Deposit type=submit value=Deposit>
<INPUT name=Withdraw type=submit value=Withdraw>
<INPUT name=".defaults" onclick="javascript:location='bank01.php'" type="button" value="Cancel">
</P>
</FORM>
</BODY></HTML>
<!--- note the closing bracket below has it's match way up -->
<?php
}
?>