Skip to content

snehavish595/Car-Rental

Repository files navigation

🚗 Car Rental System

A straightforward PHP-based car rental platform where customers can browse available vehicles, book cars, and manage their rentals—while rental agencies manage their fleet and track bookings.

What This Does

  • For Customers: Browse available cars, check prices, and book a vehicle for the dates you need
  • For Agencies: Add cars to your fleet, manage bookings, and track rental activity
  • Secure Authentication: Separate login systems for customers and agencies with password hashing
  • Easy Booking: Simple, intuitive booking interface with date and duration selection

Tech Stack

  • Backend: PHP 99.9% (handles all business logic, authentication, and database operations)
  • Frontend: Bootstrap + CSS for responsive, clean UI
  • Database: MySQL (stores cars, users, and booking information)

Getting Started

What You Need

  • PHP 7.4 or higher
  • MySQL database
  • A web server (Apache, Nginx, etc.)
  • Basic knowledge of setting up a PHP project

Quick Setup

  1. Clone the repository

    git clone https://github.com/snehavish595/Car-Rental.git
    cd Car-Rental
  2. Set up your database

    • Create a MySQL database named carrental
    • Update credentials in db_connect.php with your database details:
      $servername = "localhost";
      $username = "root";      // Your DB username
      $password = "";          // Your DB password
      $dbname = "carrental";
  3. Deploy to your web server

    • Copy files to your web server's document root
    • Access via your browser (e.g., http://localhost/Car-Rental)

How It Works

For Customers

  1. Go to customer_register.php → Create an account
  2. Log in at customer_login.php
  3. Browse available cars on the home page (index.php)
  4. Book a car by selecting dates and rental duration
  5. Logout when done

For Agencies

  1. Sign up at agency_register.php as a rental agency
  2. Log in at agency_login.php to access your dashboard
  3. Add new cars to your fleet via add_car.php
  4. View and manage all cars in view_cars.php
  5. Check all bookings for your vehicles in view_bookings.php

Key Files

  • index.php - Main customer-facing car browsing page
  • customer_login.php / customer_register.php - Customer authentication
  • agency_login.php / agency_register.php - Agency authentication
  • add_car.php - Agencies add new vehicles to their fleet
  • view_cars.php - Agencies manage their car inventory
  • view_bookings.php - View all customer bookings
  • db_connect.php - Database connection setup
  • style.css - Custom styling

Important Notes

⚠️ Security: This project uses basic password hashing. For production, consider adding:

  • SQL injection prevention (prepared statements are partially used)
  • CSRF token validation
  • Input validation and sanitization
  • Rate limiting on login attempts

Want to Contribute?

Found a bug? Have an idea for a feature? Feel free to fork the repo and submit a pull request. All contributions are welcome!

License

This project is open source and available under the MIT License. Use it, modify it, learn from it—just give credit where it's due.


Have questions? Open an issue on GitHub and we'll help you out.

Releases

No releases published

Packages

 
 
 

Contributors