├── Final_Document.pdf ├── README.md ├── balance.php ├── deposit.php ├── index.css ├── index.php ├── option.php ├── receipt.php ├── style.css ├── transfer.php └── withdraw.php /Final_Document.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deadshot-21/ATM-Database-Management-System/7f9e4f9bd1c409de329fdcb99ba91b0903e86523/Final_Document.pdf -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ATM-Database-Management-System 2 | This project is basically creating a database management system for the transaction that are 3 | being taken place in the ATM of any bank. Aim of the project is to creating a backend 4 | program of the processes taking place using SQL. This model deals with the relationship 5 | between the customer, ATM machine & Bank. The other entities play a supportive weak 6 | role. So basically this helps the banks to debit or credit the amount of the customer from his 7 | respective account and also keep the record of his/her transaction made. 8 | -------------------------------------------------------------------------------- /balance.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Balance Enquiry 5 | 6 | 7 | 8 | 9 | connect_errno) { 17 | echo "Failed to connect to MySQL: (" . $mysqli->connect_errno . ") " . $mysqli->connect_error; 18 | } 19 | $cvv=(int) $_GET['cvv']; 20 | $sql = "SELECT CARD_BALANCE FROM card WHERE CARD_CVV='$cvv'"; 21 | mysqli_query($mysqli,$sql); 22 | $result = $mysqli->query($sql); 23 | $x=mysqli_fetch_assoc($result); 24 | $y=$x['CARD_BALANCE']; 25 | 26 | ?> 27 |
28 |

Your Current Balance is:

29 |
30 |

Rs:


31 |
32 | 33 |
34 |
35 | query($sql5); 43 | $s=mysqli_fetch_assoc($result5); 44 | $v=$s['CARD_NO']; 45 | $sql6="INSERT INTO temp(TRANSACTION_ID,CARD_NO,AMOUNT) VALUES ('','$v','0')"; 46 | mysqli_query($mysqli,$sql6); 47 | $url = "receipt.php?card_no=" . $v; 48 | header('Location: ' . $url); 49 | exit(); 50 | } 51 | ?> 52 | 53 | -------------------------------------------------------------------------------- /deposit.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Deposit 5 | 6 | 7 | 8 | 9 |
10 |
11 |

Enter Amount To Deposit:



12 |
13 | 14 |

15 | 16 | 17 |
18 |
19 |
20 | connect_errno) { 28 | echo "Failed to connect to MySQL: (" . $mysqli->connect_errno . ") " . $mysqli->connect_error; 29 | } 30 | if(isset($_POST['cancel'])) 31 | { 32 | header('Location: index.php'); 33 | } 34 | 35 | if(isset($_POST['submit'])) 36 | { 37 | $cvv=(int) $_GET['cvv']; 38 | $amt=$_POST['deposit']; 39 | $sql="SELECT CARD_BALANCE FROM card WHERE CARD_CVV = '$cvv'"; 40 | mysqli_query($mysqli,$sql); 41 | $result = $mysqli->query($sql); 42 | $x=mysqli_fetch_assoc($result); 43 | $z=$x["CARD_BALANCE"]; 44 | $y=$z+$amt; 45 | $sql1="UPDATE card SET CARD_BALANCE = '$y' WHERE CARD_CVV = '$cvv'"; 46 | mysqli_query($mysqli,$sql1); 47 | $sql2="INSERT INTO transaction(TRANSACTION_ID,TRANSACTION_NAME,TRANSACTION_STATUS,TRANSACTION_TYPE) VALUES ('','deposited','COMPLETED','DEPOSIT')"; 48 | mysqli_query($mysqli,$sql2); 49 | $sql3="SELECT CARD_NO FROM card WHERE CARD_CVV='$cvv'"; 50 | mysqli_query($mysqli,$sql3); 51 | $result3=$mysqli->query($sql3); 52 | $s=mysqli_fetch_assoc($result3); 53 | $v=$s['CARD_NO']; 54 | $sql4="INSERT INTO temp(TRANSACTION_ID,CARD_NO,AMOUNT) VALUES ('','$v','$amt')"; 55 | mysqli_query($mysqli,$sql4); 56 | $url = "receipt.php?card_no=" . $v; 57 | header('Location: ' . $url); 58 | exit(); 59 | $mysqli->close(); 60 | 61 | } 62 | ?> 63 | 64 | -------------------------------------------------------------------------------- /index.css: -------------------------------------------------------------------------------- 1 | .x{ 2 | background-color: #e9ecef; 3 | } 4 | -------------------------------------------------------------------------------- /index.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Welcome to Indian Bank 5 | 6 | 7 | 8 | 9 | 10 |
11 |

Welcome To Indian Bank

12 |
13 |
14 |
15 |
16 |
17 |

18 | 19 |

25 | 26 |
27 |
28 | 29 | connect_errno) { 37 | echo "Failed to connect to MySQL: (" . $mysqli->connect_errno . ") " . $mysqli->connect_error; 38 | } 39 | 40 | if(isset($_POST['submit'])) 41 | { 42 | $card_no=$_POST['atm_no']; 43 | $cvv=$_POST['cvv']; 44 | $sql="SELECT CARD_CVV FROM card WHERE CARD_NO='$card_no'"; 45 | mysqli_query($mysqli,$sql); 46 | $result = $mysqli->query($sql); 47 | if($result = $cvv) 48 | { 49 | 50 | header("Location: option.php"); 51 | } 52 | } 53 | if(isset($_POST['cvv'])) 54 | { 55 | $cvv=$_POST['cvv']; 56 | $url = "option.php?cvv=" . $cvv; 57 | header('Location: ' . $url); 58 | exit(); 59 | } 60 | $mysqli->close(); 61 | ?> 62 | 63 | 64 | -------------------------------------------------------------------------------- /option.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | ATM DATABASE MANAGEMENT SYSTEM 5 | 6 | 7 | 8 | 9 |
10 |

