|
|
|
@ -35,7 +35,7 @@ new_account() {
|
|
|
|
|
|
|
|
|
|
# If user selects yes. Insert their username and a timestamp into the database.
|
|
|
|
|
[Yy] ) echo ""
|
|
|
|
|
$db_conn "insert into account (username,timestamp) values ('$user1','now');"
|
|
|
|
|
$db_conn "insert into account (username,timestamp,active) values ('$user1','now','t');"
|
|
|
|
|
|
|
|
|
|
# Sets the user's id as the variable.
|
|
|
|
|
user1_id=$($db_conn "select id from account where username='$user1';" | awk 'FNR == 3 {print}')
|
|
|
|
@ -63,7 +63,7 @@ new_account() {
|
|
|
|
|
|
|
|
|
|
list_user() {
|
|
|
|
|
echo ""
|
|
|
|
|
$db_conn "select * from account;"
|
|
|
|
|
$db_conn "select id,username,timestamp from account where active ='t';"
|
|
|
|
|
echo ""
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -84,11 +84,11 @@ list_balance() {
|
|
|
|
|
|
|
|
|
|
case $ii in
|
|
|
|
|
1 ) clear
|
|
|
|
|
$db_conn "select id,username,balance from account join balance using (id);" ;;
|
|
|
|
|
$db_conn "select id,username,balance from account join balance using (id) where active = 't';" ;;
|
|
|
|
|
2 ) read -p "Enter the user account name: " ex_mat
|
|
|
|
|
$db_conn "select id,username,balance from account join balance using (id) where username='$ex_mat';" ;;
|
|
|
|
|
$db_conn "select id,username,balance from account join balance using (id) where username='$ex_mat' and active = 't';" ;;
|
|
|
|
|
3 ) read -p "Enter search term: " bal_user
|
|
|
|
|
bal_user1=$($db_conn "select id,username,balance from account join balance using (id);")
|
|
|
|
|
bal_user1=$($db_conn "select id,username,balance from account join balance using (id) where active = 't';")
|
|
|
|
|
echo "$bal_user1" | awk 'FNR == 1 {print}'
|
|
|
|
|
echo "$bal_user1" | grep -iE "$bal_user"
|
|
|
|
|
echo "" ;;
|
|
|
|
@ -195,6 +195,21 @@ do
|
|
|
|
|
done
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
dis_user() {
|
|
|
|
|
clear
|
|
|
|
|
echo "Warning!!! Users cannot be re-enabled."
|
|
|
|
|
read -p "**Disable User: " dis_user
|
|
|
|
|
echo""
|
|
|
|
|
echo""
|
|
|
|
|
echo "Verify the following information is correct."
|
|
|
|
|
$db_conn "select id,username from account where username = '$dis_user';"
|
|
|
|
|
read -n1 -p "Disable User (y/N) " i_dis
|
|
|
|
|
case $i_dis in
|
|
|
|
|
[Yy] ) $db_conn "update account set active = 'f' where username = '$dis_user';" ; echo "" ;;
|
|
|
|
|
* ) echo "Aborted"
|
|
|
|
|
echo "" ;;
|
|
|
|
|
esac
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
clear
|
|
|
|
|
while true
|
|
|
|
@ -208,6 +223,7 @@ do
|
|
|
|
|
echo "4) Banking Menu (Deposit, withdraw, transfer)"
|
|
|
|
|
echo "5) Transaction Menu"
|
|
|
|
|
echo ""
|
|
|
|
|
echo "8) *Disable User!"
|
|
|
|
|
echo "9) Clear contents of screen"
|
|
|
|
|
echo "0) Exit"
|
|
|
|
|
echo ""
|
|
|
|
@ -218,6 +234,7 @@ do
|
|
|
|
|
3 ) list_balance ;;
|
|
|
|
|
4 ) bank_menu ;;
|
|
|
|
|
5 ) tran_menu ;;
|
|
|
|
|
8 ) dis_user ;;
|
|
|
|
|
9 ) clear ;;
|
|
|
|
|
0 ) break ;;
|
|
|
|
|
* ) clear ;;
|
|
|
|
|