WE ARE DONE!!!
This commit is contained in:
ry1015
2014-12-04 16:16:02 -08:00
parent 61823305bc
commit 73ab147b67
43 changed files with 1871 additions and 236 deletions

View File

@@ -1,60 +1,240 @@
F8L Exception -- 15 Functions:
1. Add New User
** LOCATION: new_account
Add New Account (checking/savings)
Add New Loan
Add New CreditCard
INSERT INTO account (username,balance,acctype)
VALUES ('$userName','$balance','$accountType')
** LOCATION: new_loan
Add New Loan
INSERT INTO loan (username, amount, balance, interestrate, dateopened, paymentDueDate)
VALUES ('$userName', '$balance', '$balance', .1050, Now(), Now() + INTERVAL 30 DAY)
** LOCATION: new_creditcard
Add New CreditCard
INSERT INTO creditcard (username, maxLimit, dateopened, paymentDueDate)
VALUES ('$userName', '$limit', Now(), Now() + INTERVAL 30 DAY)
2. Change Password
Reset Password
** LOCATION: change_password
3. View Account Statement (checking/savings)
4. Overdraft Fee (Trigger)
*** LOCATION: inc_userFunctions
*** FUNCTION NAME: function getChecking($Login)
*** FUNCTION NAME: function getSavings($Login)
*** FUNCTION NAME: function getCredit($Login)
*** FUNCTION NAME: function getLoan($Login)
View Checking and Savings
SELECT * from account WHERE username='$userName'
View Loan
SELECT * from loan WHERE username='$userName'
View Credit Card
SELECT * from creditcard WHERE username='$userName'
4. Checking/Savings Overdraft Fee (Trigger)
charge $25 fee if balance dips below zero
DELIMITER //
CREATE TRIGGER overdraftfee
BEFORE UPDATE ON account
FOR EACH ROW
BEGIN
IF NEW.balance < 0 THEN
SET NEW.balance= NEW.balance - 25;
INSERT INTO transaction(username, accid, transtype, toID, acctype, amount)
VALUES(NEW.username, NEW.accid, 'Overdraft Fee', NEW.accid, NEW.acctype, 25);
END IF;
END //
DELIMITER ;
5. ATM Fee (Trigger)
charge $3 fee every time function ATMwithdraw is used
6. Late Payment (Trigger)
charge $10 fee for every late payment
5. View Existing User Accounts and # of Existing Accounts
*** LOCATION: inc_adminFunctions
*** FUNCTION NAME: function getUserAccounts()
SELECT acctype, count(*) FROM(
SELECT username,acctype FROM account
UNION
SELECT username, acctype FROM creditcard
UNION
SELECT username,acctype FROM loan) acl
GROUP BY acctype;
6. Late Credit Card Payment (Trigger)
charge $10 fee for every late CC payment
DELIMITER //
CREATE TRIGGER lateccfee
BEFORE UPDATE ON CreditCard
FOR EACH ROW BEGIN
IF New.balance<Old.balance AND Old.paymentDueDate<CURDATE() THEN
SET New.balance=New.balance+10;
INSERT INTO transaction(username, accid, transtype, toID, acctype, amount)
VALUES(NEW.username, NEW.creditid, 'CC Late Payment Fee', NEW.creditid, NEW.acctype, 10);
END IF;
END //
DELIMITER ;
*** To test, first find past due credit card accounts:
SELECT username,accID,balance FROM creditcard WHERE paymentDueDate<CURDATE();
7. Low Balance (Admin - Stored Procedure)
generate a list of users (username and email) with accounts that have balances <$200
*** LOCATION: inc_adminFunctions
*** FUNCTION NAME: getLowBalance($num)
DROP PROCEDURE IF EXISTS getLowBalance;
DELIMITER //
CREATE PROCEDURE getLowBalance(IN num DOUBLE)
BEGIN
SELECT username, acctype, balance
FROM account
where balance <= num;
END //
DELIMITER ;
7. Low Balance (Admin - Stored Procedure) - DONE
generate a list of users with accounts that have balances <$200
8. Daily Login (Admin - Stored Procedure)
generate a list of users who logged in today
*** LOCATION: inc_userFunctions
*** FUNCTION NAME: function login($username)
DELIMITER //
CREATE PROCEDURE logUser(IN user VARCHAR(30))
BEGIN
INSERT INTO log(username) VALUES(user);
END //
DELIMITER ;
9. Loyalty Program (Admin - Stored Procedure)
generate a list of users with more than $10,000 combined balance
and have been customer for over 1 year
and have been customer for over 5 years
*** LOCATION: inc_adminFunctions
*** FUNCTION NAME: getLoyalCustomers()
10. Annual Credit Card Fee (Trigger)
charge a $20 per year fee to all credit card accounts
DROP PROCEDURE IF EXISTS loyaltyProgram;
DELIMITER //
CREATE PROCEDURE loyaltyProgram (OUT offer VARCHAR(30))
BEGIN
SELECT username FROM users
WHERE openDate<'2009-11-30'
AND username IN
(SELECT username FROM account
GROUP BY username
HAVING sum(balance)>10000);
END //
DELIMITER ;
CALL loyaltyProgram(@mylist);
SELECT @mylist;
11. No cc w/ $> (Admin)
10. List User Accounts
*** LOCATION: inc_adminFunctions
*** FUNCTION NAME: getNumAccounts()
SELECT a.username, a.acctype, numofcredit, numofloan
FROM account a
LEFT JOIN
(SELECT username, count(*) as numofcredit
FROM creditcard
GROUP BY username) c on a.username=c.username
LEFT JOIN
(SELECT username, count(*) as numofloan
FROM loan
GROUP BY username) l on c.username=l.username
ORDER BY a.username ASC;
11. Offer Credit Card > (Admin)
examines all accounts.
if account is greater than $5,000, offer a credit card.
*** LOCATION: inc_adminFunctions
*** FUNCTION NAME: getOfferCC($num)
DROP PROCEDURE IF EXISTS offerCreditCard;
DELIMITER //
CREATE PROCEDURE offerCreditCard(IN amount DOUBLE)
BEGIN
SELECT DISTINCT username, total FROM account
WHERE username IN
(SELECT username, sum(balance) as total FROM account GROUP BY username HAVING total >amount)
AND username NOT IN
(SELECT username FROM creditcard);
END //
DELIMITER ;
12. Archive Transaction table (Stored Procedure)
manually run a procedure that archives transactions older than 7 days
manually run a procedure that archives transactions older than 30 days
*** LOCATION: inc_adminFunctions
*** FUNCTION NAME: function archiveTransaction()
DROP PROCEDURE IF EXISTS archiveTransaction;
DELIMITER //
CREATE PROCEDURE archiveTransaction()
BEGIN
INSERT INTO archive(accid, username, acctype, transtype, amount, toid, date)
SELECT accid, username, acctype, transtype, amount, toid, curdate()
FROM transaction;
UPDATE transaction set updatedat = CURDATE();
END //
DELIMITER ;
13. Delete Inactive Checking/Savings Accounts (Admin)
delete all Ch/Sa accounts that have $0 balance and have not been accessed in 60 days
delete all Ch/Sa accounts that have $0 balance and have not been accessed in 90 days
this delete will cascade through the Transactions table
DELIMITER //
CREATE TRIGGER deleteInactive
AFTER INSERT ON log
FOR EACH ROW BEGIN
DELETE from users
WHERE username IN
(SELECT username
FROM log
GROUP BY username
HAVING max(logindate) + INTERVAL 90 DAY < CURDATE()) and username IN
(SELECT username
FROM account
GROUP BY username
HAVING sum(balance) = 0);
END //
DELIMITER ;
14. Increase Credit Card Limit (Admin)
15. Daily Transactions Tally (Admin)
show the sum of all deposits and withdraws for one day
DROP PROCEDURE IF EXISTS increaseCCLimit;
DELIMITER //
CREATE PROCEDURE increaseCCLimit(IN amount DOUBLE)
BEGIN
SELECT c.username , c.maxlimit, sum(a.balance) as totalbalance
FROM account a right join creditcard c on a.username=c.username
GROUP BY username
HAVING totalbalance > amount;
END //
DELIMITER ;
STORED PROCEDURE
DROP PROCEDURE IF EXISTS getLowBalance;
DELIMITER //
CREATE PROCEDURE getLowBalance()
BEGIN
SELECT username, acctype, balance
FROM account
where balance <= 200;
END //
DELIMITER;
15. Monthly Transactions Tally (Admin)
show the sum of all deposits and withdraws for one month
DROP PROCEDURE IF EXISTS monthlyDeposit;
DELIMITER //
CREATE PROCEDURE monthlyDeposit(IN aDate DATE)
BEGIN
SELECT SUM(amount) as total
FROM transaction
WHERE transtype='Deposit' and MONTH(transdate)=MONTH(aDate) and YEAR(transdate)=YEAR(aDate);
END //
DELIMITER ;
16. Display User Transactions Sorted By Date
getChecking($username);
getSavings($username);
getCredit($username);
getLoan($username);

View File

@@ -29,7 +29,7 @@ if (isset($_POST['Submit'])){
$password = validateInput($_POST['pass'],"Password");
//Check if there is an error on userName and/or password.
if ($errorMessage == ""){
$result = queryMysql("SELECT username,password FROM Users WHERE username='$userName' AND password='$password'");
$result = queryMysql("SELECT username,password FROM admin WHERE username='$userName' AND password='$password'");
$num = $result->num_rows;
if ($result->num_rows == 0)
@@ -46,5 +46,7 @@ echo <<<_END
<p>Password <input type="password" name="pass" /></p>
<p><input type="submit" name="Submit" value="Log in" /></p>
</form>
</body>
</html>
_END;
?>

View File

@@ -1,6 +1,7 @@
<?php
include 'includes/inc_header.php';
include 'includes/inc_adminFunctions.php';
include 'includes/inc_userFunctions.php';
echo <<<_END
<!-- F8L Exception Online Bank | Admin Home -->
@@ -9,77 +10,195 @@ echo <<<_END
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<title>F8L Exception Online Bank | Admin Home</title>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<link rel = 'stylesheet' href='styles.css' type='text/css'></link>
</head>
<body>
<h1>Admin Home</h1>
<hr />
_END;
?>
echo <<<_END
<form action="admin_home.php" method="post">
<select name="view">
<option value=""></option>
<option value="lowBalance">Low Balance Account</option>
<option value="increaseLimit">Increase Credit Limit</option>
<option value="offerCredit">Offer Credit</option>
</select>
<input type="submit" value="View">
</form>
<body>
<h1>Admin Home</h1>
<hr />
<div class="container">
<div>
<div>
<form name="lowBalanceForm" action="admin_home.php" method="post">
<fieldset>
<legend><b>Low Balance</b></legend>
<p>
<label>Enter Amount:</label>
<input type="number" name="lowBalance"/>
<input type="submit" value="View">
</p>
</fieldset>
</form>
</div>
<div>
<form name="increaseLimitForm" action="admin_home.php" method="post">
<fieldset>
<legend><b>Increase Credit Card Limit</b></legend>
<p>
<label>Enter Minimum Balance:</label>
<input type="number" name="increaseLimit"/>
<input type="submit" value="View">
</p>
</fieldset>
</form>
</div>
<div>
<form action="admin_home.php" method="post">
<fieldset>
<legend><b>Offer Credit Card</b></legend>
<p>
<label>Enter Amount:</label>
<input type="number" name="offerCC"/>
<input type="submit" value="View">
</p>
</fieldset>
</form>
</div>
<div>
<form action="admin_home.php" method="post">
<fieldset>
<legend><b>User Transactions</b></legend>
<p>
<label>Enter Username:</label>
<input type="text" name="userTrans"/>
<input type="submit" value="View">
</p>
</fieldset>
</form>
</div>
<div>
<form action="admin_home.php" method="post">
<fieldset>
<legend><b>Total Deposit on a Specific Month</b></legend>
<p>
<label>Enter Date (YYYY-MM-DD):</label>
<input type="text" name="totalTrans"/>
<input type="submit" value="View">
</p>
</fieldset>
</form>
</div>
<div>
<form action="admin_home.php" method="post">
<fieldset>
<legend><b>Number of Accounts</b></legend>
<p>
<input type="submit" value="View Number of Accounts" name="numaccounts">
</p>
</fieldset>
</form>
</div>
<div>
<form action="admin_home.php" method="post">
<fieldset>
<legend><b>User Accounts</b></legend>
<p>
<input type="submit" value="View User Accounts" name="useraccounts">
</p>
</fieldset>
</form>
</div>
<div>
<form action="admin_home.php" method="post">
<fieldset>
<legend><b>Loyal Customers</b></legend>
<p>
<input type="submit" value="View Loyal Customers" name="loyal">
</p>
</fieldset>
</form>
</div>
<div>
<form action="admin_home.php" method="post">
<fieldset>
<legend><b>Archive Transaction Table</b></legend>
<p>
<input type="submit" value="Archive Transaction Table" name="archivetransaction">
</p>
</fieldset>
</form>
</div>
<div id="test">
</div>
</div>
</div>
<div id="results_table">
<?php
if (isset($_POST['lowBalance'])){
echo <<<_END
<h2 class='tabletitle'>LOW BALANCE</h2>
<table>
<tr>
<th>Username</th>
<th>Account Type</th>
<th>Balance</th>
</tr>
_END;
if (isset($_POST['view'])){
if ($_POST['view'] == 'lowBalance'){
echo <<<_END
<h2 class='tabletitle'>LOW BALANCE</h2>
<table>
<tr>
<th>Username</th>
<th>Account Type</th>
<th>Balance</th>
</tr>
_END;
viewLowBalance();
} elseif ($_POST['view'] == 'increaseLimit'){
echo <<<_END
//See inc_admin_Functions
getLowBalance($_POST['lowBalance']);
} elseif (isset($_POST['increaseLimit'])){
echo <<<_END
<h2 class='tabletitle'>INCREASE CREDIT CARD LIMIT</h2>
<table>
<tr>
<th>Username</th>
<th>Max Limit</th>
<th>Balance</th>
<th>Account Type</th>
<th>Credit Card Max Limit</th>
<th>Total Account Balance</th>
</tr>
_END;
increaseLimit();
} elseif ($_POST['view'] == 'offerCredit'){
echo <<<_END
//See inc_admin_Functions
getIncreaseCCLimit($_POST['increaseLimit']);
} elseif (isset($_POST['offerCC'])){
echo <<<_END
<h2 class='tabletitle'>OFFER CREDIT CARD</h2>
<table>
<table id='offerCC'>
<tr>
<th>Username</th>
<th>Balance</th>
</tr>
_END;
offerCredit();
}
//See inc_admin_Functions
getOfferCC($_POST['offerCC']);
} elseif (isset($_POST['numaccounts'])){
getNumAccounts();
} elseif (isset ($_POST['loyal'])){
getLoyalCustomers();
} elseif (isset ($_POST['useraccounts'])){
getUserAccounts();
} elseif (isset ($_POST['archivetransaction'])){
archiveTransaction();
} elseif (isset($_POST['userTrans'])) {
echo "<h2>Username: " . $_POST['userTrans'] . "</h2>";
getChecking($_POST['userTrans']);
getSavings($_POST['userTrans']);
getCredit($_POST['userTrans']);
getLoan($_POST['userTrans']);
} elseif (isset ($_POST['totalTrans'])){
getMonthlyDeposit($_POST['totalTrans']);
}
echo <<<_END
</table>
_END;
}
function viewLowBalance(){
lowBalance();
}
function increaseLimit(){
increaseCCLimit();
}
function offerCredit(){
offerCC();
}
?>
</div>
</body>
</html>

94
f8l_exception/credit.php Normal file
View File

@@ -0,0 +1,94 @@
<!-- F8L Exception Online Bank | Withdraw -->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>F8L Exception Online Bank | Credit</title>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<?php include 'includes/inc_header.php'; ?>
</head>
<body>
<hr />
<h1>Credit</h1>
<?php
include 'includes/inc_validateInput.php';
include 'includes/inc_validateLogin.php';
function credit($userName,$accountId,$amount) {
global $errorCount;
global $errorMessage;
global $connection;
// Select database.
if ($connection->connect_error){
echo "<div class='error'><p>Unable to connect to the database server.</p>" . "<p>Error code " . mysql_errno() . ": " . mysql_error() . "</p></div>";
$errorCount++;
} else {
$sql2 = "UPDATE creditcard SET balance=balance+'$amount' WHERE username='$userName' and creditid='$accountId'";
$result = queryMysql($sql2);
$sql2 = "INSERT INTO transaction(username, accid, transtype, toID, acctype, amount)
SELECT username, NULL, 'Credit', creditid, acctype, '$amount' FROM creditcard WHERE
creditid='$accountId'";
$result = queryMysql($sql2);
$errorMessage .= "<p>Credit completed.</p>";
}
}
function displayForm() {
?>
<h3>Enter account number and credit amount.</h3>
<?php
global $errorMessage;
echo $errorMessage ?>
<form method="POST" action="credit.php">
<p>Account Number: <input type="text" name="accountNumber" /></p>
<p>Credit Amount: <input type="amount" name="amount" /></p>
<p><input type="submit" name="Submit" value="Submit" /></p>
</form>
<br /><br />
<?php
}
$showForm = TRUE;
$errorCount = 0;
$errorMessage = "";
$accountNumber = 0;
$amount = 0;
$userName = "";
$userName = $_SESSION['login'];
echo "User Name: ".$userName."<br />";
// if submit button is clicked, get accountNumber and amount
if (isset($_POST['Submit'])) {
$accountNumber = validateInput($_POST['accountNumber'],"Account Number");
$amount = validateInput($_POST['amount'],"Credit Amount");
if ($errorCount == 0)
$showForm = FALSE;
else
$showForm = TRUE;
}
if ($showForm == TRUE) {
if ($errorCount > 0) // if there were errors
$errorMessage .= "<p>Please re-enter the form information below.</p>\n";
displayForm ();
}
else {
if ($showForm == TRUE) {
displayForm(); // new page load
}
else { // make withdraw
credit($userName,$accountNumber,$amount);
echo $errorMessage."<br />";
}
}
?>
</body>
</html>

View File

@@ -0,0 +1,108 @@
<!-- F8L Exception Online Bank | Loan Payment -->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>F8L Exception Online Bank | Credit Card Payment</title>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<?php include 'includes/inc_header.php'; ?>
</head>
<body>
<hr />
<h1>Credit Card Payment</h1>
<?php
include 'includes/inc_validateInput.php';
include 'functions.php';
function makeCreditPayment($userName, $creditId, $amount) {
global $errorCount;
global $errorMessage;
global $connection;
$newBalance = 0;
// Select database.
if ($connection->connect_error){
echo "<div class='error'><p>Unable to connect to the database server.</p>" . "<p>Error code " . mysql_errno() . ": " . mysql_error() . "</p></div>";
$errorCount++;
} else {
$sql = "UPDATE creditcard
SET balance=balance-'$amount', paymentDueDate=Now() + INTERVAL 30 DAY, paymentDate=Now()
WHERE creditid='$creditId'";
$result = queryMysql($sql);
$sql2 = "INSERT INTO transaction(username, accid, transtype, toID, acctype, amount)
SELECT username, NULL, 'Credit Card Payment', creditid, acctype, '$amount' FROM creditcard WHERE
username='$userName'";
$result = queryMysql($sql2);
// get new balance
$sql2 = "SELECT balance FROM creditcard WHERE creditid='$creditId'";
$result = queryMysql($sql2);
$row = $result->fetch_array(MYSQLI_ASSOC);
$newBalance = $row['balance'];
}
return $newBalance;
}
function displayForm() {
global $errorMessage;
echo $errorMessage;
?>
<form action="credit_payment.php" method="post">
<p>Credit Card Id: <input type="text" name="loanId" /></p>
<p>Payment Amount: <input type="text" name="amount" /></p>
<p><input type="submit" name="Submit" value="Submit" /></p>
</form>
<br /><br />
<?php
//include 'includes/inc_text_menu.php';
}
$showForm = TRUE;
$errorCount = 0;
$errorMessage = "";
$userName = "";
$userName = $_SESSION['login'];
// if not logged in, redirect to login page
if ($userName == "") {
echo "You must be logged in to make a loan payment.<br /><br />";
$showForm = FALSE;
}
else {
echo "User Name: ".$userName."<br />";
if (isset($_POST['Submit'])) {
$loanId = validateInput($_POST['loanId'],"Loan Id");
$amount = validateInput($_POST['amount'],"Payment Amount");
if($amount < 0) {
$errorMessage .= "Loan payment must be a positive number.<br />";
$errorCount++;
}
if ($errorCount == 0)
$showForm = FALSE;
else
$showForm = TRUE;
}
if ($showForm == TRUE) {
if ($errorCount > 0) // if there were errors
$errorMessage .= "<p>Please re-enter the form information below.</p>\n";
displayForm ();
}
else {
// make payment in db
$newBalance = makeCreditPayment($userName, $loanId, $amount);
echo "<p>Loan payment of $".$amount." has been received for Loan Id ".$loanId."</p>";
echo "<p>New balance is $".$newBalance."<br /><br />\n";
}
}
?>
</body>
</html>

View File

@@ -36,8 +36,8 @@ function deposit($userName,$accountId,$amount) {
$sql2 = "UPDATE account SET balance=balance+'$amount' WHERE username='$userName' and accID='$accountId'";
$result = queryMysql($sql2);
$sql2 = "INSERT INTO transaction(username, transtype, toID, acctype, amount)
SELECT username, 'Deposit', accID, acctype, '$amount' FROM account WHERE
$sql2 = "INSERT INTO transaction(username, accid, transtype, toID, acctype, amount)
SELECT username, NULL, 'Deposit', accid, acctype, '$amount' FROM account WHERE
accID='$accountId'";
$result = queryMysql($sql2);
@@ -57,9 +57,9 @@ function displayForm() {
global $errorMessage;
echo $errorMessage ?>
<form method="POST" action="deposit.php">
<p>Account Number: <input type="text" name="accountNumber" /></p>
<p>Deposit Amount: <input type="amount" name="amount" /></p>
<p><input type="submit" name="Submit" value="Submit" /></p>
<p>Account Number: <input type="text" name="accountNumber" /></p>
<p>Deposit Amount: <input type="amount" name="amount" /></p>
<p><input type="submit" name="Submit" value="Submit" /></p>
</form>
<br /><br />
@@ -79,7 +79,6 @@ echo "User Name: ".$userName."<br />";
if (isset($_POST['Submit'])) {
$accountNumber = validateInput($_POST['accountNumber'],"Account Number");
$amount = validateInput($_POST['amount'],"Deposit Amount");
if ($errorCount == 0)
$showForm = FALSE;
else

View File

@@ -1,9 +1,8 @@
<?php
include 'functions.php';
function lowBalance(){
//$result = queryMysql("SELECT username, acctype, balance from account WHERE balance <= 200");
$result = queryMysql("Call getLowBalance");
function getLowBalance($num){
$result = queryMysql("Call getLowBalance('$num')");
$num = $result->num_rows;
for ($j = 0; $j < $num; $j++){
$row = $result->fetch_array(MYSQLI_ASSOC);
@@ -11,26 +10,124 @@ function lowBalance(){
}
}
function offerCC(){
$result = queryMysql("SELECT username, balance from account WHERE balance > 10000");
function getOfferCC($num){
//$result = queryMysql("SELECT username, balance from account WHERE balance > 10000");
$result = queryMysql("Call offerCreditCard('$num')");
$num = $result->num_rows;
for ($j = 0; $j < $num; $j++){
$row = $result->fetch_array(MYSQLI_ASSOC);
echo "<tr><td>" . $row['username'] . "</td><td>$ " . number_format($row['balance'], 2, '.', ',') . "</td></tr>";
echo "<tr><td>" . $row['username'] . "</td></tr>";
}
}
function increaseCCLimit(){
//$result = queryMysql("SELECT account.username, account.balance, creditcard.maxlimit, account.acctype from account,creditcard WHERE (account.acctype = 'checking' and "
// . "account.balance > 2 * creditcard.maxlimit and account.username = creditcard.username)");
$result = queryMysql("SELECT account.username, account.balance, creditcard.maxlimit, account.acctype from account,creditcard WHERE ("
. "account.balance > 2 * creditcard.maxlimit and account.username = creditcard.username)");
function getIncreaseCCLimit($num){
$result = queryMysql("CALL increaseCCLimit('$num')");
$num = $result->num_rows;
for ($j = 0; $j < $num; $j++){
$row = $result->fetch_array(MYSQLI_ASSOC);
echo "<tr><td>" . $row['username'] . "</td><td>$ " . number_format($row['maxlimit'], 2, '.', ',') .
"</td><td>$ " . number_format($row['balance'], 2, '.', ',') . "</td><td>" . $row['acctype'] . "</td></tr>";
"</td><td>$ " . number_format($row['totalbalance'], 2, '.', ',') . "</td></tr>";
}
}
function getNumAccounts(){
echo <<<_END
<h2 class='tabletitle'>Number of Open Accounts</h2>
<table id='numaccounts'>
<tr>
<th>Account Type</th>
<th>Numer of Accounts</th>
</tr>
_END;
$sql = "select acctype, count(*) from(
select username,acctype from account
union
select username, acctype from creditcard
union
select username,acctype from loan) acl
group by acctype";
$result = queryMysql($sql);
$num = $result->num_rows;
for ($j = 0; $j < $num; $j++){
$row = $result->fetch_array(MYSQLI_ASSOC);
echo "<tr><td>" . $row['acctype'] . "</td><td>" . $row['count(*)'] ."</td></tr>";
}
}
function getLoyalCustomers(){
echo <<<_END
<h2 class='tabletitle'>Loyal Customers</h2>
<table id='loyalcustomers'>
<tr>
<th>Username</th>
</tr>
_END;
$result = queryMysql("Call loyaltyProgram(@mylist)");
$num = $result->num_rows;
for ($j = 0; $j < $num; $j++){
$row = $result->fetch_array(MYSQLI_ASSOC);
echo "<tr><td>" . $row['username'] . "</td></tr>";
}
}
function getUserAccounts(){
echo <<<_END
<h2 class='tabletitle'>User Accounts</h2>
<table id='loyalcustomers'>
<tr>
<th>Username</th>
<th>Account Type</th>
<th>Number of Credit Cards</th>
<th>Number of Loans</th>
</tr>
_END;
$sql = "SELECT a.username, a.acctype, numofcredit, numofloan
FROM account a
LEFT JOIN
(SELECT username, count(*) as numofcredit
FROM creditcard
GROUP BY username) c on a.username=c.username
LEFT JOIN
(SELECT username, count(*) as numofloan
FROM loan
GROUP BY username) l on c.username=l.username
ORDER BY a.username ASC;
";
$result = queryMysql($sql);
$num = $result->num_rows;
for ($j = 0; $j < $num; $j++){
$row = $result->fetch_array(MYSQLI_ASSOC);
echo "<tr><td>". $row['username'] . "</td>" .
"<td>" . $row['acctype'] . "</td>" .
"<td>" . $row['numofcredit'] . "</td>" .
"<td>" . $row['numofloan'] . "</td></tr>";
}
}
function getMonthlyDeposit($aDate){
date_default_timezone_set('America/Los_Angeles');
$year = date('Y', strtotime($aDate));
$month = date('F', strtotime($aDate));
echo <<<_END
<h2 class='tabletitle'>Total Deposit on $month $year</h2>
<table id='loyalcustomers'>
<tr>
<th>Username</th>
</tr>
_END;
$result = queryMysql("Call monthlyDeposit('$aDate')");
$num = $result->num_rows;
for ($j = 0; $j < $num; $j++){
$row = $result->fetch_array(MYSQLI_ASSOC);
echo "<tr><td>$ " . number_format($row['total'], 2, ".", ",") . "</td></tr>";
}
}
function archiveTransaction(){
$sql = "CALL archiveTransaction()";
$result = queryMysql($sql);
echo "<div class='message'>Transaction Table has been archive</div>";
}
?>

View File

@@ -1,4 +1,3 @@
<br />
<a href="index.php">Home</a> |
<a href="change_password.php">Change Password</a> |
<a href="logout.php">Logout</a>
@@ -7,9 +6,12 @@
<a href="deposit.php">Deposit</a> |
<a href="withdraw.php">Withdraw</a> |
<a href="transfer.php">Transfer</a> |
<a href="credit.php">Credit</a> |
<a href="view_statement.php">View Statement</a>
<br />
<a href="new_credit_card.php">New Credit Card</a> |
<a href="new_loan.php">New Loan</a> |
<a href="new_account.php">New Account</a> |
<a href="loan_payment.php">Make Loan Payment</a>
<a href="credit_payment.php">Make Credit Card Payment</a> |
<a href="loan_payment.php">Make Loan Payment</a>
<br />

View File

@@ -0,0 +1,158 @@
<?php
function login ($userName){
$sql = "CALL logUser('$userName')";
$result = queryMysql($sql);
}
function getChecking($Login){
echo "<fieldset style='margin-bottom: 50px; margin-top: 20px'>
<legend><b>Checking</b></legend>
<tr>
<table width='50%' border='1'>
<th>Date</th>
<th>Transaction Type</th>
<th>From Account</th>
<th>To Account</th>
<th>Amount</th>
</tr>
<p>
";
$sql = "SELECT * from transaction WHERE '$Login'=username and acctype='Checking'";
$result = queryMysql($sql);
$num = $result->num_rows;
for ($j = 0; $j < $num; $j++){
$row = $result->fetch_array(MYSQLI_ASSOC);
echo "<tr>
<td class='statements'>" . $row['transdate'] . "</td>" .
"<td class='statements'>" . $row['transtype'] . "</td>";
if ($row['transtype'] == "Deposit"){
echo "<td class='statements'> </td>";
} else{
echo "<td class='statements'>" . $row['accid'] . "</td>";
}
if ($row['transtype'] == "Withdraw"){
echo "<td class='statements'></td>";
}else {
echo "<td class='statements'>" . $row['toid'] . "</td>";
}
echo "<td class='statements'>$ " . number_format($row['amount'], 2, ".", ",")."</td>" .
"</tr>";
}
echo " </table>
</p>
</fieldset>
";
}
function getSavings($Login){
echo "<fieldset style='margin-bottom: 50px; margin-top: 20px'>
<legend><b>Savings</b></legend>
<tr>
<table width='50%' border='1'>
<th>Date</th>
<th>Transaction Type</th>
<th>From Account</th>
<th>To Account</th>
<th>Amount</th>
</tr>
<p>
";
$sql = "SELECT * from transaction WHERE '$Login'=username and acctype='Savings'";
$result = queryMysql($sql);
$num = $result->num_rows;
for ($j = 0; $j < $num; $j++){
$row = $result->fetch_array(MYSQLI_ASSOC);
echo "<tr>
<td class='statements'>" . $row['transdate'] . "</td>" .
"<td class='statements'>" . $row['transtype'] . "</td>";
if ($row['transtype'] == "Deposit"){
echo "<td class='statements'> </td>";
}else{
echo "<td class='statements'>" . $row['accid'] . "</td>";
}
if ($row['transtype'] == "Withdraw"){
echo "<td class='statements'></td>";
}else {
echo "<td class='statements'>" . $row['toid'] . "</td>";
}
echo "<td class='statements'>$ " . number_format($row['amount'], 2, ".", ",")."</td>" .
"</tr>";
}
echo " </table>
</p>
</fieldset>
";
}
function getCredit($Login){
echo "<fieldset style='margin-bottom: 50px; margin-top: 20px'>
<legend><b>Credit Card</b></legend>
<tr>
<table width='50%' border='1'>
<th>Date</th>
<th>Transaction Type</th>
<th>To Account</th>
<th>Amount</th>
</tr>
<p>
";
$sql = "SELECT * from transaction WHERE '$Login'=username and acctype='Credit Card'";
$result = queryMysql($sql);
$num = $result->num_rows;
for ($j = 0; $j < $num; $j++){
$row = $result->fetch_array(MYSQLI_ASSOC);
echo "<tr>
<td class='statements'>" . $row['transdate'] . "</td>" .
"<td class='statements'>" . $row['transtype'] . "</td>";
echo "<td class='statements'>" . $row['toid'] . "</td>";
echo "<td class='statements'>$ " . number_format($row['amount'], 2, ".", ",")."</td>" .
"</tr>";
}
echo " </table>
</p>
</fieldset>
";
}
function getLoan($Login){
echo "<fieldset style='margin-bottom: 50px; margin-top: 20px'>
<legend><b>Loan</b></legend>
<tr>
<table width='50%' border='1'>
<th>Date</th>
<th>Transaction Type</th>
<th>To Account</th>
<th>Amount</th>
</tr>
<p>
";
$sql = "SELECT * from transaction WHERE '$Login'=username and acctype='Loan'";
$result = queryMysql($sql);
$num = $result->num_rows;
for ($j = 0; $j < $num; $j++){
$row = $result->fetch_array(MYSQLI_ASSOC);
echo "<tr>
<td class='statements'>" . $row['transdate'] . "</td>" .
"<td class='statements'>" . $row['transtype'] . "</td>";
echo "<td class='statements'>" . $row['toid'] . "</td>";
echo "<td class='statements'>$ " . number_format($row['amount'], 2, ".", ",")."</td>" .
"</tr>";
}
echo " </table>
</p>
</fieldset>
";
}
?>

View File

@@ -1,5 +1,3 @@
<?php
session_start(); ?>
<!-- F8L Exception Online Bank | Loan Payment -->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
@@ -9,41 +7,45 @@ session_start(); ?>
<title>F8L Exception Online Bank | Loan Payment</title>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<?php include 'includes/inc_header.php'; ?>
<h1>Loan Payment</h1><hr />
</head>
<body>
<hr />
<h1>Loan Payment</h1>
<?php
include 'includes/inc_validateInput.php';
include 'functions.php';
function makeLoanPayment($userName, $loanId, $amount) {
global $errorCount;
global $errorMessage;
global $connection;
$newBalance = 0;
include 'includes/inc_dbConnect.php';
// Select database.
if ($db_connect === FALSE)
echo "<p>Unable to connect to the database server.</p>" . "<p>Error code " . mysql_errno() . ": " . mysql_error() . "</p>";
else {
if (!@mysql_select_db($db_name, $db_connect))
echo "<p>Connection error. Please try again later.</p>";
else {
$today = date("Ymd");
$dueDate = date('Y-m-d', strtotime("+30 days")); // set due date to 30 days after today
$SQLstring = "UPDATE loan
SET balance=balance-'$amount', paymentDueDate='$dueDate', paymentDate='$today'
WHERE loanId='$loanId'";
$QueryResult = @mysql_query($SQLstring, $db_connect);
// get new balance
$SQLstring2 = "SELECT balance FROM loan WHERE loanId='$loanId'";
$QueryResult2 = @mysql_query($SQLstring2, $db_connect);
$row = mysql_fetch_assoc($QueryResult2);
$newBalance = $row['balance'];
}
mysql_close($db_connect);
if ($connection->connect_error){
echo "<p>Unable to connect to the database server.</p>" . "<p>Error code " . mysql_errno() . ": " . mysql_error() . "</p>";
$errorCount++;
} else {
$sql = "UPDATE loan
SET balance=balance-'$amount', paymentDueDate=Now() + INTERVAL 30 DAY, paymentDate=Now()
WHERE loanId='$loanId'";
$result = queryMysql($sql);
$sql = "INSERT INTO transaction(username, accid, transtype, toID, acctype, amount)
SELECT username, NULL, 'Loan Payment', loanid, acctype, '$amount' FROM loan WHERE
username='$userName'";
$result = queryMysql($sql);
// get new balance
$sql2 = "SELECT balance FROM loan WHERE loanId='$loanId'";
$result = queryMysql($sql2);
$row = $result->fetch_array(MYSQLI_ASSOC);
$newBalance = $row['balance'];
if ($newBalance <= 0){
$sql2 = "DELETE FROM loan WHERE loanid='$loanId'";
$result = queryMysql($sql2);
}
}
return $newBalance;
}
@@ -100,11 +102,10 @@ else {
else {
// make payment in db
$newBalance = makeLoanPayment($userName, $loanId, $amount);
echo "<p>Loan payment for ".$amount." has been received for Loan Id ".$loanId."</p>";
echo "<p>New balance is ".$newBalance."<br /><br />\n";
echo "<p>Loan payment of $".$amount." has been received for Loan Id ".$loanId."</p>";
echo "<p>New balance is $".$newBalance."<br /><br />\n";
}
}
include 'includes/inc_text_menu.php';
?>
</body>

View File

@@ -17,6 +17,7 @@
<?php
include 'includes/inc_validateInput.php';
include 'includes/inc_validateLogin.php';
include 'includes/inc_userFunctions.php';
function displayForm() {
?>
@@ -62,6 +63,7 @@ else {
else { // login approved
$_SESSION['login'] = $userName;
//header("location:my_documents.php");
login($userName);
?><script language="JavaScript">window.location = "my_accounts.php";</script><?php
exit();
}

View File

@@ -17,20 +17,44 @@ include 'functions.php';
function showAccounts($userName) {
// Select database.
$result = queryMysql("SELECT * from account WHERE username='$userName'");
if ($result->num_rows == 0){
echo "<p>You have no accounts open.</p>";
echo "<div class='error'><p>You have no accounts open.</p></div>";
} else {
echo "<table width='50%' border='1'>";
echo "<tr>
<th>Account Type</th>
<th>Account Number</th>
<th>Balance</th>
<th>Interest Rate</th>
<th>Minimum Payment</th>
</tr>";
$num = $result->num_rows;
for ($j = 0; $j < $num; $j++){
$row = $result->fetch_array(MYSQLI_ASSOC);
echo "<tr><td>" . $row['username'] . "</td><td>" . $row['acctype'] . "</td><td>$ " . number_format($row['balance'], 2, '.', ',') . "</td></tr>";
echo "<tr><td>" . $row['acctype'] . "</td><td>" . $row['accid'] . "</td><td>$ " . number_format($row['balance'], 2, '.', ',') . "</td></tr>";
}
//Get Loan Info
$result = queryMysql("SELECT * from loan WHERE username='$userName'");
if ($result->num_rows > 0){
$num = $result->num_rows;
for ($j = 0; $j < $num; $j++){
$row = $result->fetch_array(MYSQLI_ASSOC);
echo "<tr><td>" . $row['acctype'] . "</td><td>" . $row['loanid'] . "</td><td>$ " . number_format($row['balance'], 2, '.',',') . "</td><td>$" . $row['interestrate'] . "</td></tr>";
}
}
//Get Credit Card Info
$result = queryMysql("SELECT * from creditcard WHERE username='$userName'");
if ($result->num_rows > 0){
$num = $result->num_rows;
for ($j = 0; $j < $num; $j++){
$row = $result->fetch_array(MYSQLI_ASSOC);
echo "<tr><td>" . $row['acctype'] . "</td><td>" . $row['creditid'] . "</td><td>$ " . number_format($row['balance'], 2, '.',',') . "</td><td>$" . $row['interestRate'] . "</td></tr>";
}
}
echo "</table>";
$result->close();
}
}

View File

@@ -28,27 +28,12 @@ function openNewAccount($userName,$balance,$accountType) {
$SQLstring = "INSERT INTO account (username,balance,acctype)
VALUES ('$userName','$balance','$accountType')";
$result = queryMysql($SQLstring);
$sql2 = "INSERT INTO transaction(username, transtype, toID, acctype, amount)
SELECT username, 'New Account', accID, '$accountType', '$balance' FROM account WHERE
username='$userName'";
$result = queryMysql($sql2);
}
/*
if ($db_connect === FALSE)
echo "<p>Unable to connect to the database server.</p>" . "<p>Error code " . mysql_errno() . ": " . mysql_error() . "</p>";
else {
if (!@mysql_select_db($db_name, $db_connect))
echo "<p>Connection error. Please try again later.</p>";
else {
//$today = date("Ymd");
//echo "sending insert query now.<br />";
$SQLstring = "INSERT INTO account (username,balance,acctype)
VALUES ('$userName','$balance','$accountType')";
$QueryResult = @mysql_query($SQLstring, $db_connect);
}
mysql_close($db_connect);
}
return ($retval);
*
*/
}
function displayForm() {
@@ -81,7 +66,7 @@ else {
// check if user has already opened 2-account limit
$numAccounts = getNumberOfAccounts($userName);
if ($numAccounts > 1) {
echo "You already have two accounts open. Each user is limited to two accounts.<br />";
echo "<div class='error'>You already have two accounts open. Each user is limited to two accounts.</div>";
$showForm = FALSE;
}
@@ -93,7 +78,7 @@ else {
$accountType = $_POST['accountType'];
if($balance < 0) {
$errorMessage .= "You cannot open a new account with a negative balance.<br />";
$errorMessage .= "<div class='error'>You cannot open a new account with a negative balance.</div>";
$errorCount++;
}
if ($errorCount == 0)

View File

@@ -0,0 +1,105 @@
<!-- F8L Exception Online Bank | New Credit Card -->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>F8L Exception Online Bank | New Credit Card</title>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<?php include 'includes/inc_header.php'; ?>
</head>
<body>
<hr />
<h1>New Credit Card</h1>
<?php
include 'includes/inc_validateInput.php';
include 'functions.php';
function openNewCreditCard($userName,$limit) {
global $errorCount;
global $errorMessage;
global $connection;
//include 'includes/inc_dbConnect.php';
// Select database.
if ($connection->connect_error){
echo "<div class='error'><p>Unable to connect to the database server.</p>" . "<p>Error code " . mysql_errno() . ": " . mysql_error() . "</p></div>";
$errorCount++;
} else {
$sql = "INSERT INTO creditcard (username, maxLimit, dateopened, paymentDueDate)
VALUES ('$userName', '$limit', Now(), Now() + INTERVAL 30 DAY)";
$result = queryMysql($sql);
$sql2 = "INSERT INTO transaction(username, transtype, toID, acctype, amount)
SELECT username, 'New Credit Card', creditid, acctype, '$limit' FROM creditcard WHERE
username='$userName'";
$result = queryMysql($sql2);
// get credit card account number
$sql2 = "SELECT max(creditid) as accountNumber FROM creditcard;";
$result = queryMysql($sql2);
$row = $result->fetch_array(MYSQLI_ASSOC);
$accountNumber = $row['accountNumber'];
}
return $accountNumber;
}
function displayForm() {
global $errorMessage;
echo $errorMessage;
?>
<form name="new_credit_card" action="new_credit_card.php" method="post">
<p>Limit: <input type="text" name="limit" /></p>
<p><input type="submit" name="Submit" value="Submit" /></p>
</form>
<br /><br />
<?php
//include 'includes/inc_text_menu.php';
}
$showForm = TRUE;
$errorCount = 0;
$errorMessage = "";
$userName = "";
$userName = $_SESSION['login'];
// if not logged in, redirect to login page
if ($userName == "") {
echo "You must be logged in to open a new credit card.<br /><br />";
$showForm = FALSE;
}
else {
echo "User Name: ".$userName."<br />";
if (isset($_POST['Submit'])) {
$limit = validateInput($_POST['limit'],"Limit");
if($limit < 0) {
$errorMessage .= "Limit must be a positive number.<br />";
$errorCount++;
}
if ($errorCount == 0)
$showForm = FALSE;
else
$showForm = TRUE;
}
if ($showForm == TRUE) {
if ($errorCount > 0) // if there were errors
$errorMessage .= "<p>Please re-enter the form information below.</p>\n";
displayForm ();
}
else {
// create credit card account in db
$accountNumber = openNewCreditCard($userName,$limit);
echo "<p>New credit card has been created for ".$userName." with Credit Card Account Number ".$accountNumber.".</p><br /><br />\n";
}
}
?>
</body>
</html>

View File

@@ -19,6 +19,7 @@
include 'includes/inc_validatePassword.php';
include 'includes/inc_validateUserName.php';
include 'includes/inc_validateEmail.php';
include 'functions.php';
function createNewCustomer($userName,$pw,$email) {
global $errorCount;

View File

@@ -23,29 +23,33 @@ function openNewLoan($userName,$balance) {
// Select database.
if ($connection->connect_error){
echo "<p>Unable to connect to the database server.</p>" . "<p>Error code " . mysql_errno() . ": " . mysql_error() . "</p>";
echo "<div class='error'><p>Unable to connect to the database server.</p>" . "<p>Error code " . mysql_errno() . ": " . mysql_error() . "</p></div>";
$errorCount++;
} else {
if (!@mysql_select_db($db_name, $db_connect))
echo "<p>Connection error. Please try again later.</p>";
else {
$today = date("Ymd");
$dueDate = date('Y-m-d', strtotime("+30 days")); // set due date to 30 days after today
$SQLstring = "INSERT INTO
loan (username, amount, balance, dateOpened, paymentDueDate)
VALUES ('$userName', '$balance', '$balance', '$today', '$dueDate')";
$QueryResult = @mysql_query($SQLstring, $db_connect);
$sql = "INSERT INTO loan (username, amount, balance, interestrate, dateopened, paymentDueDate)
VALUES ('$userName', '$balance', '$balance', .1050, Now(), Now() + INTERVAL 30 DAY)";
$result = queryMysql($sql);
// get loan id
$SQLstring2 = "SELECT max(loanid) as loanId FROM loan;";
$QueryResult2 = @mysql_query($SQLstring2, $db_connect);
$row = mysql_fetch_assoc($QueryResult2);
$loanId = $row['loanId'];
}
mysql_close($db_connect);
//get loan id and insert into transaction table
$sql = "SELECT max(loanid) FROM loan WHERE username='$userName'";
$result = queryMysql($sql);
$row = $result->fetch_array(MYSQLI_ASSOC);
$loanid = $row['max(loanid)'];
$sql2 = "INSERT INTO transaction(username,transtype, toID, acctype, amount)
SELECT username, 'New Loan', '$loanid', 'Loan', '$balance' FROM loan WHERE
username='$userName'";
$result = queryMysql($sql2);
/*
// get loan id
$SQLstring2 = "SELECT max(loanid) as loanId FROM loan;";
$QueryResult2 = @mysql_query($SQLstring2, $db_connect);
$row = mysql_fetch_assoc($QueryResult2);
$loanId = $row['loanId'];
*
*/
}
return $loanId;
return $loanid;
}
function displayForm() {

View File

@@ -0,0 +1,91 @@
Mostly the same as schema.php except as noted.
CREATE TABLE users (username VARCHAR(30) NOT NULL PRIMARY KEY,
password VARCHAR(30) NOT NULL,
email VARCHAR(30) NOT NULL,
loginDate DATE,
openDate DATE);
CREATE TABLE account (accID INT AUTO_INCREMENT PRIMARY KEY,
username VARCHAR(30),
acctype VARCHAR(30),
balance FLOAT,
interest FLOAT,
dateOpened TIMESTAMP,
FOREIGN KEY(username) REFERENCES Users(username)
ON DELETE CASCADE);
// can't use accId as primary key because there will be multiple transactions per accID.
// added transID field as primary key to satisfy Kim's requirement that every table have a Primary Key.
CREATE TABLE transaction (transID INT AUTO_INCREMENT PRIMARY KEY,
accID INT,
username VARCHAR(30),
acctype VARCHAR(30),
transtype VARCHAR(30),
amount FLOAT (15,2),
toID INT,
transdate TIMESTAMP,
updatedat DATE
FOREIGN KEY(username) REFERENCES users(username)
ON DELETE CASCADE);
CREATE TABLE creditcard (accID INT AUTO_INCREMENT PRIMARY KEY,
username VARCHAR(30) NOT NULL,
balance FLOAT(15,2),
minPayment FLOAT(15,2),
interestRate FLOAT(15,2),
maxLimit FLOAT(15,2),
paymentDueDate DATE,
paymentDate TIMESTAMP,
FOREIGN KEY(username) REFERENCES users(username)
ON DELETE CASCADE);
CREATE TABLE loan (accID INT AUTO_INCREMENT PRIMARY KEY,
username VARCHAR(30) NOT NULL,
amount FLOAT (15,2),
balance FLOAT (15,20),
interestRate FLOAT (15,2),
paymentDueDate DATE,
paymentDate TIMESTAMP,
FOREIGN KEY (username) REFERENCES users(username)
ON DELETE CASCADE);
CREATE TABLE transactionarchive (transID INT AUTO_INCREMENT PRIMARY KEY,
accID INT,
username VARCHAR(30),
acctype VARCHAR(30),
transtype VARCHAR(30),
amount FLOAT (15,2),
toID INT,
transdate TIMESTAMP,
FOREIGN KEY(username) REFERENCES users(username)
ON DELETE CASCADE);
CREATE TABLE log (
username varchar(30),
logindate TIMESTAMP,
FOREIGN KEY(username) REFERENCES users (username)
ON DELETE cascade);
// Users: Andy, Brad, Clint, Danny, Elvis, Fred, George, Henry, Isabel, John, Keira, Larry, Mick, Nancy, Paul, Ringo, Stan, Tom, Violet, Warren
LOAD DATA LOCAL INFILE 'D:/mywebsite/cs157a/cs157AOnlineBanking/f8l_exception/other/users.txt' INTO TABLE Users
LINES TERMINATED BY '\r\n';
LOAD DATA LOCAL INFILE 'D:/mywebsite/cs157a/cs157AOnlineBanking/f8l_exception/other/account.txt' INTO TABLE Account
LINES TERMINATED BY '\r\n';
LOAD DATA LOCAL INFILE 'D:/mywebsite/cs157a/cs157AOnlineBanking/f8l_exception/other/archive.txt' INTO TABLE Account
LINES TERMINATED BY '\r\n';
LOAD DATA LOCAL INFILE 'D:/mywebsite/cs157a/cs157AOnlineBanking/f8l_exception/other/creditcard.txt' INTO TABLE CreditCard
LINES TERMINATED BY '\r\n';
LOAD DATA LOCAL INFILE 'D:/mywebsite/cs157a/cs157AOnlineBanking/f8l_exception/other/loan.txt' INTO TABLE Loan
LINES TERMINATED BY '\r\n';
LOAD DATA LOCAL INFILE 'D:/mywebsite/cs157a/cs157AOnlineBanking/f8l_exception/other/log.txt' INTO TABLE CreditCard
LINES TERMINATED BY '\r\n';
LOAD DATA LOCAL INFILE 'D:/mywebsite/cs157a/cs157AOnlineBanking/f8l_exception/other/transaction.txt' INTO TABLE Transaction
LINES TERMINATED BY '\r\n';

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.3 KiB

View File

@@ -0,0 +1,37 @@
1 mhonrado Checking 288902.2 NULL 12/1/2014 19:41
2 Paul Savings 54133.25 0.055 12/2/2014 17:30
3 Warren Savings 872.5 NULL 8/20/2001 15:25
4 Nancy Checking 3415.18 NULL 5/25/2003 15:59
5 Brad Checking 15 NULL 2/4/2004 8:12
6 Mick Checking 805.33 NULL 2/3/2005 17:22
7 John Savings 1809.87 0.055 12/2/2014 13:38
8 Andy Checking 55.22 NULL 8/25/2006 12:15
9 Violet Checking 5000 NULL 5/17/2009 9:46
10 Paul Checking 87.66 0.055 12/2/2014 13:38
11 Mick Savings 255034.2 0.06 12/14/2009 10:22
12 Ringo Checking 183 NULL 4/20/2010 16:16
14 John Checking 1808.04 NULL 1/24/2011 20:20
15 Clint Checking 20000 NULL 4/13/2011 14:28
16 Clint Savings 25000 0.055 12/2/2014 13:38
17 Larry Checking 100000 NULL 4/18/2011 19:05
18 Keira Checking 17052.3 NULL 5/23/2011 18:28
19 Isabel Savings 18.59 NULL 8/17/2011 13:38
20 Henry Checking 605.57 0.055 12/2/2014 13:38
21 Stan Savings 2505.77 0.055 12/2/2014 13:38
22 Fred Checking 2019.31 NULL 10/3/2011 15:49
24 Elvis Checking 10057.1 NULL 3/17/2012 14:05
25 Tom Checking 186254.35 NULL 4/28/2013 15:25
26 Brad Savings 195682.2 NULL 4/29/2013 10:12
27 Warren Checking 50 NULL 7/22/2013 10:25
29 George Checking 87.34 NULL 5/22/2014 10:00
30 Stan Checking 1000 NULL 9/17/2014 11:46
31 jlee Checking 147589.22 NULL 12/2/2014 15:45
32 jlee Savings 570780 0.055 12/2/2014 17:30
103 vgarcia Checking 152.1 NULL 12/2/2014 15:57
104 pgarcia Checking 14247.57 NULL 11/30/2014 21:42
106 sstine Savings 10250 NULL 11/21/2014 15:19
107 cnguyen Checking 21119.22 NULL 11/21/2014 14:01
111 sstine Checking 34000 NULL 11/21/2014 15:21
113 myhonrado Checking 22500 NULL 11/25/2014 10:34
114 George Savings 78053.64 0.055 12/2/2014 13:39
115 vgarcia Savings 50000 NULL 12/2/2014 15:51

View File

@@ -0,0 +1,30 @@
114 George Savings 78053.64 .055 1987-04-04 10:54:26
2 Paul Savings 4133.25 .055 2000-01-01 14:48:13
3 Warren Savings 872.50 \N 2001-08-20 15:25:54
4 Nancy Checking 3415.18 \N 2003-05-25 15:59:28
5 Brad Checking 15 \N 2004-02-04 08:12:33
6 Mick Checking 805.33 \N 2005-02-03 17:22:07
7 John Savings 1809.87 .055 2005-07-14 18:20:15
8 Andy Checking 55.22 \N 2006-08-25 12:15:22
9 Violet Checking 5000 \N 2009-05-17 09:46:32
10 Paul Checking 87.66 .055 2009-08-25 12:12:13
11 Mick Savings 255034.20 .055 2009-12-14 10:22:07
12 Ringo Checking 183 \N 2010-04-20 16:16:32
13 Tom Checking 5438.62 \N 2010-05-15 15:25:03
14 John Checking 1808.04 \N 2011-01-24 20:20:15
15 Clint Checking 20000 \N 2011-04-13 14:28:57
16 Clint Savings 25000 .055 2011-04-14 14:10:38
17 Larry Checking 100000 \N 2011-04-18 19:05:14
18 Keira Checking 17052.30 \N 2011-05-23 18:28:47
19 Isabel Savings 18.59 \N 2011-08-17 13:38:16
20 Henry Checking 605.57 .055 2011-09-10 12:24:19
21 Stan Savings 2505.77 .055 2011-10-02 19:46:21
22 Fred Checking 2019.31 \N 2011-10-03 15:49:30
23 Mick Savings 87000 \N 2011-11-13 10:22:07
24 Elvis Checking 10057.10 \N 2012-03-17 14:05:18
25 Tom Checking 186254.35 \N 2013-04-28 15:25:03
26 Brad Savings 195682.20 \N 2013-04-29 10:12:33
27 Warren Checking 50.00 \N 2013-07-22 10:25:54
28 Paul Savings 7.55 \N 2014-03-20 10:12:13
29 George Checking 87.34 \N 2014-05-22 10:00:26
30 Stan Checking 1000 \N 2014-09-17 11:46:21

View File

@@ -0,0 +1,290 @@
NULL Paul Savings Deposit 50 2 12/2/2014
NULL Brad Checking Deposit 25 5 12/2/2014
11 Mick Savings Withdraw 10.5 NULL 12/2/2014
NULL Ringo Checking Deposit 17.5 12 12/2/2014
NULL Clint Checking Transfer 33.57 16 12/2/2014
NULL Larry Checking Deposit 81 17 12/2/2014
NULL Henry Checking Deposit 76 20 12/2/2014
NULL Andy Checking Deposit 20 8 12/2/2014
NULL Clint Checking Deposit 1200 15 12/2/2014
NULL Henry Checking Deposit 190 20 12/2/2014
12 Ringo Checking Withdraw 18.5 NULL 12/2/2014
NULL Larry Checking Deposit 150.45 17 12/2/2014
NULL Stan Checking Deposit 42 30 12/2/2014
NULL Tom Checking Deposit 10 13 12/2/2014
NULL Clint Checking Deposit 100 15 12/2/2014
NULL Elvis Checking Deposit 67.6 24 12/2/2014
NULL Mick Savings Deposit 18 11 12/2/2014
NULL Ringo Checking Deposit 85.19 12 12/2/2014
NULL Violet Checking Deposit 23.88 9 12/2/2014
NULL Stan Checking Deposit 405.6 30 12/2/2014
NULL Henry Checking Deposit 800 20 12/2/2014
NULL Clint Checking Deposit 596 15 12/2/2014
NULL Warren Checking Deposit 5000 27 12/2/2014
NULL Stan Checking Deposit 60.1 30 12/2/2014
9 Violet Checking Withdraw 25.5 NULL 12/2/2014
NULL Nancy Checking Deposit 93.5 4 12/2/2014
30 Stan Checking Transfer 150 21 12/2/2014
NULL Larry Checking Deposit 120 17 12/2/2014
NULL Elvis Checking Deposit 81 24 12/2/2014
NULL Andy Checking Deposit 25 8 12/2/2014
NULL Tom Checking Deposit 17.5 13 12/2/2014
NULL Nancy Checking Deposit 64.2 4 12/2/2014
NULL Ringo Checking Deposit 75.9 12 12/2/2014
NULL Stan Checking Deposit 5 30 12/2/2014
NULL Clint Checking Deposit 312 15 12/2/2014
20 Henry Checking Withdraw 185.47 NULL 12/2/2014
NULL Ringo Checking Deposit 59.1 12 12/2/2014
24 Elvis Checking Withdraw 155 NULL 12/2/2014
NULL Nancy Checking Deposit 17.5 4 12/2/2014
NULL Warren Checking Deposit 28.07 27 12/2/2014
NULL jlee Checking Deposit 215.21 31 12/2/2014
NULL jlee Savings Deposit 54362.48 32 12/2/2014
31 jlee Checking Withdraw 250 NULL 12/2/2014
32 jlee Savings Withdraw 10000 NULL 12/2/2014
NULL jlee Credit Card New Credit Card 5000 102 12/2/2014
NULL jlee Checking Deposit 200 31 12/2/2014
32 jlee Savings Withdraw 0.73 NULL 12/2/2014
32 jlee Savings Withdraw 2 NULL 12/2/2014
NULL vgarcia Savings New Account 50000 103 12/2/2014
NULL vgarcia Savings New Account 50000 115 12/2/2014
NULL vgarcia Checking Deposit 50 103 12/2/2014
NULL vgarcia Credit Card New Credit Card 5000 12 12/2/2014
NULL vgarcia Credit Card Credit 100 12 12/2/2014
NULL vgarcia Credit Card Credit Card Payment 50 12 12/2/2014
NULL vgarcia Loan New Loan 5000 13 12/2/2014
NULL vgarcia Loan Loan Payment 4500 13 12/2/2014
32 jlee Savings Transfer 50000 2 12/2/2014
32 Paul Savings Transfer 50000 2 12/2/2014
NULL Paul Savings Deposit 50 2 12/2/2014
NULL Brad Checking Deposit 25 5 12/2/2014
11 Mick Savings Withdraw 10.5 NULL 12/2/2014
NULL Ringo Checking Deposit 17.5 12 12/2/2014
NULL Clint Checking Transfer 33.57 16 12/2/2014
NULL Larry Checking Deposit 81 17 12/2/2014
NULL Henry Checking Deposit 76 20 12/2/2014
NULL Andy Checking Deposit 20 8 12/2/2014
NULL Clint Checking Deposit 1200 15 12/2/2014
NULL Henry Checking Deposit 190 20 12/2/2014
12 Ringo Checking Withdraw 18.5 NULL 12/2/2014
NULL Larry Checking Deposit 150.45 17 12/2/2014
NULL Stan Checking Deposit 42 30 12/2/2014
NULL Tom Checking Deposit 10 13 12/2/2014
NULL Clint Checking Deposit 100 15 12/2/2014
NULL Elvis Checking Deposit 67.6 24 12/2/2014
NULL Mick Savings Deposit 18 11 12/2/2014
NULL Ringo Checking Deposit 85.19 12 12/2/2014
NULL Violet Checking Deposit 23.88 9 12/2/2014
NULL Stan Checking Deposit 405.6 30 12/2/2014
NULL Henry Checking Deposit 800 20 12/2/2014
NULL Clint Checking Deposit 596 15 12/2/2014
NULL Warren Checking Deposit 5000 27 12/2/2014
NULL Stan Checking Deposit 60.1 30 12/2/2014
9 Violet Checking Withdraw 25.5 NULL 12/2/2014
NULL Nancy Checking Deposit 93.5 4 12/2/2014
30 Stan Checking Transfer 150 21 12/2/2014
NULL Larry Checking Deposit 120 17 12/2/2014
NULL Elvis Checking Deposit 81 24 12/2/2014
NULL Andy Checking Deposit 25 8 12/2/2014
NULL Tom Checking Deposit 17.5 13 12/2/2014
NULL Nancy Checking Deposit 64.2 4 12/2/2014
NULL Ringo Checking Deposit 75.9 12 12/2/2014
NULL Stan Checking Deposit 5 30 12/2/2014
NULL Clint Checking Deposit 312 15 12/2/2014
20 Henry Checking Withdraw 185.47 NULL 12/2/2014
NULL Ringo Checking Deposit 59.1 12 12/2/2014
24 Elvis Checking Withdraw 155 NULL 12/2/2014
NULL Nancy Checking Deposit 17.5 4 12/2/2014
NULL Warren Checking Deposit 28.07 27 12/2/2014
NULL jlee Checking Deposit 215.21 31 12/2/2014
NULL jlee Savings Deposit 54362.48 32 12/2/2014
31 jlee Checking Withdraw 250 NULL 12/2/2014
32 jlee Savings Withdraw 10000 NULL 12/2/2014
NULL jlee Credit Card New Credit Card 5000 102 12/2/2014
NULL jlee Checking Deposit 200 31 12/2/2014
32 jlee Savings Withdraw 0.73 NULL 12/2/2014
32 jlee Savings Withdraw 2 NULL 12/2/2014
NULL vgarcia Savings New Account 50000 103 12/2/2014
NULL vgarcia Savings New Account 50000 115 12/2/2014
NULL vgarcia Checking Deposit 50 103 12/2/2014
NULL vgarcia Credit Card New Credit Card 5000 12 12/2/2014
NULL vgarcia Credit Card Credit 100 12 12/2/2014
NULL vgarcia Credit Card Credit Card Payment 50 12 12/2/2014
NULL vgarcia Loan New Loan 5000 13 12/2/2014
NULL vgarcia Loan Loan Payment 4500 13 12/2/2014
32 jlee Savings Transfer 50000 2 12/2/2014
32 Paul Savings Transfer 50000 2 12/2/2014
NULL Paul Savings Deposit 50 2 12/2/2014
NULL Brad Checking Deposit 25 5 12/2/2014
11 Mick Savings Withdraw 10.5 NULL 12/2/2014
NULL Ringo Checking Deposit 17.5 12 12/2/2014
NULL Clint Checking Transfer 33.57 16 12/2/2014
NULL Larry Checking Deposit 81 17 12/2/2014
NULL Henry Checking Deposit 76 20 12/2/2014
NULL Andy Checking Deposit 20 8 12/2/2014
NULL Clint Checking Deposit 1200 15 12/2/2014
NULL Henry Checking Deposit 190 20 12/2/2014
12 Ringo Checking Withdraw 18.5 NULL 12/2/2014
NULL Larry Checking Deposit 150.45 17 12/2/2014
NULL Stan Checking Deposit 42 30 12/2/2014
NULL Tom Checking Deposit 10 13 12/2/2014
NULL Clint Checking Deposit 100 15 12/2/2014
NULL Elvis Checking Deposit 67.6 24 12/2/2014
NULL Mick Savings Deposit 18 11 12/2/2014
NULL Ringo Checking Deposit 85.19 12 12/2/2014
NULL Violet Checking Deposit 23.88 9 12/2/2014
NULL Stan Checking Deposit 405.6 30 12/2/2014
NULL Henry Checking Deposit 800 20 12/2/2014
NULL Clint Checking Deposit 596 15 12/2/2014
NULL Warren Checking Deposit 5000 27 12/2/2014
NULL Stan Checking Deposit 60.1 30 12/2/2014
9 Violet Checking Withdraw 25.5 NULL 12/2/2014
NULL Nancy Checking Deposit 93.5 4 12/2/2014
30 Stan Checking Transfer 150 21 12/2/2014
NULL Larry Checking Deposit 120 17 12/2/2014
NULL Elvis Checking Deposit 81 24 12/2/2014
NULL Andy Checking Deposit 25 8 12/2/2014
NULL Tom Checking Deposit 17.5 13 12/2/2014
NULL Nancy Checking Deposit 64.2 4 12/2/2014
NULL Ringo Checking Deposit 75.9 12 12/2/2014
NULL Stan Checking Deposit 5 30 12/2/2014
NULL Clint Checking Deposit 312 15 12/2/2014
20 Henry Checking Withdraw 185.47 NULL 12/2/2014
NULL Ringo Checking Deposit 59.1 12 12/2/2014
24 Elvis Checking Withdraw 155 NULL 12/2/2014
NULL Nancy Checking Deposit 17.5 4 12/2/2014
NULL Warren Checking Deposit 28.07 27 12/2/2014
NULL jlee Checking Deposit 215.21 31 12/2/2014
NULL jlee Savings Deposit 54362.48 32 12/2/2014
31 jlee Checking Withdraw 250 NULL 12/2/2014
32 jlee Savings Withdraw 10000 NULL 12/2/2014
NULL jlee Credit Card New Credit Card 5000 102 12/2/2014
NULL jlee Checking Deposit 200 31 12/2/2014
32 jlee Savings Withdraw 0.73 NULL 12/2/2014
32 jlee Savings Withdraw 2 NULL 12/2/2014
NULL vgarcia Savings New Account 50000 103 12/2/2014
NULL vgarcia Savings New Account 50000 115 12/2/2014
NULL vgarcia Checking Deposit 50 103 12/2/2014
NULL vgarcia Credit Card New Credit Card 5000 12 12/2/2014
NULL vgarcia Credit Card Credit 100 12 12/2/2014
NULL vgarcia Credit Card Credit Card Payment 50 12 12/2/2014
NULL vgarcia Loan New Loan 5000 13 12/2/2014
NULL vgarcia Loan Loan Payment 4500 13 12/2/2014
32 jlee Savings Transfer 50000 2 12/2/2014
32 Paul Savings Transfer 50000 2 12/2/2014
NULL Paul Savings Deposit 50 2 12/2/2014
NULL Brad Checking Deposit 25 5 12/2/2014
11 Mick Savings Withdraw 10.5 NULL 12/2/2014
NULL Ringo Checking Deposit 17.5 12 12/2/2014
NULL Clint Checking Transfer 33.57 16 12/2/2014
NULL Larry Checking Deposit 81 17 12/2/2014
NULL Henry Checking Deposit 76 20 12/2/2014
NULL Andy Checking Deposit 20 8 12/2/2014
NULL Clint Checking Deposit 1200 15 12/2/2014
NULL Henry Checking Deposit 190 20 12/2/2014
12 Ringo Checking Withdraw 18.5 NULL 12/2/2014
NULL Larry Checking Deposit 150.45 17 12/2/2014
NULL Stan Checking Deposit 42 30 12/2/2014
NULL Tom Checking Deposit 10 13 12/2/2014
NULL Clint Checking Deposit 100 15 12/2/2014
NULL Elvis Checking Deposit 67.6 24 12/2/2014
NULL Mick Savings Deposit 18 11 12/2/2014
NULL Ringo Checking Deposit 85.19 12 12/2/2014
NULL Violet Checking Deposit 23.88 9 12/2/2014
NULL Stan Checking Deposit 405.6 30 12/2/2014
NULL Henry Checking Deposit 800 20 12/2/2014
NULL Clint Checking Deposit 596 15 12/2/2014
NULL Warren Checking Deposit 5000 27 12/2/2014
NULL Stan Checking Deposit 60.1 30 12/2/2014
9 Violet Checking Withdraw 25.5 NULL 12/2/2014
NULL Nancy Checking Deposit 93.5 4 12/2/2014
30 Stan Checking Transfer 150 21 12/2/2014
NULL Larry Checking Deposit 120 17 12/2/2014
NULL Elvis Checking Deposit 81 24 12/2/2014
NULL Andy Checking Deposit 25 8 12/2/2014
NULL Tom Checking Deposit 17.5 13 12/2/2014
NULL Nancy Checking Deposit 64.2 4 12/2/2014
NULL Ringo Checking Deposit 75.9 12 12/2/2014
NULL Stan Checking Deposit 5 30 12/2/2014
NULL Clint Checking Deposit 312 15 12/2/2014
20 Henry Checking Withdraw 185.47 NULL 12/2/2014
NULL Ringo Checking Deposit 59.1 12 12/2/2014
24 Elvis Checking Withdraw 155 NULL 12/2/2014
NULL Nancy Checking Deposit 17.5 4 12/2/2014
NULL Warren Checking Deposit 28.07 27 12/2/2014
NULL jlee Checking Deposit 215.21 31 12/2/2014
NULL jlee Savings Deposit 54362.48 32 12/2/2014
31 jlee Checking Withdraw 250 NULL 12/2/2014
32 jlee Savings Withdraw 10000 NULL 12/2/2014
NULL jlee Credit Card New Credit Card 5000 102 12/2/2014
NULL jlee Checking Deposit 200 31 12/2/2014
32 jlee Savings Withdraw 0.73 NULL 12/2/2014
32 jlee Savings Withdraw 2 NULL 12/2/2014
NULL vgarcia Savings New Account 50000 103 12/2/2014
NULL vgarcia Savings New Account 50000 115 12/2/2014
NULL vgarcia Checking Deposit 50 103 12/2/2014
NULL vgarcia Credit Card New Credit Card 5000 12 12/2/2014
NULL vgarcia Credit Card Credit 100 12 12/2/2014
NULL vgarcia Credit Card Credit Card Payment 50 12 12/2/2014
NULL vgarcia Loan New Loan 5000 13 12/2/2014
NULL vgarcia Loan Loan Payment 4500 13 12/2/2014
32 jlee Savings Transfer 50000 2 12/2/2014
32 Paul Savings Transfer 50000 2 12/2/2014
NULL Paul Savings Deposit 50 2 12/2/2014
NULL Brad Checking Deposit 25 5 12/2/2014
11 Mick Savings Withdraw 10.5 NULL 12/2/2014
NULL Ringo Checking Deposit 17.5 12 12/2/2014
NULL Clint Checking Transfer 33.57 16 12/2/2014
NULL Larry Checking Deposit 81 17 12/2/2014
NULL Henry Checking Deposit 76 20 12/2/2014
NULL Andy Checking Deposit 20 8 12/2/2014
NULL Clint Checking Deposit 1200 15 12/2/2014
NULL Henry Checking Deposit 190 20 12/2/2014
12 Ringo Checking Withdraw 18.5 NULL 12/2/2014
NULL Larry Checking Deposit 150.45 17 12/2/2014
NULL Stan Checking Deposit 42 30 12/2/2014
NULL Tom Checking Deposit 10 13 12/2/2014
NULL Clint Checking Deposit 100 15 12/2/2014
NULL Elvis Checking Deposit 67.6 24 12/2/2014
NULL Mick Savings Deposit 18 11 12/2/2014
NULL Ringo Checking Deposit 85.19 12 12/2/2014
NULL Violet Checking Deposit 23.88 9 12/2/2014
NULL Stan Checking Deposit 405.6 30 12/2/2014
NULL Henry Checking Deposit 800 20 12/2/2014
NULL Clint Checking Deposit 596 15 12/2/2014
NULL Warren Checking Deposit 5000 27 12/2/2014
NULL Stan Checking Deposit 60.1 30 12/2/2014
9 Violet Checking Withdraw 25.5 NULL 12/2/2014
NULL Nancy Checking Deposit 93.5 4 12/2/2014
30 Stan Checking Transfer 150 21 12/2/2014
NULL Larry Checking Deposit 120 17 12/2/2014
NULL Elvis Checking Deposit 81 24 12/2/2014
NULL Andy Checking Deposit 25 8 12/2/2014
NULL Tom Checking Deposit 17.5 13 12/2/2014
NULL Nancy Checking Deposit 64.2 4 12/2/2014
NULL Ringo Checking Deposit 75.9 12 12/2/2014
NULL Stan Checking Deposit 5 30 12/2/2014
NULL Clint Checking Deposit 312 15 12/2/2014
20 Henry Checking Withdraw 185.47 NULL 12/2/2014
NULL Ringo Checking Deposit 59.1 12 12/2/2014
24 Elvis Checking Withdraw 155 NULL 12/2/2014
NULL Nancy Checking Deposit 17.5 4 12/2/2014
NULL Warren Checking Deposit 28.07 27 12/2/2014
NULL jlee Checking Deposit 215.21 31 12/2/2014
NULL jlee Savings Deposit 54362.48 32 12/2/2014
31 jlee Checking Withdraw 250 NULL 12/2/2014
32 jlee Savings Withdraw 10000 NULL 12/2/2014
NULL jlee Credit Card New Credit Card 5000 102 12/2/2014
NULL jlee Checking Deposit 200 31 12/2/2014
32 jlee Savings Withdraw 0.73 NULL 12/2/2014
32 jlee Savings Withdraw 2 NULL 12/2/2014
NULL vgarcia Savings New Account 50000 103 12/2/2014
NULL vgarcia Savings New Account 50000 115 12/2/2014
NULL vgarcia Checking Deposit 50 103 12/2/2014
NULL vgarcia Credit Card New Credit Card 5000 12 12/2/2014
NULL vgarcia Credit Card Credit 100 12 12/2/2014
NULL vgarcia Credit Card Credit Card Payment 50 12 12/2/2014
NULL vgarcia Loan New Loan 5000 13 12/2/2014
NULL vgarcia Loan Loan Payment 4500 13 12/2/2014
32 jlee Savings Transfer 50000 2 12/2/2014
32 Paul Savings Transfer 50000 2 12/2/2014

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

View File

@@ -0,0 +1,13 @@
1 Ringo 12523.17 20 0.15 15000 12/18/2014 11/18/2014 Credit Card 1/5/2011
2 Elvis 7432 20 0.15 10000 12/16/2014 11/16/2014 Credit Card 4/10/2013
3 Keira 8700.02 20 0.15 15000 12/20/2014 11/20/2014 Credit Card 11/25/2011
4 Mick 1805.33 20 0.15 15000 9/7/2014 8/7/2014 Credit Card 12/19/2005
5 Ringo 11089 20 0.15 12000 12/20/2014 11/20/2014 Credit Card 6/23/2010
6 Stan 459.3 20 0.15 15000 12/15/2014 11/15/2014 Credit Card 11/30/2012
7 George 1753.22 20 0.15 15000 12/18/2014 11/18/2014 Credit Card 11/26/1999
8 Andy 3205.16 20 0.15 8000 10/14/2014 9/14/2014 Credit Card 11/25/2006
9 Larry 650 20 0.15 25000 12/20/2014 11/20/2014 Credit Card 8/15/2008
10 Warren 1103.2 20 0.15 25000 12/20/2014 11/20/2014 Credit Card 10/25/2007
12 vgarcia 50 0 0.105 5000 1/1/2015 12/2/2014 Credit Card 12/2/2014
102 jlee 1500 0 0.105 2000 12/31/2014 12/1/2014 Credit Card 11/29/2014
103 pgarcia 10 0 0.105 10000 12/31/2014 12/1/2014 Credit Card 12/1/2014

View File

@@ -0,0 +1,10 @@
1 Ringo 12523.17 20.00 .15 15000 2014-12-18 2014-11-18 Credit Card 2011-01-05
2 Elvis 7432 20.00 .15 10000 2014-12-16 2014-11-16 Credit Card 2013-04-10
3 Keira 8700.02 20.00 .15 15000 2014-12-20 2014-11-20 Credit Card 2011-11-25
4 Mick 1805.33 20.00 .15 15000 2014-09-07 2014-08-07 Credit Card 2005-12-19
5 Ringo 11089 20.00 .15 12000 2014-12-20 2014-11-20 Credit Card 2010-06-23
6 Stan 459.30 20.00 .15 15000 2014-12-15 2014-11-15 Credit Card 2012-11-30
7 George 1753.22 20.00 .15 15000 2014-12-18 2014-11-18 Credit Card 1999-11-26
8 Andy 3205.16 20.00 .15 8000 2014-10-14 2014-09-14 Credit Card 2006-11-25
9 Larry 650 20.00 .15 25000 2014-12-20 2014-11-20 Credit Card 2008-08-15
10 Warren 1103.20 20.00 .15 25000 2014-12-20 2014-11-20 Credit Card 2007-10-25

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.5 KiB

View File

@@ -0,0 +1,11 @@
1 Ringo 50000 45000 0.07 12/18/2014 11/18/2014 9:14 10/29/2012 Loan
2 Keira 12500 4205.33 0.07 12/18/2014 11/18/2014 11:05 1/9/2011 Loan
3 Mick 19000 18753.5 0.07 12/18/2014 11/18/2014 14:04 11/15/2005 Loan
4 Elvis 4100 18.75 0.07 2/15/2014 1/15/2014 10:27 5/1/2013 Loan
5 Isabel 24555 16024.05 0.07 12/18/2014 11/18/2014 22:34 3/29/2010 Loan
6 Henry 3700 2940 0.07 9/15/2014 8/15/2014 22:34 6/29/2013 Loan
7 Clint 80 72.5 0.07 12/18/2014 11/18/2014 22:34 7/13/2014 Loan
8 Mick 100000 5702.32 0.07 12/16/2014 11/16/2014 22:34 7/29/2007 Loan
9 Ringo 10505 3750.25 0.07 11/18/2014 10/18/2014 22:34 12/1/2011 Loan
12 Elvis 4200 575.7 0.07 12/18/2014 11/18/2014 22:34 10/11/2013 Loan
13 vgarcia 5000 500 0.105 1/1/2015 12/2/2014 16:00 12/2/2014 Loan

View File

@@ -0,0 +1,11 @@
1 Ringo 50000 45000 .07 2014-12-18 2014-11-18 09:14:00 2012-10-29 Loan
2 Keira 12500 4205.33 .07 2014-12-18 2014-11-18 11:05:27 2011-01-09 Loan
3 Mick 19000 18753.50 .07 2014-12-18 2014-11-18 14:04:03 2005-11-15 Loan
4 Elvis 4100 18.75 .07 2014-02-15 2014-01-15 10:27:12 2013-05-01 Loan
5 Isabel 24555 16024.05 .07 2014-12-18 2014-11-18 22:34:27 2010-03-29 Loan
6 Henry 3700 2940 .07 2014-09-15 2014-08-15 22:34:27 2013-06-29 Loan
7 Clint 80 72.50 .07 2014-12-18 2014-11-18 22:34:27 2014-07-13 Loan
8 Mick 100000 5702.32 .07 2014-12-16 2014-11-16 22:34:27 2007-07-29 Loan
9 Ringo 10505 3750.25 .07 2014-11-18 2014-10-18 22:34:27 2011-12-01 Loan
12 Elvis 4200 575.70 .07 2014-12-18 2014-11-18 22:34:27 2013-10-11 Loan
11 jlee 250 34.00 .07 2014-12-29 2014-11-29 22:34:27 2014-11-29 Loan

BIN
f8l_exception/other/log.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

View File

@@ -0,0 +1,22 @@
jlee 11/30/2014 21:03
pgarcia 11/30/2014 21:31
jlee 11/30/2014 22:00
jlee 12/1/2014 18:58
pgarcia 12/1/2014 19:05
pgarcia 12/1/2014 19:06
mhonrado 12/1/2014 19:41
jlee 12/2/2014 13:18
Clint 12/2/2014 13:25
Warren 12/2/2014 13:46
Stan 12/2/2014 13:51
jlee 12/2/2014 15:31
vgarcia 12/2/2014 15:50
jlee 12/2/2014 15:52
vgarcia 12/2/2014 15:56
Nancy 12/2/2014 16:05
jlee 12/2/2014 17:29
Paul 12/2/2014 17:30
Ringo 12/2/2014 17:51
Paul 12/2/2014 18:07
Mick 12/2/2014 18:19
Tom 12/2/2014 18:20

View File

@@ -0,0 +1,27 @@
// See # of Checking, Savings, Credit Card, and Loan Accounts
select acctype, count(*) from(
select username,acctype from account
union
select username, acctype from creditcard
union
select username,acctype from loan) acl
group by acctype
// Stored Procedure Log
DELIMITER //
CREATE PROCEDURE logUser(IN user VARCHAR(30))
BEGIN
INSERT INTO log(username) VALUES(user);
END //
DELIMITER ;
// Stored Procedure Low Balance
DROP PROCEDURE IF EXISTS getLowBalance;
DELIMITER //
CREATE PROCEDURE getLowBalance(IN num DOUBLE)
BEGIN
SELECT username, acctype, balance
FROM account
where balance <= num;
END //
DELIMITER ;

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.2 KiB

View File

@@ -0,0 +1,58 @@
61 NULL Paul Savings Deposit 50 2 12/2/2014 21:45 12/2/2014
62 NULL Brad Checking Deposit 25 5 12/2/2014 21:45 12/2/2014
63 11 Mick Savings Withdraw 10.5 NULL 12/2/2014 21:45 12/2/2014
64 NULL Ringo Checking Deposit 17.5 12 12/2/2014 21:45 12/2/2014
65 NULL Clint Checking Transfer 33.57 16 12/2/2014 21:45 12/2/2014
66 NULL Larry Checking Deposit 81 17 12/2/2014 21:45 12/2/2014
67 NULL Henry Checking Deposit 76 20 12/2/2014 21:45 12/2/2014
68 NULL Andy Checking Deposit 20 8 12/2/2014 21:45 12/2/2014
69 NULL Clint Checking Deposit 1200 15 12/2/2014 21:45 12/2/2014
70 NULL Henry Checking Deposit 190 20 12/2/2014 21:45 12/2/2014
71 12 Ringo Checking Withdraw 18.5 NULL 12/2/2014 21:45 12/2/2014
72 NULL Larry Checking Deposit 150.45 17 12/2/2014 21:45 12/2/2014
73 NULL Stan Checking Deposit 42 30 12/2/2014 21:45 12/2/2014
74 NULL Tom Checking Deposit 10 13 12/2/2014 21:45 12/2/2014
75 NULL Clint Checking Deposit 100 15 12/2/2014 21:45 12/2/2014
76 NULL Elvis Checking Deposit 67.6 24 12/2/2014 21:45 12/2/2014
77 NULL Mick Savings Deposit 18 11 12/2/2014 21:45 12/2/2014
78 NULL Ringo Checking Deposit 85.19 12 12/2/2014 21:45 12/2/2014
79 NULL Violet Checking Deposit 23.88 9 12/2/2014 21:45 12/2/2014
80 NULL Stan Checking Deposit 405.6 30 12/2/2014 21:45 12/2/2014
81 NULL Henry Checking Deposit 800 20 12/2/2014 21:45 12/2/2014
82 NULL Clint Checking Deposit 596 15 12/2/2014 21:45 12/2/2014
83 NULL Warren Checking Deposit 5000 27 12/2/2014 21:45 12/2/2014
84 NULL Stan Checking Deposit 60.1 30 12/2/2014 21:45 12/2/2014
85 9 Violet Checking Withdraw 25.5 NULL 12/2/2014 21:45 12/2/2014
86 NULL Nancy Checking Deposit 93.5 4 12/2/2014 21:45 12/2/2014
87 30 Stan Checking Transfer 150 21 12/2/2014 21:45 12/2/2014
88 NULL Larry Checking Deposit 120 17 12/2/2014 21:45 12/2/2014
89 NULL Elvis Checking Deposit 81 24 12/2/2014 21:45 12/2/2014
90 NULL Andy Checking Deposit 25 8 12/2/2014 21:45 12/2/2014
91 NULL Tom Checking Deposit 17.5 13 12/2/2014 21:45 12/2/2014
92 NULL Nancy Checking Deposit 64.2 4 12/2/2014 21:45 12/2/2014
93 NULL Ringo Checking Deposit 75.9 12 12/2/2014 21:45 12/2/2014
94 NULL Stan Checking Deposit 5 30 12/2/2014 21:45 12/2/2014
95 NULL Clint Checking Deposit 312 15 12/2/2014 21:45 12/2/2014
96 20 Henry Checking Withdraw 185.47 NULL 12/2/2014 21:45 12/2/2014
97 NULL Ringo Checking Deposit 59.1 12 12/2/2014 21:45 12/2/2014
98 24 Elvis Checking Withdraw 155 NULL 12/2/2014 21:45 12/2/2014
99 NULL Nancy Checking Deposit 17.5 4 12/2/2014 21:45 12/2/2014
100 NULL Warren Checking Deposit 28.07 27 12/2/2014 21:45 12/2/2014
101 NULL jlee Checking Deposit 215.21 31 12/2/2014 21:45 12/2/2014
102 NULL jlee Savings Deposit 54362.48 32 12/2/2014 21:45 12/2/2014
103 31 jlee Checking Withdraw 250 NULL 12/2/2014 21:45 12/2/2014
104 32 jlee Savings Withdraw 10000 NULL 12/2/2014 21:45 12/2/2014
106 NULL jlee Credit Card New Credit Card 5000 102 12/2/2014 21:45 12/2/2014
109 NULL jlee Checking Deposit 200 31 12/2/2014 21:45 12/2/2014
110 32 jlee Savings Withdraw 0.73 NULL 12/2/2014 21:45 12/2/2014
111 32 jlee Savings Withdraw 2 NULL 12/2/2014 21:45 12/2/2014
112 NULL vgarcia Savings New Account 50000 103 12/2/2014 21:45 12/2/2014
113 NULL vgarcia Savings New Account 50000 115 12/2/2014 21:45 12/2/2014
115 NULL vgarcia Checking Deposit 50 103 12/2/2014 21:45 12/2/2014
116 NULL vgarcia Credit Card New Credit Card 5000 12 12/2/2014 21:45 12/2/2014
117 NULL vgarcia Credit Card Credit 100 12 12/2/2014 21:45 12/2/2014
118 NULL vgarcia Credit Card Credit Card Payment 50 12 12/2/2014 21:45 12/2/2014
119 NULL vgarcia Loan New Loan 5000 13 12/2/2014 21:45 12/2/2014
120 NULL vgarcia Loan Loan Payment 4500 13 12/2/2014 21:45 12/2/2014
121 32 jlee Savings Transfer 50000 2 12/2/2014 21:45 12/2/2014
122 32 Paul Savings Transfer 50000 2 12/2/2014 21:45 12/2/2014

View File

@@ -0,0 +1,40 @@
61 \N Paul Savings Deposit 50.00 2 2014-01-01 11:48:25
62 \N Brad Checking Deposit 25.00 5 2014-01-04 11:48:25
63 11 Mick Savings Withdraw 10.50 \N 2014-01-07 11:48:25
64 \N Ringo Checking Deposit 17.50 12 2014-01-09 11:48:25
65 \N Clint Checking Transfer 33.57 16 2014-01-13 11:48:25
66 \N Larry Checking Deposit 81 17 2014-01-20 11:48:25
67 \N Henry Checking Deposit 76 20 2014-01-23 11:48:25
68 \N Andy Checking Deposit 20 8 2014-01-28 11:48:25
69 \N Clint Checking Deposit 1200 15 2014-02-05 11:48:25
70 \N Henry Checking Deposit 190 20 2014-02-08 11:48:25
71 12 Ringo Checking Withdraw 18.50 \N 2014-03-01 11:48:25
72 \N Larry Checking Deposit 150.45 17 2014-02-03 11:48:25
73 \N Stan Checking Deposit 42 30 2014-03-04 11:48:25
74 \N Tom Checking Deposit 10 13 2014-03-07 11:48:25
75 \N Clint Checking Deposit 100 15 2014-03-11 11:48:25
76 \N Elvis Checking Deposit 67.60 24 2014-03-14 11:48:25
77 \N Mick Savings Deposit 18.00 11 2014-03-17 11:48:25
78 \N Ringo Checking Deposit 85.19 12 2014-03-18 11:48:25
79 \N Violet Checking Deposit 23.88 9 2014-03-19 11:48:25
80 \N Stan Checking Deposit 405.60 30 2014-03-27 11:48:25
81 \N Henry Checking Deposit 800 20 2014-04-01 11:48:25
82 \N Clint Checking Deposit 596 15 2014-04-03 11:48:25
83 \N Warren Checking Deposit 5000 27 2014-04-04 11:48:25
84 \N Stan Checking Deposit 60.10 30 2014-04-05 11:48:25
85 9 Violet Checking Withdraw 25.50 \N 2014-04-08 11:48:25
86 \N Nancy Checking Deposit 93.50 4 2014-04-12 11:48:25
87 30 Stan Checking Transfer 150.00 21 2014-04-16 11:48:25
88 \N Larry Checking Deposit 120 17 2014-05-17 11:48:25
89 \N Elvis Checking Deposit 81.00 24 2014-06-07 11:48:25
90 \N Andy Checking Deposit 25.00 8 2014-06-08 11:48:25
91 \N Tom Checking Deposit 17.50 13 2014-06-13 11:48:25
92 \N Nancy Checking Deposit 64.20 4 2014-06-15 11:48:25
93 \N Ringo Checking Deposit 75.90 12 2014-06-22 11:48:25
94 \N Stan Checking Deposit 5.00 30 2014-06-28 11:48:25
95 \N Clint Checking Deposit 312.00 15 2014-06-30 11:48:25
96 20 Henry Checking Withdraw 185.47 \N 2014-07-19 11:48:25
97 \N Ringo Checking Deposit 59.10 12 2014-08-24 11:48:25
98 24 Elvis Checking Withdraw 155.00 \N 2014-09-14 11:48:25
99 \N Nancy Checking Deposit 17.50 4 2014-09-18 11:48:25
100 \N Warren Checking Deposit 28.07 27 2014-10-16 11:48:25

View File

@@ -0,0 +1,21 @@
Andy andy andy@email.com 2006-08-25 08:15:22
Brad brad bpitt@email.com 2004-10-23 07:12:33
Clint clint ceastwood@email.com 2013-01-01 14:28:57
Danny danny danny@email.com 2012-11-15 13:36:29
Elvis elvis theking@email.com 2012-03-25 12:05:18
Fred fred fred@email.com 1999-10-17 14:49:30
George george georgeh@email.com 1987-11-26 09:54:26
Henry henry henry@email.com 2012-11-14 10:24:19
Isabel isabel isabel@email.com 2009-02-05 11:38:16
John john jlennon@email.com 2011-12-11 15:20:15
Keira keira kknightley@email.com 2010-11-25 16:28:47
Larry larry larryellison@email.com 2008-07-10 17:05:14
Mick mick mickjag@email.com 2005-09-19 14:22:07
Nancy nancy nancy@email.com 2004-08-27 11:59:28
Paul paul paulm@email.com 2000-06-23 12:48:13
Ringo ringo ringos@email.com 2010-05-23 14:16:32
Stan stan stanlee@email.com 2012-03-30 16:46:21
Tom tom tompetty@email.com 2010-09-29 12:25:03
Violet violet violet@email.com 2009-11-24 08:46:32
Warren warren warrenbuffett@email.com 2007-08-21 13:25:54
jlee test jlee@gmail.com 2014-11-16 22:31:50

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.9 KiB

View File

@@ -0,0 +1,30 @@
Andy andy andy@email.com 8/25/2006 8:15
Brad brad bpitt@email.com 10/23/2004 7:12
Clint clint ceastwood@email.com 1/1/2013 14:28
cnguyen test cnguyen@gmail.com 11/21/2014 13:34
Danny danny danny@email.com 11/15/2012 13:36
dhurng password dhurng@gmail.com 11/14/2014 20:10
Elvis elvis theking@email.com 3/25/2012 12:05
Fred fred fred@email.com 10/17/1999 14:49
George george georgeh@email.com 11/26/1987 9:54
Henry henry henry@email.com 11/14/2012 10:24
Isabel isabel isabel@email.com 2/5/2009 11:38
jjames test jjames@gmail.com 11/14/2014 20:12
jlee test jlee@gmail.com 11/16/2014 22:31
John john jlennon@email.com 12/11/2011 15:20
Keira keira kknightley@email.com 11/25/2010 16:28
Larry larry larryellison@email.com 7/10/2008 17:05
mhonrado test mhonrado@gmail.com 11/16/2001 22:32
Mick mick mickjag@email.com 9/19/2005 14:22
myhonrado Testtest1 myhonrado@gmail.com 11/25/2014 10:26
Nancy nancy nancy@email.com 8/27/2004 11:59
Paul paul paulm@email.com 6/23/2000 12:48
pgarcia test pgarcia@gmail.com 11/16/2014 18:01
rhonrado password ry1015@gmail.com 11/14/2014 19:04
Ringo ringo ringos@email.com 5/23/2010 14:16
sstine test sstine@gmail.com 11/21/2014 12:50
Stan stan stanlee@email.com 3/30/2012 16:46
Tom tom tompetty@email.com 9/29/2010 12:25
vgarcia test vgarcia@gmail.com 11/16/2014 22:32
Violet violet violet@email.com 11/24/2009 8:46
Warren warren warrenbuffett@email.com 8/21/2007 13:25

View File

@@ -1,6 +1,5 @@
body {
width : 900px;
height : 800px;
width : 1200px;
margin : 20px auto;
background: #f8f8f8;
border : 4px solid #888;
@@ -17,11 +16,47 @@ table {
width: 90%;
margin-left: auto;
margin-right: auto;
margin-bottom: 50px;
}
table, th, td{
border: 1px solid black;
}
.container div {
display: inline-block;
}
.container {
margin-bottom: 50px;
}
.tabletitle{
text-align: center;
}
}
.error, .message{
margin-bottom: 50px;
}
.message {
text-align: center;
font-weight: bold;
}
.statements {
width: 200px;
}
#loyalcustomers {
width: 40%;
text-align: center;
}
#numaccounts {
width: 50%;
text-align: center;
}
#offerCC {
width: 50%;
text-align: center;
}

View File

@@ -1,9 +1,70 @@
<?php
include 'functions.php';
$accountId = 106;
<html>
<head>
<style>
#container div{
float: left;
}
</style>
</head>
<body>
<div id="container">
<div>
<form name="lowBalanceForm" action="admin_home.php" method="post">
<fieldset>
<legend><b>Low Balance</b></legend>
<p>
<label>Enter Amount:</label>
<input type="number" name="lowBalance"/>
<input type="submit" value="View">
</p>
</fieldset>
</form>
</div>
<div>
<form name="lowBalanceForm" action="admin_home.php" method="post">
<fieldset>
<legend><b>Low Balance</b></legend>
<p>
<label>Enter Amount:</label>
<input type="number" name="lowBalance"/>
<input type="submit" value="View">
</p>
</fieldset>
</form>
</div>
<div>
<form name="lowBalanceForm" action="admin_home.php" method="post">
<fieldset>
<legend><b>Low Balance</b></legend>
<p>
<label>Enter Amount:</label>
<input type="number" name="lowBalance"/>
<input type="submit" value="View">
</p>
</fieldset>
</form>
</div>
</div>
</body>
</html>
$type = "SELECT acctype FROM account where '$accountId'=accID";
$result2 = queryMysql($type);
$row = $result2->fetch_array(MYSQLI_ASSOC);
echo $row['acctype'];
<!--
<form action="test.php" method="post">
<select name="formGender" />
<option value="">Select...</option>
<option value="M">Male</option>
<option value="F">Female</option>
</select>
<input type="submit" value="Submit" />
</form>
-->
<?php
if(isset($_POST['formGender'])){
if ($_POST['formGender'] == "")
echo "Select gender";
else
echo "Gender is " . $_POST['formGender'];
}
?>

View File

@@ -40,13 +40,13 @@ function transfer($userName,$fromAccountId,$toAccountId,$amount) {
$sql3 = "UPDATE account SET balance=balance+'$amount' WHERE accID='$toAccountId'";
$result = queryMysql($sql3);
$sql2 = "INSERT INTO transaction(username, transtype, toID, acctype, amount)
SELECT username, 'Transfer', '$toAccountId', acctype, '$amount' FROM account WHERE
$sql2 = "INSERT INTO transaction(username, accid, transtype, toID, acctype, amount)
SELECT username, '$fromAccountId','Transfer', '$toAccountId', acctype, '$amount' FROM account WHERE
accID='$fromAccountId'";
$result = queryMysql($sql2);
$sql2 = "INSERT INTO transaction(username, transtype, toID, acctype, amount)
SELECT username, 'Transfer', accid, acctype, '$amount' FROM account WHERE
$sql2 = "INSERT INTO transaction(username, accid, transtype, toID, acctype, amount)
SELECT username, '$fromAccountId','Transfer', accid, acctype, '$amount' FROM account WHERE
accID='$toAccountId'";
$result = queryMysql($sql2);

View File

@@ -11,60 +11,28 @@
</head>
<body>
<hr />
<h1>View Statement -- Under construction</h1>
<h1>View Statement</h1>
<?php
include 'functions.php';
include 'includes/inc_userFunctions.php';
function displayTable() {
global $Login;
echo "User Name: " . $Login;
echo "User Name: " . $Login ;
global $connection;
// Select database.
if ($connection->connect_error){
echo "<p>Unable to connect to the database server.</p>" . "<p>Error code " . mysql_errno() . ": " . mysql_error() . "</p>";
echo "<div class='error'><p>Unable to connect to the database server.</p>" . "<p>Error code " . mysql_errno() . ": " . mysql_error() . "</p></div>";
$errorCount++;
} else {
$TableName = "document";
$SQLstring = "SELECT * FROM $TableName WHERE login = '$Login' and active = 1";
$QueryResult = queryMysql($SQLstring);
//Checking
getChecking($Login);
getSavings($Login);
getCredit($Login);
getLoan($Login);
if ($QueryResult->num_rows == 0)
echo "<p>No data found .</p>";
else
{
echo "<table width='100%' border='1'>";
echo "<tr>
<th>Title</th>
<th>Tags</th>
<th>Revised Date</th>
<th>Note1</th>
<th>Edit</th>
<th>Remove</th>
</tr>";
while ($Row = $QueryResult->fetch_array(MYSQLI_ASSOC) !== FALSE)
{
echo "<td><a href='view_document.php?id={$Row['id']}'>{$Row['title']}</a></td>";
echo "<td>{$Row['tags']}</td>";
echo "<td>{$Row['revisedDate']}</td>";
echo "<td>{$Row['note1']}</td>";
?>
<td>
<form method="POST" action="edit_document.php">
<input type="hidden" name="id" value="<?php echo $Row['id']; ?>">
<input type="hidden" name="status" value=0>
<input type="submit" name="edit" value="Edit" />
</form>
</td>
<td>
<form method="POST" action="change_document_status.php">
<input type="hidden" name="id" value="<?php echo $Row['id']; ?>">
<input type="hidden" name="status" value=0>
<input type="submit" name="remove" value="Remove" />
</form>
</td></tr><?php
}
echo "</table><br /><br />";
}
}
}
$Login = "";

View File

@@ -34,10 +34,9 @@ function Withdraw($userName,$accountId,$amount) {
$sql2 = "UPDATE account SET balance=balance-'$amount' WHERE username='$userName' and accID='$accountId'";
$result = queryMysql($sql2);
$sql2 = "INSERT INTO transaction(username, transtype, toID, acctype, amount)
SELECT username, 'Withdraw', accID, acctype, '$amount' FROM account WHERE
$sql2 = "INSERT INTO transaction(username, accid, transtype, toID, acctype, amount)
SELECT username, accid, 'Withdraw', NULL, acctype, '$amount' FROM account WHERE
accID='$accountId'";
$result = queryMysql($sql2);
$errorMessage .= "<p>Withdraw completed.</p>";