Please Choose Your Task!

11 |
12 |
13 |

14 |
15 |
16 |

17 |
18 |
19 |

20 |
21 |
22 | 23 |
24 |
25 | 52 | 53 | -------------------------------------------------------------------------------- /receipt.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Receipt 5 | 6 | 7 | 8 | 9 | connect_errno) { 17 | echo "Failed to connect to MySQL: (" . $mysqli->connect_errno . ") " . $mysqli->connect_error; 18 | } 19 | $v=(int) $_GET['card_no']; 20 | //$sql9="SELECT CARD_NO FROM card WHERE CARD_CVV='$cvv'"; 21 | //mysqli_query($mysqli,$sql9); 22 | //$result9 = $mysqli->query($sql9); 23 | //$b=mysqli_fetch_assoc($result9); 24 | //$v=$b['CARD_NO']; 25 | $sql="SELECT TRANSACTION_ID,AMOUNT FROM temp WHERE CARD_NO='$v' ORDER BY TRANSACTION_ID DESC"; 26 | mysqli_query($mysqli,$sql); 27 | $result = $mysqli->query($sql); 28 | $x=mysqli_fetch_assoc($result); 29 | $y=$x['TRANSACTION_ID']; 30 | $amt=$x['AMOUNT']; 31 | $sql1="SELECT TRANSACTION_NAME,TRANSACTION_TYPE,TRANSACTION_STATUS FROM transaction WHERE TRANSACTION_ID='$y'"; 32 | mysqli_query($mysqli,$sql1); 33 | $result1 = $mysqli->query($sql1); 34 | $z=mysqli_fetch_assoc($result1); 35 | $n=$z['TRANSACTION_NAME']; 36 | $w=$z['TRANSACTION_TYPE']; 37 | $t=$z['TRANSACTION_STATUS']; 38 | $sql2="SELECT CARD_BALANCE FROM card WHERE CARD_NO='$v'"; 39 | mysqli_query($mysqli,$sql2); 40 | $result2 = $mysqli->query($sql2); 41 | $ava=mysqli_fetch_assoc($result2); 42 | $avail=$ava['CARD_BALANCE']; 43 | $vs=(string)$v; 44 | 45 | ?> 46 |
47 |

Indian Bank

48 |
49 |

Card No: ************

50 |

Transaction Id:

51 |

Transaction type:

52 |

Transaction status:

53 |

Amount

54 |

Availabe Amount:

