Skip to content

zeeshan020dev/Railway-Management-System-in-PHP

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

16 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸš† Railway Management System

Project Status PHP Bootstrap License

A comprehensive, web-based Railway Management System built with PHP and MySQL. This application streamlines the process of booking train tickets, managing train schedules, and categorizing travel classes. It features a responsive modern UI, dynamic data fetching, and an integrated booking workflow.


πŸ“– Table of Contents


✨ Features

πŸ‘€ User Interface (Frontend)

  • Hero Section: Video background with a dynamic "Quick Search" widget for finding trains between cities.
  • Responsive Design: Built with Bootstrap 5.3, ensuring full compatibility across mobile, tablet, and desktop.
  • Animations: Smooth scroll animations using AOS (Animate On Scroll).
  • Dynamic Train Listing: Trains are automatically fetched from the database and grouped by class:
    • Business
    • Economy
    • AC Standard
    • AC Sleeper

βš™οΈ Functionality (Backend)

  • Session Management: Secure login/logout logic with cache control to prevent back-button re-entry after logout.
  • Role-Based Access: Differentiates between normal Users and Admins (displays "πŸ‘‘ Admin Panel" link for admins).
  • Booking System:
    • Interactive Modal for ticket reservation.
    • Auto-fills train details (Name, Route, Price) when "Book Now" is clicked.
    • Form validation (Client-side JS).
    • Payment Integration UI: Toggles between Stripe (Card) and JazzCash (Mobile) input fields.

πŸ›  Technology Stack

Component Technology
Backend Core PHP (PDO), MySQL
Frontend HTML5, CSS3, JavaScript (ES6)
Framework Bootstrap 5.3.3
Libraries AOS (Animations)
Server Apache (XAMPP/WAMP)

πŸ“Έ Screenshots


πŸš€ Installation & Setup

Prerequisites

  • XAMPP / WAMP / MAMP (or any PHP server environment).
  • MySQL Database.

Steps

  1. Clone the Repository

    git clone [https://github.com/your-username/railway-management-system.git](https://github.com/your-username/railway-management-system.git)
    cd railway-management-system
  2. Database Configuration

    • Create a database named railway_db.
    • Import the SQL schema provided below.
    • Update connect.php with your credentials:
      $host = 'localhost';
      $db   = 'railway_db';
      $user = 'root';
      $pass = '';
  3. Run the Project

    • Place the project folder in your server's root directory (e.g., htdocs).
    • Open your browser and navigate to: http://localhost/railway-management-system/index.php

πŸ—„ Database Schema

To ensure the application runs smoothly, execute the following SQL.

1. Visual Relationship Diagram

erDiagram
    ROUTES ||--o{ TRAINS : "contains"
    ROUTES {
        int id PK
        string name
    }
    TRAINS {
        int id PK
        string train_name
        int route_id FK
        string class
        decimal price
        string depart_time
        int seats
    }

Loading

2. SQL Setup Commands

Routes Table

CREATE TABLE routes (
    id INT AUTO_INCREMENT PRIMARY KEY,
    name VARCHAR(255) NOT NULL -- e.g., "Lahore to Karachi"
);

Trains Table

CREATE TABLE trains (
    id INT AUTO_INCREMENT PRIMARY KEY,
    train_name VARCHAR(255) NOT NULL,
    route_id INT,
    class VARCHAR(50) NOT NULL, -- 'Business', 'Economy', etc.
    price DECIMAL(10,2) NOT NULL,
    depart_time VARCHAR(50),
    seats INT,
    image VARCHAR(255),
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
    FOREIGN KEY (route_id) REFERENCES routes(id)
);

πŸ’‘ Pro Tip: To create an Admin User, insert a user into your users table and set the role to 'admin'.

INSERT INTO users (username, email, password, role) VALUES ('Admin', 'admin@railway.com', 'admin123', 'admin');

πŸ“‚ Project Structure

Here is a breakdown of the key files and folders:

railway-system/
β”œβ”€β”€ πŸ“‚ admin-panel/        # πŸ” The Engine Room
β”‚   β”œβ”€β”€ uploads/           # Stores train images uploaded by admins
β”‚   β”œβ”€β”€ user_dashboard.php # Customer booking history
β”‚   └── login/register.php # Auth logic
β”‚
β”œβ”€β”€ πŸ“‚ pages/              # πŸ“„ Static Content
β”‚   β”œβ”€β”€ trains.php         # Full schedule list
β”‚   └── contact.php        # Support forms
β”‚
β”œβ”€β”€ πŸ“„ connect.php         # πŸ”Œ Database Connection (Do not share this!)
β”œβ”€β”€ πŸ“„ index.php           # 🏠 Homepage (The file you viewed)
β”œβ”€β”€ πŸ“„ main.css            # 🎨 Styling & Theme
β”œβ”€β”€ πŸ“„ submit_booking.php  # πŸ“¨ Process booking logic
└── πŸ“„ README.md           # πŸ“˜ You are reading this


πŸ—Ί Future Roadmap

We have big plans for this project! Here is what we are working on next:

  • Seat Selection Map: Allow users to pick specific seat numbers visually.
  • Email Notifications: Send tickets via PHPMailer upon booking confirmation.
  • Admin Analytics: A chart dashboard showing daily revenue using Chart.js.
  • PNR Status Check: A module to track booking status using a unique ID.

🀝 Contributing

Contributions make the open-source community an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

πŸ“ License

Distributed under the MIT License. See LICENSE for more information.


πŸ‘€ Authors

Muhammad Zeeshan Islam

Co-Founder – Unicodrex | Technical Lead – Skill Sprint | Trainee – CEGA

GitHub

Rana Ali Husnain

GitHub

Built with ❀️ for Academic Project

About

A comprehensive Railway Reservation platform using native PHP, MySQL, and Bootstrap 5. Includes role-based auth (Admin/User), dynamic scheduling, and payment gateway UI integration.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors