-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdashboard.php
More file actions
341 lines (295 loc) · 10.6 KB
/
dashboard.php
File metadata and controls
341 lines (295 loc) · 10.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
<?php
include 'db.php'; // Include database connection
// Check if account number is passed in URL
if (!isset($_GET['account_number'])) {
die("Error: No account number found.");
}
$accountNumber = $_GET['account_number'];
// Get user details from the database
$stmt = $conn->prepare("SELECT holder_name, email, phone, balance FROM users WHERE account_number = ?");
$stmt->bind_param("i", $accountNumber);
$stmt->execute();
$stmt->bind_result($holderName, $email, $phone, $balance);
$stmt->fetch();
$stmt->close();
if (!$holderName) {
die("Error: User not found.");
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Bank Dashboard</title>
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;600&display=swap" rel="stylesheet">
<style>
/* Global Reset */
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
/* Body Styling */
body {
font-family: 'Poppins', sans-serif;
background: linear-gradient(135deg, #0f0c29, #302b63, #24243e);
color: #fff;
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
padding: 20px;
}
/* Top Banner */
.top-banner {
width: 100%;
background: #667eea;
color: #fff;
text-align: center;
padding: 10px 0;
font-size: 18px;
font-weight: bold;
position: fixed;
top: 0;
left: 0;
z-index: 1000;
}
/* Bottom Banner */
.bottom-banner {
width: 100%;
background: #667eea;
color: #fff;
text-align: center;
padding: 10px 0;
font-size: 14px;
position: fixed;
bottom: 0;
left: 0;
}
/* Container */
.container {
width: 90%;
max-width: 1200px;
background: rgba(255, 255, 255, 0.1);
padding: 30px;
border-radius: 20px;
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
backdrop-filter: blur(15px);
border: 1px solid rgba(255, 255, 255, 0.2);
animation: fadeIn 1s ease-in-out;
margin-top: 60px; /* Adjust to make space for top banner */
margin-bottom: 60px; /* Adjust to make space for bottom banner */
}
/* Header */
h2 {
color: #fff;
font-size: 32px;
margin-bottom: 20px;
text-align: center;
text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}
/* Account Info */
.account-info {
background: rgba(0, 0, 0, 0.3);
padding: 20px;
border-radius: 15px;
margin-bottom: 20px;
box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}
.account-info h3 {
font-size: 24px;
margin-bottom: 15px;
color: #00ffcc;
text-shadow: 0 0 10px rgba(0, 255, 204, 0.5);
}
.account-info p {
font-size: 18px;
margin: 10px 0;
color: #ddd;
}
/* Quick Actions */
.actions {
margin-bottom: 20px;
}
.actions h3 {
font-size: 24px;
margin-bottom: 15px;
color: #00ffcc;
text-shadow: 0 0 10px rgba(0, 255, 204, 0.5);
}
.btn {
display: inline-block;
padding: 12px 24px;
margin: 5px;
background: linear-gradient(135deg, #00ffcc, #00b3a7);
color: #000;
text-decoration: none;
border-radius: 8px;
font-size: 16px;
font-weight: 600;
transition: transform 0.3s ease, box-shadow 0.3s ease;
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
}
.btn:hover {
transform: translateY(-3px);
box-shadow: 0 6px 12px rgba(0, 255, 204, 0.4);
}
.btn:active {
transform: translateY(0);
}
/* Transactions Table */
.transactions {
margin-bottom: 20px;
}
.transactions h3 {
font-size: 24px;
margin-bottom: 15px;
color: #00ffcc;
text-shadow: 0 0 10px rgba(0, 255, 204, 0.5);
}
table {
width: 100%;
border-collapse: collapse;
background: rgba(0, 0, 0, 0.3);
border-radius: 15px;
overflow: hidden;
box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}
th, td {
padding: 12px;
text-align: left;
}
th {
background: linear-gradient(135deg, #667eea, #00b3a7);
color: #000;
font-weight: 600;
}
td {
color: #ddd;
}
tr:nth-child(even) {
background: rgba(255, 255, 255, 0.05);
}
tr:hover {
background: rgba(255, 255, 255, 0.1);
}
/* Settings */
.settings {
text-align: center;
margin-top: 20px;
}
.settings .btn {
background: linear-gradient(135deg, #ff4b5c, #d32f2f);
}
.settings .btn:hover {
background: linear-gradient(135deg, #d32f2f, #ff4b5c);
}
/* Animations */
@keyframes fadeIn {
from {
opacity: 0;
transform: translateY(20px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
</style>
</head>
<body>
<!-- Top Banner -->
<div class="top-banner">
Welcome to Fintion Banking!
</div>
<div class="container">
<h2>Welcome, <?php echo htmlspecialchars($holderName); ?>!</h2>
<!-- Account Info -->
<div class="account-info">
<h3>Account Summary</h3>
<p><strong>Account Number:</strong> **** <?php echo substr($accountNumber, -4); ?></p>
<p><strong>Balance:</strong> $<?php echo number_format($balance, 2); ?></p>
</div>
<!-- Quick Actions -->
<div class="actions">
<h3>Quick Actions</h3>
<a href="deposit.php?account_number=<?php echo $accountNumber; ?>" class="btn">Deposit Money</a>
<a href="withdraw.html?account_number=<?php echo $accountNumber; ?>" class="btn">Withdraw Money</a>
<a href="transfer.html?account_number=<?php echo $accountNumber; ?>" class="btn">Transfer Money</a>
<a href="transaction_history.php?account_number=<?php echo $accountNumber; ?>" class="btn">View Transactions</a>
</div>
<!-- Transactions -->
<div class="transactions">
<h3>Recent Transactions</h3>
<table>
<tr>
<th>Date</th>
<th>Description</th>
<th>Amount</th>
</tr>
<?php
// Prepare SQL statement to include sender_account and recipient_account
$stmt = $conn->prepare("
SELECT transaction_date, transaction_type, amount, sender_account, recipient_account
FROM transactions
WHERE sender_account = ? OR recipient_account = ?
ORDER BY transaction_date DESC
LIMIT 10
");
// Bind the account number to both sender_account and recipient_account
$stmt->bind_param("ii", $accountNumber, $accountNumber);
// Execute query
$stmt->execute();
$result = $stmt->get_result();
// Check if transactions exist
if ($result->num_rows > 0) {
// Loop through each transaction
while ($row = $result->fetch_assoc()) {
// Initialize the amount display
$amountDisplay = "";
$description = htmlspecialchars($row['transaction_type']); // Default transaction type
// Handle deposits and withdrawals
if ($row['sender_account'] == $accountNumber && $row['transaction_type'] == 'withdrawal') {
$amountDisplay = "<span style='color:red;'>-$$" . number_format($row['amount'], 2) . "</span>";
}
elseif ($row['recipient_account'] == $accountNumber && $row['transaction_type'] == 'deposit') {
$amountDisplay = "<span style='color:green;'>+$$" . number_format($row['amount'], 2) . "</span>";
}
// Handle transfer transactions for sender and recipient
if ($row['transaction_type'] == 'transfer') {
if ($row['sender_account'] == $accountNumber) {
// Sender side of transfer (red and -)
$amountDisplay = "<span style='color:red;'>-$$" . number_format($row['amount'], 2) . "</span>";
} elseif ($row['recipient_account'] == $accountNumber) {
// Recipient side of transfer (green and +)
$amountDisplay = "<span style='color:green;'>+$$" . number_format($row['amount'], 2) . "</span>";
}
}
// Display transaction details
echo "<tr>";
echo "<td>" . htmlspecialchars($row['transaction_date']) . "</td>";
echo "<td>" . $description . "</td>";
echo "<td>" . $amountDisplay . "</td>";
echo "</tr>";
}
} else {
// Display message if no transactions
echo "<tr><td colspan='3' style='text-align: center;'>No recent transactions found.</td></tr>";
}
// Close the statement
$stmt->close();
?>
</table>
</div>
<!-- Settings -->
<div class="settings">
<a href="logout.php" class="btn">Logout</a>
</div>
</div>
<!-- Bottom Banner -->
<div class="bottom-banner">
Terms & Conditions | Privacy Policy | Contact Us: 021 748 9275
</div>
</body>
</html>