55 |
56 | 57 |
58 |
59 | 65 | 66 | -------------------------------------------------------------------------------- /style.css: -------------------------------------------------------------------------------- 1 | body,html { 2 | margin:0px; 3 | padding: 0px; 4 | background: #2D649C url('images/background.jpg') repeat-x fixed top; 5 | } 6 | #container{ 7 | width: 920px; 8 | left: 50%; 9 | margin-left:-460px; 10 | position:relative; 11 | margin-top: 20px; 12 | } 13 | 14 | #header{ 15 | margin-left:9px; 16 | } 17 | 18 | #menu{ 19 | display:block; 20 | height: 38px; 21 | margin:0px; 22 | padding:0px; 23 | } 24 | #menu li{ 25 | margin:0px; 26 | padding:0px; 27 | display:block; 28 | float:right; 29 | height:38px; 30 | margin-left:1px; 31 | } 32 | 33 | #menua{ 34 | display:block; 35 | float:left; 36 | height:12px; 37 | font-size:12px; 38 | padding:13px; 39 | margin:0px; 40 | text-decoration:none; 41 | color:white; 42 | background:#264C71 url('images/menu.jpg') repeat-x; 43 | } 44 | 45 | #menuhover{ 46 | display:block; 47 | float:left; 48 | height:12px; 49 | font-size:12px; 50 | padding:13px; 51 | margin:0px; 52 | text-decoration:none; 53 | color:#012C57; 54 | background:#264C71 url('images/menuhover.jpg') repeat-x; 55 | } 56 | 57 | 58 | #menua:hover{ 59 | color:lightgrey; 60 | } 61 | 62 | #menuleft{ 63 | float:left; 64 | background:#264C71 url('images/menuleft.jpg') repeat-x; 65 | height:38px; 66 | width:2px; 67 | } 68 | 69 | #menulefthover{ 70 | float:left; 71 | background:#264C71 url('images/menulefthover.jpg') repeat-x; 72 | height:38px; 73 | width:2px; 74 | } 75 | 76 | #menuright{ 77 | float:left; 78 | background:#264C71 url('images/menuright.jpg') repeat-x; 79 | height:38px; 80 | width:2px; 81 | } 82 | #menurighthover{ 83 | float:left; 84 | background:#264C71 url('images/menurighthover.jpg') repeat-x; 85 | height:38px; 86 | width:2px; 87 | } 88 | 89 | #content{ 90 | background: #D2EFFF url('images/content.jpg') repeat-x; 91 | width:828px; 92 | padding:46px; 93 | padding-top:44px; 94 | } 95 | #content h1{ 96 | margin:0px; 97 | padding:0px; 98 | color: #37404C; 99 | } 100 | #content p, ul{ 101 | color:#6B6B6B; 102 | font-size:13px; 103 | } 104 | 105 | #topcontent{ 106 | background: #D2EFFF url('images/topcontent.jpg') repeat-x; 107 | width:920px; 108 | height:2px; 109 | } 110 | #botcontent{ 111 | background: #D2EFFF url('images/contentbot.jpg') repeat-x; 112 | width:920px; 113 | height:2px; 114 | } 115 | #footer{ 116 | margin-top:5px; 117 | color:#81ACCE; 118 | width:920px; 119 | height:15px; 120 | text-align:center; 121 | font-size:14px; 122 | } 123 | #contentleft{ 124 | width:570px; 125 | float:left; 126 | } 127 | #banner{ 128 | display:block; 129 | height:602px; 130 | width:162px; 131 | background: url('images/banner.jpg'); 132 | float:right; 133 | } 134 | 135 | 136 | 137 | /* PHP info styling */ 138 | pre {margin: 0px; font-family: monospace;} 139 | a:link {color: #000099; text-decoration: none; background-color: #ffffff;} 140 | a:hover {text-decoration: underline;} 141 | table {border-collapse: collapse;} 142 | .center {text-align: center;} 143 | .center table { margin-left: auto; margin-right: auto; text-align: left;} 144 | .center th { text-align: center !important; } 145 | td, th { border: 1px solid #000000; font-size: 75%; vertical-align: baseline;} 146 | h1 {font-size: 150%; color:white;} 147 | h2 {font-size: 125%;} 148 | .p {text-align: left; display:none} 149 | .e { font-weight: bold; color: #000000;} 150 | .h {font-weight: bold; color: white;} 151 | .v {word-break:break-all; color: #000000;} 152 | .vr {background-color: #cccccc; text-align: right; color: #000000;} 153 | .h img{ display:none;} 154 | .h { background-color: #2D649C; color:white; } 155 | hr {width: 600px; background-color: #cccccc; border: 0px; height: 1px; color: #000000;} 156 | 157 | -------------------------------------------------------------------------------- /transfer.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Transfer 5 | 6 | 7 | 8 | 9 |
10 |
11 |

Enter Details:



12 |
13 | 14 |

15 | 16 |

17 | 18 | 19 |
20 |
21 |
22 | connect_errno) { 30 | echo "Failed to connect to MySQL: (" . $mysqli->connect_errno . ") " . $mysqli->connect_error; 31 | } 32 | if(isset($_POST['cancel'])) 33 | { 34 | header('Location: index.php'); 35 | } 36 | 37 | if(isset($_POST['submit'])) 38 | { 39 | $cvv=(int) $_GET['cvv']; 40 | $amt=$_POST['transfer']; 41 | $acct=$_POST['acct']; 42 | $sql="SELECT CARD_BALANCE FROM card WHERE CARD_CVV = '$cvv'"; 43 | mysqli_query($mysqli,$sql); 44 | $result = $mysqli->query($sql); 45 | $x=mysqli_fetch_assoc($result); 46 | $sql1="SELECT CARD_BALANCE FROM card WHERE CARD_NO = '$acct'"; 47 | $z=$x["CARD_BALANCE"]; 48 | mysqli_query($mysqli,$sql1); 49 | $result1 = $mysqli->query($sql1); 50 | $b=mysqli_fetch_assoc($result1); 51 | $c=$b["CARD_BALANCE"]; 52 | if($z>$amt) 53 | { 54 | $y=$c+$amt; 55 | $a=$z-$amt; 56 | $sql2="UPDATE card SET CARD_BALANCE = '$a' WHERE CARD_CVV = '$cvv'"; 57 | mysqli_query($mysqli,$sql2); 58 | $sql3="UPDATE card SET CARD_BALANCE = '$y' WHERE CARD_NO = '$acct'"; 59 | mysqli_query($mysqli,$sql3); 60 | $sql4="INSERT INTO transaction(TRANSACTION_ID,TRANSACTION_NAME,TRANSACTION_STATUS,TRANSACTION_TYPE) VALUES ('','transfer','COMPLETED','TRANSFER')"; 61 | mysqli_query($mysqli,$sql4); 62 | $sql5="SELECT CARD_NO FROM card WHERE CARD_CVV='$cvv'"; 63 | mysqli_query($mysqli,$sql5); 64 | $result5=$mysqli->query($sql5); 65 | $s=mysqli_fetch_assoc($result5); 66 | $v=$s['CARD_NO']; 67 | $sql6="INSERT INTO temp(TRANSACTION_ID,CARD_NO,AMOUNT) VALUES ('','$v','$amt')"; 68 | mysqli_query($mysqli,$sql6); 69 | $url = "receipt.php?card_no=" . $v; 70 | header('Location: ' . $url); 71 | exit(); 72 | } 73 | 74 | } 75 | $mysqli->close(); 76 | ?> 77 | 78 | -------------------------------------------------------------------------------- /withdraw.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Withdraw 5 | 6 | 7 | 8 | 9 |
10 |
11 |

