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.
- 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
- 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)
- PHP 7.4 or higher
- MySQL database
- A web server (Apache, Nginx, etc.)
- Basic knowledge of setting up a PHP project
-
Clone the repository
git clone https://github.com/snehavish595/Car-Rental.git cd Car-Rental -
Set up your database
- Create a MySQL database named
carrental - Update credentials in
db_connect.phpwith your database details:$servername = "localhost"; $username = "root"; // Your DB username $password = ""; // Your DB password $dbname = "carrental";
- Create a MySQL database named
-
Deploy to your web server
- Copy files to your web server's document root
- Access via your browser (e.g.,
http://localhost/Car-Rental)
- Go to
customer_register.php→ Create an account - Log in at
customer_login.php - Browse available cars on the home page (
index.php) - Book a car by selecting dates and rental duration
- Logout when done
- Sign up at
agency_register.phpas a rental agency - Log in at
agency_login.phpto access your dashboard - Add new cars to your fleet via
add_car.php - View and manage all cars in
view_cars.php - Check all bookings for your vehicles in
view_bookings.php
index.php- Main customer-facing car browsing pagecustomer_login.php/customer_register.php- Customer authenticationagency_login.php/agency_register.php- Agency authenticationadd_car.php- Agencies add new vehicles to their fleetview_cars.php- Agencies manage their car inventoryview_bookings.php- View all customer bookingsdb_connect.php- Database connection setupstyle.css- Custom styling
- SQL injection prevention (prepared statements are partially used)
- CSRF token validation
- Input validation and sanitization
- Rate limiting on login attempts
Found a bug? Have an idea for a feature? Feel free to fork the repo and submit a pull request. All contributions are welcome!
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.