This is a full-stack, fraud-resistant event booking platform designed for DBMS and concurrency features.
Key DBMS Features demonstrated:
- Transactions & Row-Level Locking: Handles concurrent bookings using
SELECT ... FOR UPDATEto avoid double-booking the same seat. - Triggers: MySQL Trigger implicitly logs events and detects unusual booking volumes (>5 bookings/min), automatically marking accounts as 'Suspicious'.
- Stored Procedures: Exposes a procedure
BlockUserto enforce system-wide bans on hostile actors through the admin dashboard. - Constraints: Relational Integrity,
ON DELETE CASCADE, and aUNIQUEidentifier on(event_id, seat_number).
Make sure you have the following installed:
- MySQL Server (e.g., via XAMPP, WAMP, or standalone).
- Python 3.8+
- Open your MySQL client (e.g., phpMyAdmin, MySQL Workbench, or CLI).
- Load and run the provided SQL script:
- Import or execute the contents of
db_schema.sql. - This creates the
fraud_booking_systemdatabase, tables, triggers, and stores demo users and events.
- Import or execute the contents of
Note: Do not change the database name unless you plan to update
app.py.
-
Open your terminal and navigate to the project directory:
cd "DS - Project ( anti fraud )"
-
Create a virtual environment (optional but recommended):
python -m venv venv # Activate on Windows: venv\Scripts\activate
-
Install the Python dependencies:
pip install -r requirements.txt
-
Configure Database Credentials:
- Open
app.py. - Edit the
DB_CONFIGdictionary on line 8 to match your local MySQL credentials:DB_CONFIG = { 'host': 'localhost', 'user': 'root', # Your MySQL username 'password': '', # Your MySQL password 'database': 'fraud_booking_system', 'autocommit': False }
- Open
-
Run the Server:
python app.py
The server will start on
http://127.0.0.1:5000.
With the Flask server running, open your web browser and navigate to:
-
Booking Page: http://127.0.0.1:5000/
- Demo Users: ID
1,2, or3. - Enter the User ID, select an event, a seat, and click Book.
- Demo Users: ID
-
Admin Dashboard: http://127.0.0.1:5000/admin
- View real-time activity and fraud logs.
- If a user tests the bounds of the trigger (clicking Book >5 times in a minute for another event), they will be flagged.
- You can permanently Block the suspended user right from the dashboard.
- Test Concurrency (Double Booking Error): Open two terminal tabs (or tabs in the browser) and try booking the exact same seat for the exact same event at the exact same time. The database locking (
FOR UPDATE) will ensure only one user secures the ticket. - Test Fraud Trigger: Go to the booking page. Quickly hit the "Confirm Booking" button (or book 6 distinct seats) using User ID
1under a 60-second window. Observe the Admin Dashboard. The system will flag them asSuspicious. - Test Stored Procedure: As an admin, click "Block User 1" on the dashboard. Now go back to the booking page and try booking another seat as User ID
1. The backend will firmly deny access stating the account is blocked.