Enter Amount To Withdraw:



12 |
13 | 14 |

15 | 16 | 17 |
18 |
19 |
20 | connect_errno) { 28 | echo "Failed to connect to MySQL: (" . $mysqli->connect_errno . ") " . $mysqli->connect_error; 29 | } 30 | if(isset($_POST['cancel'])) 31 | { 32 | header('Location: index.php'); 33 | } 34 | 35 | if(isset($_POST['submit'])) 36 | { 37 | $cvv=(int) $_GET['cvv']; 38 | $amt=$_POST['withdraw']; 39 | $sql="SELECT CARD_BALANCE FROM card WHERE CARD_CVV = '$cvv'"; 40 | mysqli_query($mysqli,$sql); 41 | $result = $mysqli->query($sql); 42 | $x=mysqli_fetch_assoc($result); 43 | $z=$x["CARD_BALANCE"]; 44 | if($z>$amt){ 45 | $y=$z-$amt; 46 | $sql1="UPDATE card SET CARD_BALANCE = '$y' WHERE CARD_CVV = '$cvv'"; 47 | mysqli_query($mysqli,$sql1); 48 | $sql2="INSERT INTO transaction(TRANSACTION_ID,TRANSACTION_NAME,TRANSACTION_STATUS,TRANSACTION_TYPE) VALUES ('','withdrawn','COMPLETED','WITHDRAW')"; 49 | mysqli_query($mysqli,$sql2); 50 | $sql3="SELECT CARD_NO FROM card WHERE CARD_CVV='$cvv'"; 51 | mysqli_query($mysqli,$sql3); 52 | $result3=$mysqli->query($sql3); 53 | $s=mysqli_fetch_assoc($result3); 54 | $v=$s['CARD_NO']; 55 | $sql4="INSERT INTO temp(TRANSACTION_ID,CARD_NO,AMOUNT) VALUES ('','$v','$amt')"; 56 | mysqli_query($mysqli,$sql4); 57 | $url = "receipt.php?card_no=" . $v; 58 | header('Location: ' . $url); 59 | exit(); 60 | 61 | } 62 | 63 | } 64 | $mysqli->close(); 65 | ?> 66 | 67 | --------------------------------------------------------------------------------