Petromine - Real-time Fuel Price Platform
Petromine is an innovative web application that provides real-time updates on petrol and diesel prices across various fuel stations in India. The platform features a unique "Save to Buy" system that allows users to lock in current fuel prices for future purchases. All prices are displayed in Indian Rupees (₹).
Features
For Customers
- Real-time Price Monitoring: View current petrol and diesel prices across multiple stations
- Save to Buy: Lock in current fuel prices for up to 7 days
- Station Services: View additional services available at each station (oil change, nitrogen fill, etc.)
- Dashboard: Track savings, active price locks, and purchase history
- Price Comparison: Compare prices across different stations
For Petrol Pump Owners
- Station Management: Add and manage multiple fuel stations
- Price Updates: Update fuel prices in real-time
- Service Management: Manage available services and pricing
- Sales Tracking: Monitor customer purchases and locked prices
For System Administrators
- User Management: Oversee all platform users
- Station Oversight: Monitor all registered fuel stations
- Transaction Monitoring: Track all platform transactions
- Data Analytics: View platform usage statistics
Technology Stack
- Backend: PHP 7.4+
- Database: MySQL 5.7+
- Frontend: HTML5, CSS3, JavaScript (ES6+)
- Styling: Custom CSS with responsive design
- Icons: Font Awesome 6.0
Installation
Prerequisites
- PHP 7.4 or higher
- MySQL 5.7 or higher
- Web server (Apache/Nginx)
Quick Setup (Recommended)
-
Clone/Download the project
git clone <repository-url> cd petromine
-
Run the automatic installer
- Open your browser and navigate to:
http://your-domain/install.php - The installer will automatically:
- Create the database
- Set up all tables
- Insert comprehensive sample data
- Create demo users
- Open your browser and navigate to:
-
Start using the application
- Access the homepage:
http://your-domain/index.php - Login with demo credentials (see below)
- Access the homepage:
Manual Setup (Alternative)
-
Database Setup
mysql -u root -p CREATE DATABASE petromine; USE petromine; SOURCE database/setup_complete.sql;
-
Configure Database Connection
- Edit
config/database.phpif your credentials differ from defaults
- Edit
Demo Login Credentials
| Role | Password | Description | |
|---|---|---|---|
| Admin | admin@petromine.com | password | Original admin account |
| Demo Admin | admin@demo.com | password123 | Demo admin with full access |
| Customer | customer@demo.com | password123 | Demo customer with sample purchases |
| Pump Owner | owner@demo.com | password123 | Demo station owner |
| Customer 2 | alice@demo.com | password123 | Additional customer account |
| Customer 3 | bob@demo.com | password123 | Another customer with transactions |
Project Structure
petromine/
├── api/ # API endpoints
│ ├── stations.php # Station data API
│ ├── save-to-buy.php # Save to buy functionality
│ ├── user-stats.php # User statistics
│ ├── saved-purchases.php # User purchase history
│ └── redeem-purchase.php # Purchase redemption
├── assets/
│ ├── css/
│ │ └── style.css # Main stylesheet
│ └── js/
│ └── main.js # JavaScript functionality
├── config/
│ └── database.php # Database configuration
├── database/
│ ├── schema.sql # Database schema
│ ├── sample_data.sql # Comprehensive sample data
│ ├── demo_users.sql # Demo user accounts
│ ├── price_history.sql # Historical price data
│ └── setup_complete.sql # Complete setup script
├── index.php # Homepage
├── login.php # User login
├── register.php # User registration
├── dashboard.php # User dashboard
├── save-to-buy.php # Save to buy interface
├── manage-station.php # Station management (owners)
├── logout.php # User logout
├── install.php # Automatic installation script
└── README.md # This file
Sample Data Included
The application comes with comprehensive sample data:
🏪 13 Fuel Stations across different locations:
- Shell stations (Downtown, Uptown, Mall Road, 24/7)
- BP stations (Highway, Riverside, Airport)
- Exxon stations (City Center, Westside)
- Chevron stations (Plaza, Highway Junction)
- Texaco stations (City Center, Express Lane)
👥 Multiple User Accounts:
- 7 Demo Users with easy-to-remember credentials
- 5 Pump Owners managing different station chains
- 1 System Admin with full platform access
- Sample transactions showing the Save-to-Buy feature in action
💰 Realistic Price Data (in Indian Rupees):
- Current prices for petrol (₹101-₹104/L) and diesel (₹88-₹91/L) at all stations
- 30 days of price history showing realistic fluctuations
- Weekend and holiday price variations (higher during festivals)
- Recent price updates demonstrating real-time changes
🔧 Station Services (60+ services):
- Engine oil changes (₹1,999 - ₹2,999) with different pricing tiers
- Nitrogen air filling services (₹45 - ₹55)
- Car wash and detailing options (₹150 - ₹7,999)
- Convenience store amenities
- 24/7 services and emergency support
- Location-specific services (airport shuttle, riverside picnic area, etc.)
📊 Transaction History:
- Active Save-to-Buy purchases with different expiry dates
- Redeemed purchases showing customer savings
- Expired purchases demonstrating the time-limited nature
- Price lock scenarios with realistic quantities and amounts
Database Schema
Users Table
- Stores user information with role-based access (customer, pump_owner, admin)
- Includes demo accounts with hashed passwords
Fuel Stations Table
- Contains station information including location and owner details
- GPS coordinates for mapping functionality
Fuel Prices Table
- Tracks historical and current fuel prices for each station
- Includes 30 days of price history for trend analysis
Station Services Table
- Manages additional services offered by each station
- Pricing and availability information
Save to Buy Table
- Handles price locking functionality with expiration dates
- Tracks purchase status (active, redeemed, expired)
Key Features Implementation
Save to Buy System
- Users can lock current fuel prices for up to 7 days
- Automatic expiration handling
- Redemption tracking and validation
Real-time Price Updates
- Station owners can update prices instantly
- Customers see current prices across all stations
- Price history tracking for analytics
Role-based Access Control
- Three user roles with different permissions
- Secure session management
- Protected API endpoints
API Endpoints
GET /api/stations.php- Retrieve all active stations with current pricesPOST /api/save-to-buy.php- Lock fuel prices for future purchaseGET /api/user-stats.php- Get user statistics and savingsGET /api/saved-purchases.php- Retrieve user's saved purchasesPOST /api/redeem-purchase.php- Redeem a saved purchase
On this page
Languages
PHP80.2%JavaScript12.4%CSS7.5%
Contributors
Created September 29, 2025
Updated September 29, 2025