A modern, full-featured digital banking application built with PHP, MySQL, and vanilla JavaScript. D'Bag Bank provides a secure and intuitive platform for users to manage their finances, transfer money, and track transactions.
- Features
- Tech Stack
- Project Structure
- Installation
- Database Setup
- Configuration
- Usage
- Security Features
- API Endpoints
- Screenshots
- Contributing
- License
- User Registration with email validation
- Secure Login with BCrypt password hashing
- Session Management with timeout handling
- Password Strength Validation
- Account Number Generation (10-digit unique identifiers)
- Account Balance Management
- View current balance
- Toggle balance visibility
- Real-time balance updates
- Money Transfer
- Internal transfers between D'Bag Bank users
- Account name lookup before transfer
- Self-transfer prevention (frontend + backend validation)
- Amount validation (β¦100 - β¦5,000,000 limit)
- Transaction confirmation modal
- Real-time balance deduction
- Add Money
- Multiple payment methods
- Amount input validation
- Transaction reference generation
- Success confirmation with receipt
- ATM Card Management
- Virtual ATM card generation
- Card details display
- Card balance synchronization
- Secure card information
- Transaction History
- View all credit/debit transactions
- Filter by transaction type
- Transaction status indicators
- Detailed transaction information
- Responsive Design - Mobile-first approach
- Landing Page with features showcase
- Dashboard with quick actions and recent transactions
- Send Money Flow
- Step 1: Account selection with bank dropdown
- Step 2: Amount entry with quick amount buttons
- Step 3: Confirmation modal with transaction summary
- Transaction History Page
- Loading States & Animations
- Error Handling with user-friendly messages
- SQL injection prevention (prepared statements)
- XSS protection through input sanitization
- CSRF protection via session validation
- Password hashing with BCrypt
- Session-based authentication
- Secure cookie handling
- Balance validation before transfers
- Duplicate prevention for critical operations
- PHP 8.2+ - Server-side logic
- MySQL 8.0 - Database management
- PDO - Database abstraction layer
- Session Management - User authentication
- HTML5 - Semantic markup
- CSS3 - Modern styling with custom properties
- Vanilla JavaScript (ES6+) - Client-side interactivity
- Fetch API - Asynchronous HTTP requests
- XAMPP - Local development server
- Apache 2.4 - Web server
- Git - Version control
- VSCode - Code editor
D'bag_Bank/
βββ app/
β βββ controller/
β β βββ userController.php # User CRUD operations
β βββ handlers/ # β¨ API/Form handlers (NEW)
β β βββ process_login.php # Login form processor
β β βββ process_register.php # Registration processor
β β βββ process_transfer.php # Transfer processor
β β βββ resolve_account.php # Account lookup API
β βββ model/
β βββ Database.php # Database connection
β βββ model.php # Base model with CRUD methods
βββ config/
β βββ functions/
β β βββ utilities.php # Helper functions
β βββ Auth.php # Authentication helper
β βββ autoload.php # Class autoloader
β βββ config.php # Configuration constants
βββ includes/
β βββ components/ # UI Components only
β β βββ atm_card.php # ATM card display component
β β βββ dash_card.php # Dashboard balance card
β β βββ dash_footer.php # Dashboard footer
β β βββ dash_header.php # Dashboard header
β β βββ dash_main.php # Dashboard main content
β β βββ dash_trans.php # Dashboard transactions
β β βββ footer.php # Main footer
β β βββ navbar.php # Navigation bar
β β βββ send_account.php # Send money step 1
β β βββ send_amount.php # Send money step 2
β β βββ send_header.php # Send page header
β βββ layout/ # Layout components
β βββ check_auth.php # Authentication middleware
β βββ toggler.php # Toggle visibility handler
βββ public/
β βββ assets/ # β¨ Organized assets (NEW)
β β βββ css/ # All stylesheets
β β β βββ add-money.css # Add money page styles
β β β βββ dash.css # Dashboard styles
β β β βββ index.css # Landing page styles
β β β βββ legal-pages.css # Legal pages styles
β β β βββ pages.css # General pages styles
β β β βββ receipt.css # Receipt styles
β β β βββ send.css # Send money styles
β β β βββ style.css # Auth pages styles
β β β βββ support-pages.css # Support pages styles
β β β βββ transactions.css # Transaction history styles
β β βββ js/ # All JavaScript files
β β βββ add-money.js # Add money page JavaScript
β β βββ dash.js # Dashboard JavaScript
β β βββ index.js # Landing page JavaScript
β β βββ legal-pages.js # Legal pages JavaScript
β β βββ main.js # Auth pages JavaScript
β β βββ pages.js # General pages JavaScript
β β βββ receipt.js # Receipt JavaScript
β β βββ send.js # Send money JavaScript
β β βββ support-pages.js # Support pages JavaScript
β β βββ transactions.js # Transaction history JavaScript
β βββ favicon.svg # Site favicon
β βββ logo.svg # Full logo
β βββ logo-icon.svg # Logo icon
β βββ logo-stacked.svg # Stacked logo
βββ add_money.php # Add money page
βββ dashboard.php # User dashboard
βββ index.php # Landing page
βββ login.php # Login page
βββ logout.php # Logout handler
βββ register.php # Registration page
βββ send.php # Send money page
βββ transactions.php # Transaction history
βββ transfer_success.php # Success page
βββ contact.php # Contact page
βββ help-center.php # Help center
βββ blog.php # Blog page
βββ careers.php # Careers page
βββ pricing.php # Pricing page
βββ press.php # Press page
βββ about_us.php # About us page
βββ privacy-policy.php # Privacy policy
βββ terms-of-service.php # Terms of service
βββ README.md # Project documentation
app/handlers/- Backend API endpoints and form processorsapp/controller/- Business logic controllersapp/model/- Database models and abstraction layerconfig/- Configuration files and utilitiesincludes/components/- Reusable UI componentspublic/assets/- Static assets (CSS, JavaScript, images)- Root directory - Page files (views)
- XAMPP (or similar LAMP/WAMP stack)
- PHP 8.2 or higher
- MySQL 8.0 or higher
- Apache 2.4 or higher
- Git (optional, for cloning)
- Modern web browser
Option A: Clone with Git
cd C:/xampp/htdocs/php_sandbox
git clone <repository-url> D'bag_BankOption B: Manual Download
- Download the project files
- Extract to
C:/xampp/htdocs/php_sandbox/D'bag_Bank
- Open XAMPP Control Panel
- Start Apache module
- Start MySQL module
- Open phpMyAdmin: http://localhost/phpmyadmin
- Create a new database named
mob_bank - Set collation to
utf8mb4_unicode_ci
Edit app/model/Database.php with your credentials:
private $host = "localhost";
private $user = "your_mysql_username"; // Default: root
private $password = "your_mysql_password"; // Default: (empty)
private $database = "mob_bank";
private $charset = "utf8mb4";Run this SQL in phpMyAdmin:
CREATE TABLE IF NOT EXISTS users (
id INT AUTO_INCREMENT PRIMARY KEY,
username VARCHAR(50) UNIQUE NOT NULL,
email VARCHAR(100) UNIQUE NOT NULL,
name VARCHAR(100) NOT NULL,
password VARCHAR(255) NOT NULL,
account_number VARCHAR(10) UNIQUE NOT NULL,
balance DECIMAL(15, 2) DEFAULT 0.00,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
);CREATE TABLE IF NOT EXISTS banks (
id INT AUTO_INCREMENT PRIMARY KEY,
code VARCHAR(20) UNIQUE NOT NULL,
name VARCHAR(100) NOT NULL,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
-- Insert default bank
INSERT INTO banks (code, name) VALUES ('mybank', 'D\'Bag Bank');For transaction history tracking:
CREATE TABLE IF NOT EXISTS transactions (
id INT AUTO_INCREMENT PRIMARY KEY,
user_id INT NOT NULL,
type ENUM('credit', 'debit') NOT NULL,
amount DECIMAL(15, 2) NOT NULL,
recipient_account VARCHAR(10),
recipient_name VARCHAR(100),
sender_account VARCHAR(10),
sender_name VARCHAR(100),
bank_code VARCHAR(20),
description TEXT,
status ENUM('pending', 'success', 'failed') DEFAULT 'success',
timestamp TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE,
INDEX idx_user_id (user_id),
INDEX idx_timestamp (timestamp)
);-- Add initial balance to test accounts
UPDATE users SET balance = 50000.00 WHERE id = 1;
UPDATE users SET balance = 25000.00 WHERE id = 2;If your project is not in the root directory, update the fetch URLs in JavaScript files:
Example: public/assets/js/send.js
// Change this line based on your setup
const url = "/php_sandbox/D'bag_Bank/app/handlers/process_transfer.php";
// For root directory:
const url = "/app/handlers/process_transfer.php";Edit session settings in config/functions/utilities.php:
// Session timeout (in seconds)
ini_set('session.gc_maxlifetime', 3600); // 1 hour
// Session cookie lifetime
ini_set('session.cookie_lifetime', 0); // Until browser closes- Navigate to: http://localhost/php_sandbox/D'bag_Bank/register.php
- Fill in the registration form:
- Full Name
- Username (3+ characters)
- Email address
- Password (min 8 chars, uppercase, number, special char)
- Click Register
- You'll be redirected to the dashboard with a unique 10-digit account number
- Navigate to: http://localhost/php_sandbox/D'bag_Bank/login.php
- Enter your username and password
- Click Login
The dashboard shows:
- Account Balance (with hide/show toggle)
- Account Number (with copy functionality)
- ATM Card - Virtual card with your account details
- Quick Actions (Send Money, Add Money, Transactions)
- Recent Transactions (last 5)
- Click Add Money from dashboard
- Enter the amount you want to add
- Select your preferred payment method
- Complete the payment process
- Receive confirmation with transaction reference
- Balance updates in real-time
- Click Send Money from dashboard
- Step 1: Account Details
- Enter recipient's 10-digit account number
- Select bank from dropdown
- System automatically fetches recipient name
- Click Next (only enabled after successful verification)
- Step 2: Amount Entry
- Enter amount (β¦100 - β¦5,000,000)
- Or use quick amount buttons
- Add optional description
- Click Confirm
- Step 3: Confirmation
- Review transaction details
- Click Proceed to complete transfer
- Success page displays with transaction reference
- Click Transactions from dashboard or menu
- View all your transactions with:
- Transaction type (Credit/Debit)
- Amount
- Recipient/Sender details
- Date and time
- Status
// All user inputs are sanitized
function sanitize_input($data) {
$data = trim($data);
$data = stripslashes($data);
$data = htmlspecialchars($data);
return $data;
}- BCrypt hashing with
PASSWORD_BCRYPT - Minimum requirements: 8 characters, uppercase, number, special character
- Verification using
password_verify()
// Prepared statements with PDO
$stmt = $pdo->prepare("SELECT * FROM users WHERE username = ?");
$stmt->execute([$username]);// Backend validation
if ($recipient_account === $sender->account_number) {
echo json_encode(['success' => false, 'message' => 'You cannot transfer to your own account']);
exit;
}- Session regeneration on login
- Session validation on protected pages
- Automatic timeout handling
- Secure session data storage
Endpoint: app/handlers/resolve_account.php
Method: POST
Parameters:
account_number- 10-digit account numberbank_code- Bank code
Response:
{
"success": true,
"name": "John Doe"
}Endpoint: app/handlers/process_transfer.php
Method: POST
Parameters:
amount- Transfer amountrecipient_account- Recipient account numberrecipient_name- Recipient namebank_code- Bank code
Response:
{
"success": true,
"message": "Transfer successful",
"new_balance": "45000.00"
}Endpoint: includes/toggler.php
Method: GET
Parameters:
item-balanceoraccount_number
Response:
{
"success": true,
"hidden": false
}Clean and modern landing page with feature highlights
User dashboard with balance overview and quick actions
Three-step process: Account selection β Amount entry β Confirmation
Comprehensive view of all transactions with filters
- Single Currency: Currently supports only Nigerian Naira (β¦)
- No Email Verification: Email verification not implemented yet
- Internal Transfers Only: Only supports transfers within D'Bag Bank
- Basic Transaction History: No date range filters or export functionality
- No Profile Management: Users cannot update profile information after registration
- ATM card generation and display
- Add money functionality
- Email verification for new accounts
- Forgot password functionality
- Two-factor authentication (2FA)
- External bank transfers
- Bill payments
- Transaction export (CSV, PDF)
- Profile management
- Account statements
- Mobile app
- Push notifications
- Multi-currency support
- Recurring transfers
- Beneficiary management
- Dark mode
Contributions are welcome! Please follow these steps:
- Fork the repository
- Create a feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
- Follow PSR-12 for PHP code
- Use meaningful variable and function names
- Comment complex logic
- Test thoroughly before submitting PR
This project is licensed under the MIT License - see the LICENSE file for details.
Your Name
- GitHub: @yourusername
- Email: your.email@example.com
- XAMPP for the local development environment
- Tabler Icons for the beautiful icon set
- Stack Sans Text & Inter fonts from Google Fonts
- The PHP and MySQL communities for excellent documentation
For support, email your.email@example.com or open an issue in the GitHub repository.
Made with β€οΈ and PHP